Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
c6989b2
[nit] remove extraneous logging already done by client
nan-li Aug 27, 2024
ac887b9
[nit] log when GET requests are sent in Client
nan-li Aug 28, 2024
d19cf0c
Expose JWT config to objective c
nan-li Aug 30, 2024
40e74ee
[nit] Rename jwt token parameter for clarity
nan-li Aug 30, 2024
90a08f7
Move shared user helpers to utility class
nan-li Aug 30, 2024
c9b0a94
Modify getting IAM to use alias and jwt
nan-li Aug 30, 2024
e7eeba5
create simple way to fire invalid Jwt callback
emawby Sep 3, 2024
c0ad6c3
Adding OSJwtInvalidatedEvent and updating the JWT callback
emawby Sep 3, 2024
f926109
refactor in UserExecutor to handle 401s
emawby Sep 4, 2024
02acc2a
Unit tests for UserExecutor with identity verification on
emawby Sep 4, 2024
2530e2f
Fire callback for 401 error in property executor
emawby Sep 4, 2024
c0156d7
fire Jwt callback from subscription executor
emawby Sep 4, 2024
d5514e4
fire Jwt callback for add and remove aliases 401
emawby Sep 4, 2024
5afab13
Remove message for invalid handler
emawby Sep 11, 2024
1d0b97f
Fire JWT callback from IAMs
emawby Sep 11, 2024
f3cb3d8
Store UserExecutor requests that need auth
emawby Sep 11, 2024
aca978e
store property update requests that need auth
emawby Sep 11, 2024
1ae0deb
store alias update requests that need auth
emawby Sep 11, 2024
3542d34
Adding work in progress Subscription executor auth pends
emawby Sep 11, 2024
d90f0d2
[nit] run swiftlint
nan-li Sep 23, 2024
01c2069
cache the pending auth requests in executors
nan-li Sep 24, 2024
d579f06
Add pending to fetch user requests
nan-li Sep 24, 2024
19df3db
Don't fire JWT invalid listeners multiple times
nan-li Sep 24, 2024
cccb58c
Subscription executor wrap up, add some more tests
nan-li Sep 24, 2024
c27842c
[nits] Move public protocols out of User Manager file
nan-li Sep 24, 2024
74e4ef7
Update tests
nan-li Sep 25, 2024
0156328
Update the remote params JWT key
nan-li Oct 1, 2024
a2420ee
Re-use existing identity models for new users
nan-li Oct 1, 2024
5433ebb
Remove duplicate Create User requests
nan-li Oct 1, 2024
01fde6f
Don't send push sub for previous users to avoid transfer
nan-li Oct 1, 2024
8d0d088
Extract out User Manager Loggable extension for file length
nan-li Oct 2, 2024
b5ae642
Update JWT invalidated listener and event API
nan-li Oct 3, 2024
7d5db5e
Update tests after JWT listener API change
nan-li Oct 3, 2024
0dc2cee
Disable push sub when logout called (JWT on)
nan-li Oct 2, 2024
5ad412f
Fire user observer on logout (JWT on)
nan-li Oct 2, 2024
0d9c62d
[nit] move a method to extension for swiftlint
nan-li Oct 3, 2024
1f60b08
[nit] Clean up logging, remove hardcoded prints
nan-li Oct 4, 2024
0a81b7a
Revert back to production servers
nan-li Oct 4, 2024
1e7bce1
Merge pull request #1488 from OneSignal/identity_verification_logout
nan-li Oct 4, 2024
d4588f5
Merge pull request #1487 from OneSignal/identity_verification_multipl…
nan-li Oct 4, 2024
0bc08eb
Merge pull request #1478 from OneSignal/identity_verification_callback
nan-li Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
3CF11E402C6E6DE2002856F5 /* MockNewRecordsState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */; };
3CF1A5632C669EA40056B3AA /* OSNewRecordsState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF1A5622C669EA40056B3AA /* OSNewRecordsState.swift */; };
3CF807352C80E3A6003E5FE1 /* OSAliasPair.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF807342C80E3A6003E5FE1 /* OSAliasPair.swift */; };
3CF807372C80F3B5003E5FE1 /* OSUserUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF807362C80F3B5003E5FE1 /* OSUserUtils.swift */; };
3CF8629E28A183F900776CA4 /* OSIdentityModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF8629D28A183F900776CA4 /* OSIdentityModel.swift */; };
3CF862A028A1964F00776CA4 /* OSPropertiesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF8629F28A1964F00776CA4 /* OSPropertiesModel.swift */; };
3CF862A228A197D200776CA4 /* OSPropertiesModelStoreListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF862A128A197D200776CA4 /* OSPropertiesModelStoreListener.swift */; };
Expand Down Expand Up @@ -1306,6 +1307,7 @@
3CF11E3F2C6E6DE2002856F5 /* MockNewRecordsState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockNewRecordsState.swift; sourceTree = "<group>"; };
3CF1A5622C669EA40056B3AA /* OSNewRecordsState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSNewRecordsState.swift; sourceTree = "<group>"; };
3CF807342C80E3A6003E5FE1 /* OSAliasPair.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSAliasPair.swift; sourceTree = "<group>"; };
3CF807362C80F3B5003E5FE1 /* OSUserUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSUserUtils.swift; sourceTree = "<group>"; };
3CF8629D28A183F900776CA4 /* OSIdentityModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSIdentityModel.swift; sourceTree = "<group>"; };
3CF8629F28A1964F00776CA4 /* OSPropertiesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPropertiesModel.swift; sourceTree = "<group>"; };
3CF862A128A197D200776CA4 /* OSPropertiesModelStoreListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSPropertiesModelStoreListener.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2188,6 +2190,7 @@
isa = PBXGroup;
children = (
3CEE90A62BFE6ABD00B0FB5B /* OSPropertiesSupportedProperty.swift */,
3CF807362C80F3B5003E5FE1 /* OSUserUtils.swift */,
);
path = Support;
sourceTree = "<group>";
Expand Down Expand Up @@ -4295,6 +4298,7 @@
3C0EF49E28A1DBCB00E5434B /* OSUserInternalImpl.swift in Sources */,
3C8E6DFF28AB09AE0031E48A /* OSPropertyOperationExecutor.swift in Sources */,
3C9AD6CB2B228B5200BC1540 /* OSRequestIdentifyUser.swift in Sources */,
3CF807372C80F3B5003E5FE1 /* OSUserUtils.swift in Sources */,
3C9AD6BC2B2285FB00BC1540 /* OSUserExecutor.swift in Sources */,
3C9AD6C32B22887700BC1540 /* OSRequestCreateUser.swift in Sources */,
3C9AD6D12B228B9200BC1540 /* OSRequestRemoveAlias.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,10 @@ - (double)calculateReattemptDelay:(int)reattemptCount {
}

- (void)prettyPrintDebugStatementWithRequest:(OneSignalRequest *)request {
if (![NSJSONSerialization isValidJSONObject:request.parameters])
if (![NSJSONSerialization isValidJSONObject:request.parameters]) {
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:[NSString stringWithFormat:@"HTTP Request (%@) with URL: %@, with headers: %@", NSStringFromClass([request class]), request.urlRequest.URL.absoluteString, request.additionalHeaders]];
return;
}

NSError *error;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#import "OSInAppMessageInternal.h"
#import "OSInAppMessageViewController.h"
#import "OSTriggerController.h"
#import <OneSignalOSCore/OneSignalOSCore.h>
#import <OneSignalUser/OneSignalUser.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -39,7 +40,7 @@ NS_ASSUME_NONNULL_BEGIN

@end

@interface OSMessagingController : NSObject <OSInAppMessageViewControllerDelegate, OSTriggerControllerDelegate, OSMessagingControllerDelegate, OSPushSubscriptionObserver>
@interface OSMessagingController : NSObject <OSInAppMessageViewControllerDelegate, OSTriggerControllerDelegate, OSMessagingControllerDelegate, OSPushSubscriptionObserver, OSUserStateObserver, OSUserJwtConfigListener>

@property (class, readonly) BOOL isInAppMessagingPaused;

Expand All @@ -52,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)removeInstance;
- (void)presentInAppMessage:(OSInAppMessageInternal *)message;
- (void)updateInAppMessagesFromCache;
- (void)getInAppMessagesFromServer:(NSString * _Nullable)subscriptionId;
- (void)getInAppMessagesFromServer;
- (void)messageViewImpressionRequest:(OSInAppMessageInternal *)message;
- (void)messageViewPageImpressionRequest:(OSInAppMessageInternal *)message withPageId:(NSString *)pageId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ @implementation OSMessagingController
@dynamic isInAppMessagingPaused;
// Maximum time decided to save IAM with redisplay on cache - current value: six months in seconds
static long OS_IAM_MAX_CACHE_TIME = 6 * 30 * 24 * 60 * 60;

/**
If an attempt to get IAMs from the server returns an Unauthorized response,
the controller should re-attempt once the JWT token is updated.
*/
static BOOL shouldRetryGetInAppMessagesOnJwtUpdated = false;

/**
If an attempt to get IAMs from the server is blocked by incomplete alias information,
the controller should re-attempt once the user state changes.
An example of when this can happen occurs when users are switching with Identity Verification turned off -
the SDK has a push subscription ID but no onesignal ID for the current user.
*/
static BOOL shouldRetryGetInAppMessagesOnUserChange = false;

static OSMessagingController *sharedInstance = nil;
static dispatch_once_t once;
+ (OSMessagingController *)sharedInstance {
Expand All @@ -167,6 +182,8 @@ + (void)removeInstance {
+ (void)start {
OSMessagingController *shared = OSMessagingController.sharedInstance;
[OneSignalUserManagerImpl.sharedInstance.pushSubscriptionImpl addObserver:shared];
[OneSignalUserManagerImpl.sharedInstance addObserver:shared];
[OneSignalUserManagerImpl.sharedInstance subscribeToJwtConfig:shared key:OS_MESSAGING_CONTROLLER];
}

static BOOL _isInAppMessagingPaused = false;
Expand Down Expand Up @@ -236,15 +253,48 @@ - (void)updateInAppMessagesFromCache {
[self evaluateMessages];
}

- (void)getInAppMessagesFromServer:(NSString *)subscriptionId {
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer"];

/**
To get IAMs from the server, the following requirements are necessary:
- A subscription ID
- An appropriate alias (depending on Identity Verification enabled) for the subscription
- A valid JWT token for the user if Identity Verification is enabled

This current implementation is not completely correct, as it will always use the current subscription ID and the current user.
The SDK would need to consider if the current user owns the subscription on the server.
*/
- (void)getInAppMessagesFromServer {
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer attempted"];

NSString *subscriptionId = OneSignalUserManagerImpl.sharedInstance.pushSubscriptionId;
if (!subscriptionId) {
// When the subscription observer fires, it will drive a re-fetch
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer blocked by null subscriptionId"];
[self updateInAppMessagesFromCache];
return;
}

OSAliasPair *alias = [OneSignalUserManagerImpl.sharedInstance getAliasForCurrentUser];
if (!alias) {
// When the user observer fires, it will drive a re-fetch
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer blocked by null alias"];
shouldRetryGetInAppMessagesOnUserChange = true;
[self updateInAppMessagesFromCache];
return;
}

NSDictionary<NSString *, NSString*> *header = [OneSignalUserManagerImpl.sharedInstance getCurrentUserFullHeader];
if (!header) {
// When the JWT updated listener fires, it will drive a re-fetch
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer blocked by missing header"];
shouldRetryGetInAppMessagesOnJwtUpdated = true;
[self updateInAppMessagesFromCache];
return;
}

OSRequestGetInAppMessages *request = [OSRequestGetInAppMessages withSubscriptionId:subscriptionId];
OSRequestGetInAppMessages *request = [OSRequestGetInAppMessages withSubscriptionId:subscriptionId
withAliasLabel:alias.label
withAliasId:alias.id
withHeader:header];
[OneSignalCoreImpl.sharedClient executeRequest:request onSuccess:^(NSDictionary *result) {
dispatch_async(dispatch_get_main_queue(), ^{
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"getInAppMessagesFromServer success"];
Expand All @@ -270,6 +320,10 @@ - (void)getInAppMessagesFromServer:(NSString *)subscriptionId {
});
} onFailure:^(NSError *error) {
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:[NSString stringWithFormat:@"getInAppMessagesFromServer failure: %@", error.localizedDescription]];
OSResponseStatusType responseType = [OSNetworkingUtils getResponseStatusType:error.code];
if (responseType == OSResponseStatusUnauthorized) {
shouldRetryGetInAppMessagesOnJwtUpdated = true;
}
[self updateInAppMessagesFromCache];
}];
}
Expand Down Expand Up @@ -1087,7 +1141,29 @@ - (void)onPushSubscriptionDidChangeWithState:(OSPushSubscriptionChangedState * _

// Pull new IAMs when the subscription id changes to a new valid subscription id
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"OSMessagingController onPushSubscriptionDidChange: changed to new valid subscription id"];
[self getInAppMessagesFromServer:state.current.id];
[self getInAppMessagesFromServer];
}

#pragma mark OSUserStateObserver Methods
- (void)onUserStateDidChangeWithState:(OSUserChangedState * _Nonnull)state {
NSLog(@"❌ OSMessagingController onUserStateDidChangeWithState: %@", [state jsonRepresentation]);
if (state.current.onesignalId && shouldRetryGetInAppMessagesOnUserChange) {
shouldRetryGetInAppMessagesOnUserChange = false;
[self getInAppMessagesFromServer];
}
}

#pragma mark OSUserJwtConfigListener Methods
- (void)onRequiresUserAuthChangedFrom:(enum OSRequiresUserAuth)from to:(enum OSRequiresUserAuth)to {
// This callback is unused, the controller will fetch when subscription ID changes
}

- (void)onJwtUpdatedWithExternalId:(NSString *)externalId token:(NSString *)token {
NSLog(@"❌ OSMessagingController onJwtUpdatedWithExternalId: %@ token: %@", externalId, token);
if (![token isEqual: OS_JWT_TOKEN_INVALID] && shouldRetryGetInAppMessagesOnJwtUpdated) {
shouldRetryGetInAppMessagesOnJwtUpdated = false;
[self getInAppMessagesFromServer];
}
}

- (void)dealloc {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#ifndef OSInAppMessagingDefines_h
#define OSInAppMessagingDefines_h

// OSMessagingController name
#define OS_MESSAGING_CONTROLLER @"OSMessagingController"

// IAM display position enums
typedef NS_ENUM(NSUInteger, OSInAppMessageDisplayPosition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

+ (Class<OSInAppMessages>_Nonnull)InAppMessages;
+ (void)start;
+ (void)getInAppMessagesFromServer:(NSString * _Nullable)subscriptionId;
+ (void)getInAppMessagesFromServer;
+ (void)onApplicationDidBecomeActive;
+ (void)migrate;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ + (void)start {
[OSMessagingController start];
}

+ (void)getInAppMessagesFromServer:(NSString * _Nullable)subscriptionId {
[OSMessagingController.sharedInstance getInAppMessagesFromServer:subscriptionId];
+ (void)getInAppMessagesFromServer {
[OSMessagingController.sharedInstance getInAppMessagesFromServer];
}

+ (void)onApplicationDidBecomeActive {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#import "OSInAppMessageClickResult.h"

@interface OSRequestGetInAppMessages : OneSignalRequest
+ (instancetype _Nonnull)withSubscriptionId:(NSString * _Nonnull)subscriptionId;
+ (instancetype _Nonnull)withSubscriptionId:(NSString * _Nonnull)subscriptionId withAliasLabel:(NSString * _Nonnull)aliasLabel withAliasId:(NSString * _Nonnull)aliasId withHeader:(NSDictionary<NSString *, NSString *> * _Nonnull)header;
@end

@interface OSRequestInAppMessageViewed : OneSignalRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ of this software and associated documentation files (the "Software"), to deal
#import "OSInAppMessagingRequests.h"

@implementation OSRequestGetInAppMessages
+ (instancetype _Nonnull)withSubscriptionId:(NSString * _Nonnull)subscriptionId {
+ (instancetype _Nonnull)withSubscriptionId:(NSString * _Nonnull)subscriptionId
withAliasLabel:(NSString * _Nonnull)aliasLabel
withAliasId:(NSString * _Nonnull)aliasId
withHeader:(NSDictionary<NSString *, NSString *> * _Nonnull)header {
let request = [OSRequestGetInAppMessages new];
request.method = GET;
NSString *appId = [OneSignalConfigManager getAppId];
request.path = [NSString stringWithFormat:@"apps/%@/subscriptions/%@/iams", appId, subscriptionId];
request.additionalHeaders = header;
request.path = [NSString stringWithFormat:@"apps/%@/users/by/%@/%@/subscriptions/%@/iams", appId, aliasLabel, aliasId, subscriptionId];
return request;
}
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
An alias label and alias ID pair to represent a user.
*/
@objc public class OSAliasPair: NSObject {
public let label: String
public let id: String
@objc public let label: String
@objc public let id: String

public init(_ label: String, _ id: String) {
self.label = label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
import Foundation
import OneSignalCore

/**
Use an enum to avoid working with optional Bool, which is unsightly to cache and uncache.
*/
enum OSRequiresUserAuth: String {
case on
case off
case unknown
@objc
public enum OSRequiresUserAuth: Int {
case on = 1
case off = -1
case unknown = 0
// TODO: JWT 🔐 consider additional reasons such as detecting this by dev calling loginWithJWT / onViaRemoteParams

func isRequired() -> Bool? {
Expand All @@ -52,9 +50,9 @@ enum OSRequiresUserAuth: String {
/**
Internal listener.
*/
public protocol OSUserJwtConfigListener {
func onRequiresUserAuthChanged(from: Bool?, to: Bool?)
func onJwtUpdated(externalId: String, to: String?)
@objc public protocol OSUserJwtConfigListener {
func onRequiresUserAuthChanged(from: OSRequiresUserAuth, to: OSRequiresUserAuth)
func onJwtUpdated(externalId: String, token: String?)
}

public class OSUserJwtConfig {
Expand All @@ -69,10 +67,10 @@ public class OSUserJwtConfig {
print("❌ OSUserJwtConfig.requiresUserAuth: changing from \(oldValue) to \(requiresUserAuth), firing \(changeNotifier)")

// Persist new value
OneSignalUserDefaults.initShared().saveString(forKey: OSUD_USE_IDENTITY_VERIFICATION, withValue: requiresUserAuth.rawValue)
OneSignalUserDefaults.initShared().saveInteger(forKey: OSUD_USE_IDENTITY_VERIFICATION, withValue: requiresUserAuth.rawValue)

self.changeNotifier.fire { listener in
listener.onRequiresUserAuthChanged(from: oldValue.isRequired(), to: requiresUserAuth.isRequired())
listener.onRequiresUserAuthChanged(from: oldValue, to: requiresUserAuth)
}
}
}
Expand All @@ -94,21 +92,21 @@ public class OSUserJwtConfig {
}

public init() {
let rawValue = OneSignalUserDefaults.initShared().getSavedString(forKey: OSUD_USE_IDENTITY_VERIFICATION, defaultValue: OSRequiresUserAuth.unknown.rawValue)
let rawValue = OneSignalUserDefaults.initShared().getSavedInteger(forKey: OSUD_USE_IDENTITY_VERIFICATION, defaultValue: OSRequiresUserAuth.unknown.rawValue)

print("❌ OSUserJwtConfig init(): \(OSRequiresUserAuth(rawValue: rawValue!)))")
print("❌ OSUserJwtConfig init(): \(String(describing: OSRequiresUserAuth(rawValue: rawValue))))")

requiresUserAuth = OSRequiresUserAuth(rawValue: rawValue ?? OSRequiresUserAuth.unknown.rawValue) ?? OSRequiresUserAuth.unknown
requiresUserAuth = OSRequiresUserAuth(rawValue: rawValue) ?? OSRequiresUserAuth.unknown
}

public func subscribe(_ listener: OSUserJwtConfigListener, key: String) {
self.changeNotifier.subscribe(listener, key: key)
}

public func onJwtTokenChanged(externalId: String, to: String?) {
print("❌ OSUserJwtConfig.onJwtTokenChanged \(externalId): \(to)")
public func onJwtTokenChanged(externalId: String, token: String?) {
print("❌ OSUserJwtConfig.onJwtTokenChanged \(externalId): \(token)")
changeNotifier.fire { listener in
listener.onJwtUpdated(externalId: externalId, to: to)
listener.onJwtUpdated(externalId: externalId, token: token)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,17 +184,17 @@ public class OSOperationRepo {
}

extension OSOperationRepo: OSUserJwtConfigListener {
public func onRequiresUserAuthChanged(from: Bool?, to: Bool?) {
public func onRequiresUserAuthChanged(from: OSRequiresUserAuth, to: OSRequiresUserAuth) {
print("❌ OSOperationRepo onRequiresUserAuthChanged from \(String(describing: from)) to \(String(describing: to))")
// If auth changed from false or unknown to true, process deltas
if to == true {
if to == .on {
removeInvalidDeltas()
}
start()
}

public func onJwtUpdated(externalId: String, to: String?) {
print("❌ OSOperationRepo onJwtUpdated for \(externalId) to \(String(describing: to))")
public func onJwtUpdated(externalId: String, token: String?) {
print("❌ OSOperationRepo onJwtUpdated for \(externalId) to \(String(describing: token))")
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ class OSIdentityOperationExecutor: OSOperationExecutor {
}
}
} onFailure: { error in
OneSignalLog.onesignalLog(.LL_ERROR, message: "OSIdentityOperationExecutor add aliases request failed with error: \(error.debugDescription)")
self.dispatchQueue.async {
if let nsError = error as? NSError {
let responseType = OSNetworkingUtils.getResponseStatusType(nsError.code)
Expand Down Expand Up @@ -334,16 +333,16 @@ class OSIdentityOperationExecutor: OSOperationExecutor {
}

extension OSIdentityOperationExecutor: OSUserJwtConfigListener {
func onRequiresUserAuthChanged(from: Bool?, to: Bool?) {
func onRequiresUserAuthChanged(from: OSRequiresUserAuth, to: OSRequiresUserAuth) {
print("❌ OSIdentityOperationExecutor onUserAuthChanged from \(String(describing: from)) to \(String(describing: to))")
// If auth changed from false or unknown to true, process requests
if to == true {
if to == .on {
removeInvalidDeltasAndRequests()
}
}

func onJwtUpdated(externalId: String, to: String?) {
print("❌ OSIdentityOperationExecutor onJwtUpdated for \(externalId) to \(String(describing: to))")
func onJwtUpdated(externalId: String, token: String?) {
print("❌ OSIdentityOperationExecutor onJwtUpdated for \(externalId) to \(String(describing: token))")
}

private func removeInvalidDeltasAndRequests() {
Expand Down
Loading