ai/at
1
0
Files
at/ios/patching/047-social-app-ios-dynamic-service.patch

54 lines
1.9 KiB
Diff

--- a/src/lib/notifications/notifications.ts 2026-03-15 19:17:45
+++ b/src/lib/notifications/notifications.ts 2026-03-15 19:17:38
@@ -6,8 +6,8 @@
import debounce from 'lodash.debounce'
import {
- BLUESKY_NOTIF_SERVICE_HEADERS,
- PUBLIC_APPVIEW_DID,
+ getAppviewDid,
+ getNotifServiceHeaders,
PUBLIC_STAGING_APPVIEW_DID,
} from '#/lib/constants'
import {logger as notyLogger} from '#/lib/notifications/util'
@@ -39,7 +39,7 @@
const payload: AppBskyNotificationRegisterPush.InputSchema = {
serviceDid: currentAccount.service?.includes('staging')
? PUBLIC_STAGING_APPVIEW_DID
- : PUBLIC_APPVIEW_DID,
+ : getAppviewDid(currentAccount.service),
platform: Platform.OS,
token: token.data,
appId: 'xyz.blueskyweb.app',
@@ -49,7 +49,7 @@
notyLogger.debug(`registerPushToken: registering`, {...payload})
await agent.app.bsky.notification.registerPush(payload, {
- headers: BLUESKY_NOTIF_SERVICE_HEADERS,
+ headers: getNotifServiceHeaders(currentAccount.service),
})
notyLogger.debug(`registerPushToken: success`)
@@ -301,17 +301,18 @@
const token = await getPushToken()
if (token) {
for (const agent of agents) {
+ const serviceUrl = agent.serviceUrl.toString()
await agent.app.bsky.notification.unregisterPush(
{
- serviceDid: agent.serviceUrl.hostname.includes('staging')
+ serviceDid: serviceUrl.includes('staging')
? PUBLIC_STAGING_APPVIEW_DID
- : PUBLIC_APPVIEW_DID,
+ : getAppviewDid(serviceUrl),
platform: Platform.OS,
token: token.data,
appId: 'xyz.blueskyweb.app',
},
{
- headers: BLUESKY_NOTIF_SERVICE_HEADERS,
+ headers: getNotifServiceHeaders(serviceUrl),
},
)
notyLogger.debug(`Push token unregistered for ${agent.session?.handle}`)