From 531eb34332ec3ca1c2927a686d927d9c35edeb8d Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Tue, 27 Feb 2024 17:49:22 +0100 Subject: [PATCH] prefix DEBUG push tokens with `sandbox:` DEBUG-buils are only builds from us devs (testflight have DEBUG=0) and can only receive remote push notification from the sandbox-apns. still, it makes sense to get the PUSH notifications, esp. during development, but also later to see if sth. goes wrong. this commit reverts the change done at https://github.com/deltachat/deltachat-ios/pull/1773 , however, server-side, we aimt to have only one notifications.delta.chat (that then calls sandbox or not based on the token) --- deltachat-ios/AppDelegate.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deltachat-ios/AppDelegate.swift b/deltachat-ios/AppDelegate.swift index 7a43fea3ad..0674293c34 100644 --- a/deltachat-ios/AppDelegate.swift +++ b/deltachat-ios/AppDelegate.swift @@ -373,7 +373,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD // we pass the received token to the app's notification server then. func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) } - let notifyToken = tokenParts.joined() + #if DEBUG + let notifyToken = "sandbox:" + tokenParts.joined() + #else + let notifyToken = tokenParts.joined() + #endif logger.info("Notifications: Token: \(notifyToken)") self.notifyToken = notifyToken dcAccounts.setPushToken(token: notifyToken)