File tree Expand file tree Collapse file tree
iOS_SDK/OneSignalSDK/OneSignalExtension Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828#import < Foundation/Foundation.h>
2929#import " OneSignalReceiveReceiptsController.h"
3030#import < OneSignalCore/OneSignalCore.h>
31+ #import < OneSignalOSCore/OneSignalOSCore-Swift.h>
3132#import " OSMacros.h"
3233#import " OneSignalExtensionRequests.h"
3334
3435@implementation OneSignalReceiveReceiptsController
3536
3637- (BOOL )isReceiveReceiptsEnabled {
37- 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 may 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" ];
3847}
3948
4049- (void )sendReceiveReceiptWithNotificationId : (NSString *)notificationId {
You can’t perform that action at this time.
0 commit comments