diff --git a/package.json b/package.json index 1c2df5f5..2d3e6b43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "impro", - "version": "0.18.203", + "version": "0.18.204", "type": "module", "scripts": { "start": "rm -rf \"${BUILD_DIR:-build}\" && NODE_ENV=development eleventy --serve", diff --git a/src/js/api.js b/src/js/api.js index be594ee9..b5e21ae8 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -741,10 +741,10 @@ export class Api { }); } - async unregisterPush({ serviceDid, token }) { + async unregisterPush({ serviceDid, token, platform, appId }) { await this.request("app.bsky.notification.unregisterPush", { method: "POST", - body: { serviceDid, token }, + body: { serviceDid, token, platform, appId }, headers: { "atproto-proxy": `${serviceDid}#bsky_notif`, }, diff --git a/src/js/push/courierPushService.js b/src/js/push/courierPushService.js index d14109b7..a72c9be4 100644 --- a/src/js/push/courierPushService.js +++ b/src/js/push/courierPushService.js @@ -202,6 +202,8 @@ export class CourierPushService { await this.api.unregisterPush({ serviceDid: this.serviceDid, token: JSON.stringify(subscription), + platform: PLATFORM, + appId: APP_ID, }); } catch (error) { console.error("Failed to unregister push subscription", error); diff --git a/tests/unit/specs/courierPushService.test.js b/tests/unit/specs/courierPushService.test.js index 59ac0d1a..823f4d63 100644 --- a/tests/unit/specs/courierPushService.test.js +++ b/tests/unit/specs/courierPushService.test.js @@ -170,6 +170,13 @@ describe("CourierPushService registration", () => { service.api.unregisterPush = unregisterPush; await service.disable(); assert.equal(unregisterPush.mock.calls.length, 1); + const args = unregisterPush.mock.calls[0].arguments[0]; + assert.equal(args.appId, "social.impro"); + assert.equal(args.platform, "web"); + assert.deepEqual(JSON.parse(args.token), { + endpoint: SUBSCRIPTION.endpoint, + keys: SUBSCRIPTION.keys, + }); assert.equal(service.$enabled.get(), false); });