Skip to content

Commit 0aae83d

Browse files
committed
fall back to OSResilientStorage in NSE receive-receipts gate
NSE reads OSUD_RECEIVE_RECEIPTS_ENABLED from shared UD, but that returns NO when the device is locked under NSFileProtectionCompleteUntilFirstUserAuthentication. Short-circuit on YES, then consult the file-backed mirror so receive receipts still fire for NSE wakes during the prewarm/locked window.
1 parent 9bc16f4 commit 0aae83d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

iOS_SDK/OneSignalSDK/OneSignalExtension/OneSignalReceiveReceiptsController.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@
3535
@implementation OneSignalReceiveReceiptsController
3636

3737
- (BOOL)isReceiveReceiptsEnabled {
38-
return [OneSignalUserDefaults.initShared getSavedBoolForKey:OSUD_RECEIVE_RECEIPTS_ENABLED defaultValue:NO];
38+
BOOL enabled = [OneSignalUserDefaults.initShared getSavedBoolForKey:OSUD_RECEIVE_RECEIPTS_ENABLED defaultValue:NO];
39+
if (enabled) {
40+
return YES;
41+
}
42+
// UserDefaults can return NO for two reasons: the flag is genuinely off, or the shared
43+
// UserDefaults file isn't readable right now (NSE running while device is locked under
44+
// NSFileProtectionCompleteUntilFirstUserAuthentication). Fall back to the unencrypted cache.
45+
NSString *cached = [OSResilientStorage stringForKey:OSResilientStorage.keyReceiveReceiptsEnabled];
46+
return [cached isEqualToString:@"1"];
3947
}
4048

4149
- (void)sendReceiveReceiptWithNotificationId:(NSString *)notificationId {

0 commit comments

Comments
 (0)