Skip to content

Commit

Permalink
fix(push): use standalone registration endpoint (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-kozinski authored Oct 28, 2024
1 parent c4f023a commit da8d974
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class PktPush(
val i = Interaction.on(context)
.merge { cxt: ActionContext.Builder -> cxt.cxt_ui(cxt_ui) }
pocket.syncRemote<Thing?>(
null, pocket.spec().actions().register_push_v2()
null, pocket.spec().actions().register_push()
.context(i.context)
.time(i.time)
.device_identifier(guid)
Expand Down Expand Up @@ -111,7 +111,7 @@ class PktPush(
if (registeredGuid.get() != null) {
val i = Interaction.on(context).merge { cxt: ActionContext.Builder -> cxt.cxt_ui(cxt_ui) }
pocket.syncRemote<Thing?>(
null, pocket.spec().actions().deregister_push_v2()
null, pocket.spec().actions().deregister_push()
.context(i.context)
.time(i.time)
.device_identifier(registeredGuid.get())
Expand Down
35 changes: 34 additions & 1 deletion sync-pocket/src/main/graphql/v3.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ extend type Item @figment(related_to: "SaveForLaterFeature") @figment(related_to
"If a the domainId is a subdomain this is the primary domain id"
origin_domain_id: String @deprecated @figment(client_api_alias: "originDomainId")

"The http resonse code of the given url"
"The http response code of the given url"
response_code: String @deprecated @figment(client_api_alias: "responseCode")

"TThe length in bytes of the content"
Expand Down Expand Up @@ -2421,11 +2421,28 @@ type UnconfirmedShare @_deprecated @figment(related_to: "SendToFriendFeature") {

extend type Mutation {
"Register this device to start receiving push notifications. Uses Firebase Messaging (previously called GCM and previously called C2DM)"
register_push(
"See {PushType} for details" push_type: PushType
"A unique device identifier. {guid} is ok for Android." device_identifier: String
"The `push token` for the device" token: String
): Void
@figment(related_to: "PushFeature")
@figment(auth: "UserOptionalAuth")
@figment(address: "push/register")
@figment(effect: "When we receive a registration for a device_identifier and the same app we will invalidate the old push_token for that application.")
}

extend type Mutation {
"""
Deprecated: v3-proxy (which now handles v3/send) doesn't support this action.
Register this device to start receiving push notifications. Uses Firebase Messaging (previously called GCM and previously called C2DM)
"""
register_push_v2(
"See {PushType} for details" push_type: PushType
"A unique device identifier. {guid} is ok for Android." device_identifier: String
"The `push token` for the device" token: String
): Void
@deprecated
@figment(related_to: "PushFeature")
@figment(auth: "UserAuth")
@figment(priority: "REMOTE")
Expand All @@ -2436,10 +2453,26 @@ extend type Mutation {

extend type Mutation {
"Stop a token previously registered with {register_push_v2}"
deregister_push(
"See {PushType} for details" push_type: PushType
"A unique device identifier. {guid} is ok for Android." device_identifier: String
): Void
@figment(related_to: "PushFeature")
@figment(auth: "UserOptionalAuth")
@figment(address: "push/deregister")
@figment(effect: "Sets the expiration date of the token in the database to the current date.")
}

extend type Mutation {
"""
Deprecated: v3-proxy (which now handles v3/send) doesn't support this action.
Stop a token previously registered with {register_push_v2}
"""
deregister_push_v2(
"See {PushType} for details" push_type: PushType
"A unique device identifier. {guid} is ok for Android." device_identifier: String
): Void
@deprecated
@figment(related_to: "PushFeature")
@figment(auth: "UserAuth")
@figment(priority: "ASAP")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.pocket.sdk.api.generated.action.Delete;
import com.pocket.sdk.api.generated.action.DeleteAlias;
import com.pocket.sdk.api.generated.action.DeleteAnnotation;
import com.pocket.sdk.api.generated.action.DeregisterPush;
import com.pocket.sdk.api.generated.action.DeregisterPushV2;
import com.pocket.sdk.api.generated.action.FakePremiumStatus;
import com.pocket.sdk.api.generated.action.Favorite;
Expand All @@ -33,6 +34,7 @@
import com.pocket.sdk.api.generated.action.Readd;
import com.pocket.sdk.api.generated.action.RecentSearch;
import com.pocket.sdk.api.generated.action.RederiveItems;
import com.pocket.sdk.api.generated.action.RegisterPush;
import com.pocket.sdk.api.generated.action.RegisterPushV2;
import com.pocket.sdk.api.generated.action.RegisterSocialToken;
import com.pocket.sdk.api.generated.action.ReportArticleView;
Expand Down Expand Up @@ -965,6 +967,8 @@ private static Profile getLoggedInProfile(Space space) {


// Some that are not abstract because they have effects but we can ignore locally
@Override protected void register_push(RegisterPush action, Space space) {}
@Override protected void deregister_push(DeregisterPush action, Space space) {}
@Override protected void register_push_v2(RegisterPushV2 action, Space space) {}
@Override protected void deregister_push_v2(DeregisterPushV2 action, Space space) {}
}
13 changes: 13 additions & 0 deletions sync-pocket/sync-pocket-usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2972,6 +2972,19 @@ thing UnknownPocketMetadata.title 6
thing UnknownPocketMetadata.url 7
thing CorpusItem.preview 9
thing Image.url 8
action register_push
action register_push.time 1
action register_push.action 2
action register_push.context 3
action register_push.push_type 4
action register_push.device_identifier 5
action register_push.token 6
action deregister_push
action deregister_push.time 1
action deregister_push.action 2
action deregister_push.context 3
action deregister_push.push_type 4
action deregister_push.device_identifier 5

- thing Collection.externalId
- thing Collection.status
Expand Down

0 comments on commit da8d974

Please sign in to comment.