Skip to content

Commit 0156328

Browse files
committed
Update the remote params JWT key
* Remote params returns `jwt_required` as the key to use
1 parent 74e4ef7 commit 0156328

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
#define OSUD_REQUIRES_USER_PRIVACY_CONSENT @"OSUD_REQUIRES_USER_PRIVACY_CONSENT"
8080

8181
/* Identity Verification */
82-
// TODO: JWT 🔐 Figure out the key below and may need to relate to existing key IOS_REQUIRES_USER_ID_AUTHENTICATION
8382
#define OSUD_USE_IDENTITY_VERIFICATION @"OSUD_USE_IDENTITY_VERIFICATION"
8483
#define OS_JWT_BEARER_TOKEN @"OS_JWT_BEARER_TOKEN"
8584
#define OS_JWT_TOKEN_INVALID @"OS_JWT_TOKEN_INVALID"
@@ -135,7 +134,7 @@
135134
#define IOS_USES_PROVISIONAL_AUTHORIZATION @"uses_provisional_auth"
136135
#define IOS_REQUIRES_EMAIL_AUTHENTICATION @"require_email_auth"
137136
#define IOS_REQUIRES_SMS_AUTHENTICATION @"require_sms_auth"
138-
#define IOS_REQUIRES_USER_ID_AUTHENTICATION @"require_user_id_auth" // TODO: JWT 🔐 Figure out the key, also think about needing to migrate this value
137+
#define IOS_JWT_REQUIRED @"jwt_required" // Returned by remote params
139138
#define IOS_RECEIVE_RECEIPTS_ENABLE @"receive_receipts_enable"
140139
#define IOS_OUTCOMES_V2_SERVICE_ENABLE @"v2_enabled"
141140
#define IOS_LOCATION_SHARED @"location_shared"

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -638,12 +638,9 @@ + (void)downloadIOSParamsWithAppId:(NSString *)appId {
638638
NSString *userId = nil;
639639

640640
[OneSignalCoreImpl.sharedClient executeRequest:[OSRequestGetIosParams withUserId:userId appId:appId] onSuccess:^(NSDictionary *result) {
641-
642-
// TODO: JWT 🔐 Mock it for now to always be true
643-
OneSignalUserManagerImpl.sharedInstance.requiresUserAuth = true;
644-
// if (result[IOS_REQUIRES_USER_ID_AUTHENTICATION]) {
645-
// OneSignalUserManagerImpl.sharedInstance.requiresUserAuth = [result[IOS_REQUIRES_USER_ID_AUTHENTICATION] boolValue];
646-
// }
641+
if (result[IOS_JWT_REQUIRED]) {
642+
OneSignalUserManagerImpl.sharedInstance.requiresUserAuth = [result[IOS_JWT_REQUIRED] boolValue];
643+
}
647644

648645
if (result[IOS_USES_PROVISIONAL_AUTHORIZATION] != (id)[NSNull null]) {
649646
[OneSignalUserDefaults.initStandard saveBoolForKey:OSUD_USES_PROVISIONAL_PUSH_AUTHORIZATION withValue:[result[IOS_USES_PROVISIONAL_AUTHORIZATION] boolValue]];

0 commit comments

Comments
 (0)