Skip to content

Commit e2ec897

Browse files
committed
Rename notificationIds to Ids for generic influence and UserDefault new keys
1 parent 977e300 commit e2ec897

File tree

8 files changed

+31
-31
lines changed

8 files changed

+31
-31
lines changed

iOS_SDK/OneSignalSDK/Source/OSChannelTracker.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ - (OSInfluence *)currentSessionInfluence {
163163

164164
- (NSString *)description {
165165
return [NSString stringWithFormat:
166-
@"OSChannelTracker tag: %@ influenceType: %@ indirectIds: %@ directIs: %@", [self idTag], OS_INFLUENCE_TYPE_TO_STRING(_influenceType), _indirectIds, _directId];
166+
@"OSChannelTracker tag: %@ influenceType: %@ indirectIds: %@ directIds: %@", [self idTag], OS_INFLUENCE_TYPE_TO_STRING(_influenceType), _indirectIds, _directId];
167167
}
168168

169169
@end

iOS_SDK/OneSignalSDK/Source/OSOutcomeEvent.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ - (id _Nonnull)initWithSession:(Session)influenceType
3838
weight:(NSNumber * _Nonnull)value {
3939

4040
if (self = [super init]) {
41-
_influenceType = influenceType;
41+
_session = influenceType;
4242
_notificationIds = notificationIds;
4343
_name = name;
4444
_timestamp = timestamp;
@@ -63,7 +63,7 @@ - (id)initFromOutcomeEventParams:(OSOutcomeEventParams *)outcomeEventParams {
6363
}
6464
}
6565

66-
_influenceType = influenceType;
66+
_session = influenceType;
6767
_notificationIds = notificationId;
6868
_name = outcomeEventParams.outcomeId;
6969
_timestamp = outcomeEventParams.timestamp;
@@ -75,7 +75,7 @@ - (id)initFromOutcomeEventParams:(OSOutcomeEventParams *)outcomeEventParams {
7575
- (NSDictionary * _Nonnull)jsonRepresentation {
7676
let json = [NSMutableDictionary new];
7777

78-
json[@"session"] = OS_INFLUENCE_TYPE_TO_STRING(self.influenceType);
78+
json[@"session"] = OS_INFLUENCE_TYPE_TO_STRING(self.session);
7979
json[@"id"] = self.name;
8080
json[@"timestamp"] = @(self.timestamp.intValue);
8181
json[@"weight"] = self.weight.stringValue;

iOS_SDK/OneSignalSDK/Source/OSOutcomeEventsFactory.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ - (OSOutcomeEventsRepository *)repository {
5757
}
5858

5959
- (void)checkVersionChanged {
60-
if (![_cache isOutcomesV2ServiceEnabled] && [_repository class] == [OSOutcomeEventsV1Repository class])
60+
if (![_cache isOutcomesV2ServiceEnabled] && [_repository isKindOfClass:[OSOutcomeEventsV1Repository class]])
6161
return;
62-
if ([_cache isOutcomesV2ServiceEnabled] && [_repository class] == [OSOutcomeEventsV2Repository class])
62+
if ([_cache isOutcomesV2ServiceEnabled] && [_repository isKindOfClass:[OSOutcomeEventsV2Repository class]])
6363
return;
6464

6565
[self createRepository];

iOS_SDK/OneSignalSDK/Source/OSOutcomeEventsRepository.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ - (void)saveUniqueOutcomeEventParams:(OSOutcomeEventParams *)eventParams {
144144
NSArray<OSCachedUniqueOutcome *> *attributedUniqueOutcomeEventSent = [self getAttributedUniqueOutcomeEventSent];
145145

146146
NSArray *finalAttributedUniqueOutcomeEventSent = [attributedUniqueOutcomeEventSent arrayByAddingObjectsFromArray:newAttributedIds];
147-
[OneSignal onesignal_Log:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"OSOutcomeEventsRepository finalAttributedUniqueOutcomeEventSent: %@", finalAttributedUniqueOutcomeEventSent.description]];
147+
148148
[self saveAttributedUniqueOutcomeEventNotificationIds:finalAttributedUniqueOutcomeEventSent];
149149
}
150150

iOS_SDK/OneSignalSDK/Source/OSOutcomeEventsV1Repository.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ - (void)requestMeasureOutcomeEventWithAppId:(NSString *)appId
4040
onFailure:(OSFailureBlock)failureBlock {
4141
OSOutcomeEvent *outcome = [[OSOutcomeEvent alloc] initFromOutcomeEventParams:event];
4242
OneSignalRequest *request;
43-
switch (outcome.influenceType) {
43+
switch (outcome.session) {
4444
case DIRECT:
4545
[OneSignal onesignal_Log:ONE_S_LL_DEBUG message:@"Sending direct outcome"];
4646
request = [OSRequestSendOutcomesV1ToServer directWithOutcome:outcome

iOS_SDK/OneSignalSDK/Source/OSSessionManager.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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: %@ \nfrom: \ninfluenceType: %@ \n, directNotificationId: %@ \n, indirectNotificationIds: %@ \nto: \ninfluenceType: %@ \n, directNotificationId: %@ \n, indirectNotificationIds: %@";
203+
NSString *message = @"OSChannelTracker changed: %@ \nfrom: \ninfluenceType: %@ \n, directId: %@ \n, indirectIds: %@ \nto: \ninfluenceType: %@ \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

iOS_SDK/OneSignalSDK/Source/OneSignal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ typedef NS_ENUM(NSUInteger, OSInfluenceChannel) {
226226
@interface OSOutcomeEvent : NSObject
227227

228228
// Session enum (DIRECT, INDIRECT, UNATTRIBUTED, or DISABLED) to determine code route and request params
229-
@property (nonatomic) Session influenceType;
229+
@property (nonatomic) Session session;
230230

231231
// Notification ids for the current session
232232
@property (strong, nonatomic, nullable) NSArray *notificationIds;

iOS_SDK/OneSignalSDK/Source/OneSignalCommonDefines.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,20 @@
8080
// Receive Receipts
8181
#define OSUD_RECEIVE_RECEIPTS_ENABLED @"OS_ENABLE_RECEIVE_RECEIPTS" // * OSUD_RECEIVE_RECEIPTS_ENABLED
8282
// Outcomes
83-
#define OSUD_OUTCOMES_V2 @"OUTCOMES_V2" // * OSUD_OUTCOMES_V2
83+
#define OSUD_OUTCOMES_V2 @"OSUD_OUTCOMES_V2"
8484
#define OSUD_NOTIFICATION_LIMIT @"NOTIFICATION_LIMIT" // * OSUD_NOTIFICATION_LIMIT
85-
#define OSUD_IAM_LIMIT @"IAM_LIMIT" // * OSUD_IAM_LIMIT
85+
#define OSUD_IAM_LIMIT @"OSUD_IAM_LIMIT"
8686
#define OSUD_NOTIFICATION_ATTRIBUTION_WINDOW @"NOTIFICATION_ATTRIBUTION_WINDOW" // * OSUD_NOTIFICATION_ATTRIBUTION_WINDOW
87-
#define OSUD_IAM_ATTRIBUTION_WINDOW @"IAM_ATTRIBUTION_WINDOW" // * OSUD_IAM_ATTRIBUTION_WINDOW
87+
#define OSUD_IAM_ATTRIBUTION_WINDOW @"OSUD_IAM_ATTRIBUTION_WINDOW"
8888
#define OSUD_DIRECT_SESSION_ENABLED @"DIRECT_SESSION_ENABLED" // * OSUD_DIRECT_SESSION_ENABLED
8989
#define OSUD_INDIRECT_SESSION_ENABLED @"INDIRECT_SESSION_ENABLED" // * OSUD_INDIRECT_SESSION_ENABLED
9090
#define OSUD_UNATTRIBUTED_SESSION_ENABLED @"UNATTRIBUTED_SESSION_ENABLED" // * OSUD_UNATTRIBUTED_SESSION_ENABLED
9191
#define OSUD_CACHED_NOTIFICATION_INFLUENCE @"CACHED_SESSION" // * OSUD_CACHED_NOTIFICATION_INFLUENCE
92-
#define OSUD_CACHED_IAM_INFLUENCE @"CACHED_IAM_INFLUENCE" // * OSUD_CACHED_IAM_INFLUENCE
92+
#define OSUD_CACHED_IAM_INFLUENCE @"OSUD_CACHED_IAM_INFLUENCE"
9393
#define OSUD_CACHED_DIRECT_NOTIFICATION_ID @"CACHED_DIRECT_NOTIFICATION_ID" // * OSUD_CACHED_DIRECT_NOTIFICATION_ID
9494
#define OSUD_CACHED_INDIRECT_NOTIFICATION_IDS @"CACHED_INDIRECT_NOTIFICATION_IDS" // * OSUD_CACHED_INDIRECT_NOTIFICATION_IDS
9595
#define OSUD_CACHED_RECEIVED_NOTIFICATION_IDS @"CACHED_RECEIVED_NOTIFICATION_IDS" // * OSUD_CACHED_RECEIVED_NOTIFICATION_IDS
96-
#define OSUD_CACHED_RECEIVED_IAM_IDS @"CACHED_RECEIVED_IAM_IDS" // * OSUD_CACHED_RECEIVED_IAM_IDS
96+
#define OSUD_CACHED_RECEIVED_IAM_IDS @"OSUD_CACHED_RECEIVED_IAM_IDS"
9797
#define OSUD_CACHED_UNATTRIBUTED_UNIQUE_OUTCOME_EVENTS_SENT @"CACHED_UNATTRIBUTED_UNIQUE_OUTCOME_EVENTS_SENT" // * OSUD_CACHED_UNATTRIBUTED_UNIQUE_OUTCOME_EVENTS_SENT
9898
#define OSUD_CACHED_ATTRIBUTED_UNIQUE_OUTCOME_EVENT_NOTIFICATION_IDS_SENT @"CACHED_ATTRIBUTED_UNIQUE_OUTCOME_EVENT_NOTIFICATION_IDS_SENT" // * OSUD_CACHED_ATTRIBUTED_UNIQUE_OUTCOME_EVENT_NOTIFICATION_IDS_SENT
9999
// Time Tracking

0 commit comments

Comments
 (0)