@@ -77,9 +77,9 @@ - (void)restartSessionIfNeeded:(AppEntryAction)entryAction {
7777 OSInfluence *influence = [channelTracker currentSessionInfluence ];
7878 BOOL updated;
7979 if (lastIds.count > 0 )
80- updated = [self setSessionForChannel: channelTracker withInfluenceType: INDIRECT directNotificationId :nil indirectNotificationIds : lastIds];
80+ updated = [self setSessionForChannel: channelTracker withInfluenceType: INDIRECT directId :nil indirectIds : lastIds];
8181 else
82- updated = [self setSessionForChannel: channelTracker withInfluenceType: UNATTRIBUTED directNotificationId :nil indirectNotificationIds :nil ];
82+ updated = [self setSessionForChannel: channelTracker withInfluenceType: UNATTRIBUTED directId :nil indirectIds :nil ];
8383
8484 if (updated)
8585 [updatedInfluences addObject: influence];
@@ -100,7 +100,7 @@ - (void)onDirectInfluenceFromIAMClick:(NSString *)directIAMId {
100100
101101 OSChannelTracker *inAppMessageTracker = [_trackerFactory iamChannelTracker ];
102102 // We don't care about ending the session duration because IAM doesn't influence a session
103- [self setSessionForChannel: inAppMessageTracker withInfluenceType: DIRECT directNotificationId : directIAMId indirectNotificationIds :nil ];
103+ [self setSessionForChannel: inAppMessageTracker withInfluenceType: DIRECT directId : directIAMId indirectIds :nil ];
104104}
105105
106106- (void )onDirectInfluenceFromIAMClickFinished {
@@ -113,7 +113,7 @@ - (void)onDirectInfluenceFromIAMClickFinished {
113113- (void )onNotificationReceived : (NSString *)notificationId {
114114 [OneSignal onesignal_Log: ONE_S_LL_DEBUG message: [NSString stringWithFormat: @" OneSignal SessionManager onNotificationReceived notificationId: %@ " , notificationId]];
115115
116- if (notificationId == nil || notificationId.length == 0 )
116+ if (! notificationId || notificationId.length == 0 )
117117 return ;
118118
119119 OSChannelTracker *notificationTracker = [_trackerFactory notificationChannelTracker ];
@@ -123,7 +123,7 @@ - (void)onNotificationReceived:(NSString *)notificationId {
123123- (void )onDirectInfluenceFromNotificationOpen : (AppEntryAction)entryAction withNotificationId : (NSString *)directNotificationId {
124124 [OneSignal onesignal_Log: ONE_S_LL_DEBUG message: [NSString stringWithFormat: @" OneSignal SessionManager onDirectInfluenceFromNotificationOpen notificationId: %@ " , directNotificationId]];
125125
126- if (directNotificationId == nil || directNotificationId.length == 0 )
126+ if (! directNotificationId || directNotificationId.length == 0 )
127127 return ;
128128
129129 [self attemptSessionUpgrade: entryAction withDirectId: directNotificationId];
@@ -153,7 +153,7 @@ - (void)attemptSessionUpgrade:(AppEntryAction)entryAction withDirectId:(NSString
153153 BOOL updated = NO ;
154154 if (channelTrackerByAction) {
155155 lastInfluence = [channelTrackerByAction currentSessionInfluence ];
156- updated = [self setSessionForChannel: channelTrackerByAction withInfluenceType: DIRECT directNotificationId : directId == nil ? channelTrackerByAction. directId : directId indirectNotificationIds :nil ];
156+ updated = [self setSessionForChannel: channelTrackerByAction withInfluenceType: DIRECT directId : directId ? directId : channelTrackerByAction. directId indirectIds :nil ];
157157 }
158158
159159 if (updated) {
@@ -181,7 +181,7 @@ - (void)attemptSessionUpgrade:(AppEntryAction)entryAction withDirectId:(NSString
181181 // Save influence to ended it later if needed
182182 // This influence will be unattributed
183183 OSInfluence *influence = [channelTracker currentSessionInfluence ];
184- updated = [self setSessionForChannel: channelTracker withInfluenceType: INDIRECT directNotificationId :nil indirectNotificationIds : lastIds];
184+ updated = [self setSessionForChannel: channelTracker withInfluenceType: INDIRECT directId :nil indirectIds : lastIds];
185185 // Changed from UNATTRIBUTED to INDIRECT
186186 if (updated)
187187 [influencesToEnd addObject: influence];
@@ -196,23 +196,23 @@ - (void)attemptSessionUpgrade:(AppEntryAction)entryAction withDirectId:(NSString
196196/*
197197 Called when the session for the app changes, caches the state, and broadcasts the session that just ended
198198 */
199- - (BOOL )setSessionForChannel : (OSChannelTracker *)channelTracker withInfluenceType : (Session)influenceType directNotificationId : (NSString *)directNotificationId indirectNotificationIds : (NSArray *)indirectNotificationIds {
200- if (![self willChangeSessionForChannel: channelTracker withInfluenceType: influenceType directNotificationId: directNotificationId indirectNotificationIds: indirectNotificationIds ])
199+ - (BOOL )setSessionForChannel : (OSChannelTracker *)channelTracker withInfluenceType : (Session)influenceType directId : (NSString *)directId indirectIds : (NSArray *)indirectIds {
200+ if (![self willChangeSessionForChannel: channelTracker withInfluenceType: influenceType directId: directId indirectIds: indirectIds ])
201201 return NO ;
202202
203- NSString *message = @" OSChannelTracker changed: %@ \n from: \n influenceType: %@ \n , directNotificationId : %@ \n , indirectNotificationIds : %@ \n to: \n influenceType: %@ \n , directNotificationId : %@ \n , indirectNotificationIds : %@ " ;
203+ NSString *message = @" OSChannelTracker changed: %@ \n from: \n influenceType: %@ \n , directId : %@ \n , indirectIds : %@ \n to: \n influenceType: %@ \n , directId : %@ \n , indirectIds : %@ " ;
204204 [OneSignal onesignal_Log: ONE_S_LL_DEBUG message: [NSString stringWithFormat: message,
205205 [channelTracker idTag ],
206206 OS_INFLUENCE_TYPE_TO_STRING (channelTracker.influenceType),
207207 channelTracker.directId,
208208 channelTracker.indirectIds,
209209 OS_INFLUENCE_TYPE_TO_STRING (influenceType),
210- directNotificationId ,
211- indirectNotificationIds ]];
210+ directId ,
211+ indirectIds ]];
212212
213213 channelTracker.influenceType = influenceType;
214- channelTracker.directId = directNotificationId ;
215- channelTracker.indirectIds = indirectNotificationIds ;
214+ channelTracker.directId = directId ;
215+ channelTracker.indirectIds = indirectIds ;
216216 [channelTracker cacheState ];
217217
218218 [OneSignal onesignal_Log: ONE_S_LL_DEBUG message: [NSString stringWithFormat: @" Trackers changed to: %@ " , [_trackerFactory channels ].description]];
@@ -226,22 +226,22 @@ - (BOOL)setSessionForChannel:(OSChannelTracker *)channelTracker withInfluenceTyp
226226 2. Is DIRECT session data different from incoming DIRECT session data?
227227 3. Is INDIRECT session data different from incoming INDIRECT session data?
228228 */
229- - (BOOL )willChangeSessionForChannel : (OSChannelTracker *)channelTracker withInfluenceType : (Session)influenceType directNotificationId : (NSString *)directNotificationId indirectNotificationIds : (NSArray *)indirectNotificationIds {
229+ - (BOOL )willChangeSessionForChannel : (OSChannelTracker *)channelTracker withInfluenceType : (Session)influenceType directId : (NSString *)directId indirectIds : (NSArray *)indirectIds {
230230 if (channelTracker.influenceType != influenceType)
231231 return true ;
232232
233233 // Allow updating a direct session to a new direct when a new notification is clicked
234234 if (channelTracker.influenceType == DIRECT &&
235235 channelTracker.directId &&
236- ![channelTracker.directId isEqualToString: directNotificationId ]) {
236+ ![channelTracker.directId isEqualToString: directId ]) {
237237 return true ;
238238 }
239239
240240 // Allow updating an indirect session to a new indirect when a new notification is received
241241 if (channelTracker.influenceType == INDIRECT &&
242242 channelTracker.indirectIds &&
243243 channelTracker.indirectIds .count > 0 &&
244- ![channelTracker.indirectIds isEqualToArray: indirectNotificationIds ]) {
244+ ![channelTracker.indirectIds isEqualToArray: indirectIds ]) {
245245 return true ;
246246 }
247247
0 commit comments