diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/requests/notifications/RegisterForPushNotifications.java b/mastodon/src/main/java/org/joinmastodon/android/api/requests/notifications/RegisterForPushNotifications.java index 5b096f2ba..b1ef8ace9 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/requests/notifications/RegisterForPushNotifications.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/requests/notifications/RegisterForPushNotifications.java @@ -9,7 +9,7 @@ public class RegisterForPushNotifications extends MastodonAPIRequest{ + private final PushSubscription.Policy policy; + public UpdatePushSettings(PushSubscription.Alerts alerts, PushSubscription.Policy policy){ super(HttpMethod.PUT, "/push/subscription", PushSubscription.class); setRequestBody(new Request(alerts, policy)); + this.policy=policy; + } + + @Override + public void validateAndPostprocessResponse(PushSubscription respObj, Response httpResponse) throws IOException{ + super.validateAndPostprocessResponse(respObj, httpResponse); + respObj.policy=policy; } private static class Request{ public Data data=new Data(); + public PushSubscription.Policy policy; public Request(PushSubscription.Alerts alerts, PushSubscription.Policy policy){ this.data.alerts=alerts; - this.data.policy=policy; + this.policy=policy; } private static class Data{ public PushSubscription.Alerts alerts; - public PushSubscription.Policy policy; } } } diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java b/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java index 332c33f06..7c0fc0967 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java +++ b/mastodon/src/main/java/org/joinmastodon/android/model/PushSubscription.java @@ -23,6 +23,7 @@ public class PushSubscription extends BaseModel implements Cloneable{ ", endpoint='"+endpoint+'\''+ ", alerts="+alerts+ ", serverKey='"+serverKey+'\''+ + ", policy="+policy+ '}'; }