Skip to content

Commit 265277f

Browse files
authored
Merge pull request #1288 from OneSignal/5.0.0/fix_session_influence
[5.0.0] Fix direct session influence
2 parents fa82ce5 + 4c1dd90 commit 265277f

File tree

12 files changed

+68
-64
lines changed

12 files changed

+68
-64
lines changed

iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
3C2D8A5928B4C4E300BE41F6 /* OSDelta.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C2D8A5828B4C4E300BE41F6 /* OSDelta.swift */; };
7171
3C44673E296D099D0039A49E /* OneSignalMobileProvision.m in Sources */ = {isa = PBXBuildFile; fileRef = 912411FD1E73342200E41FD7 /* OneSignalMobileProvision.m */; };
7272
3C44673F296D09CC0039A49E /* OneSignalMobileProvision.h in Headers */ = {isa = PBXBuildFile; fileRef = 912411FC1E73342200E41FD7 /* OneSignalMobileProvision.h */; settings = {ATTRIBUTES = (Public, ); }; };
73-
3C448B9D2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C448B9B2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.h */; };
74-
3C448B9E2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C448B9C2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m */; };
75-
3C448B9F2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C448B9C2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m */; };
76-
3C448BA02936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C448B9C2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m */; };
73+
3C448B9D2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C448B9B2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.h */; };
74+
3C448B9E2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C448B9C2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m */; };
75+
3C448B9F2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C448B9C2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m */; };
76+
3C448BA02936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C448B9C2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m */; };
7777
3C448BA22936B474002F96BC /* OSBackgroundTaskManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C448BA12936B474002F96BC /* OSBackgroundTaskManager.swift */; };
7878
3C47A974292642B100312125 /* OneSignalConfigManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C47A972292642B100312125 /* OneSignalConfigManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
7979
3C47A975292642B100312125 /* OneSignalConfigManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C47A973292642B100312125 /* OneSignalConfigManager.m */; };
@@ -732,8 +732,8 @@
732732
3C2C7DC5288E00AA0020F9AE /* UserModelObjcTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserModelObjcTests.m; sourceTree = "<group>"; };
733733
3C2C7DC7288F3C020020F9AE /* OSSubscriptionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSSubscriptionModel.swift; sourceTree = "<group>"; };
734734
3C2D8A5828B4C4E300BE41F6 /* OSDelta.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSDelta.swift; sourceTree = "<group>"; };
735-
3C448B9B2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSBackgroundTaskManagerImpl.h; sourceTree = "<group>"; };
736-
3C448B9C2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OSBackgroundTaskManagerImpl.m; sourceTree = "<group>"; };
735+
3C448B9B2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSBackgroundTaskHandlerImpl.h; sourceTree = "<group>"; };
736+
3C448B9C2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OSBackgroundTaskHandlerImpl.m; sourceTree = "<group>"; };
737737
3C448BA12936B474002F96BC /* OSBackgroundTaskManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSBackgroundTaskManager.swift; sourceTree = "<group>"; };
738738
3C47A972292642B100312125 /* OneSignalConfigManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalConfigManager.h; sourceTree = "<group>"; };
739739
3C47A973292642B100312125 /* OneSignalConfigManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalConfigManager.m; sourceTree = "<group>"; };
@@ -1539,8 +1539,8 @@
15391539
912412051E73342200E41FD7 /* OneSignalTrackIAP.m */,
15401540
7A93269225AF4E6700BBEC27 /* OSPendingCallbacks.h */,
15411541
7A93269B25AF4F0200BBEC27 /* OSPendingCallbacks.m */,
1542-
3C448B9B2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.h */,
1543-
3C448B9C2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m */,
1542+
3C448B9B2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.h */,
1543+
3C448B9C2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m */,
15441544
DEC08AFF2947D4E900C81DA3 /* OneSignalSwiftInterface.swift */,
15451545
);
15461546
path = Source;
@@ -2105,7 +2105,7 @@
21052105
7AECE59C23675F5700537907 /* OSFocusTimeProcessorFactory.h in Headers */,
21062106
7AECE59A23674ADC00537907 /* OSUnattributedFocusTimeProcessor.h in Headers */,
21072107
9124121D1E73342200E41FD7 /* OneSignalJailbreakDetection.h in Headers */,
2108-
3C448B9D2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.h in Headers */,
2108+
3C448B9D2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.h in Headers */,
21092109
912412151E73342200E41FD7 /* OneSignalHelper.h in Headers */,
21102110
91C7725E1E7CCE1000D612D0 /* OneSignalInternal.h in Headers */,
21112111
);
@@ -2768,7 +2768,7 @@
27682768
7A93269C25AF4F0200BBEC27 /* OSPendingCallbacks.m in Sources */,
27692769
DE20425E24E21C2C00350E4F /* UIApplication+OneSignal.m in Sources */,
27702770
7AECE59623674AB700537907 /* OSUnattributedFocusTimeProcessor.m in Sources */,
2771-
3C448B9E2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m in Sources */,
2771+
3C448B9E2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m in Sources */,
27722772
7AECE59023674A9700537907 /* OSAttributedFocusTimeProcessor.m in Sources */,
27732773
912412361E73342200E41FD7 /* OneSignalTrackIAP.m in Sources */,
27742774
CA1A6E6A20DC2E31001C41B9 /* OneSignalDialogController.m in Sources */,
@@ -2815,7 +2815,7 @@
28152815
7AFE856C2368DDB80091D6A5 /* OSFocusCallParams.m in Sources */,
28162816
7A93269D25AF4F0200BBEC27 /* OSPendingCallbacks.m in Sources */,
28172817
DE20425F24E21C2C00350E4F /* UIApplication+OneSignal.m in Sources */,
2818-
3C448B9F2936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m in Sources */,
2818+
3C448B9F2936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m in Sources */,
28192819
912412371E73342200E41FD7 /* OneSignalTrackIAP.m in Sources */,
28202820
7AECE59123674A9700537907 /* OSAttributedFocusTimeProcessor.m in Sources */,
28212821
CA1A6E6B20DC2E31001C41B9 /* OneSignalDialogController.m in Sources */,
@@ -2847,7 +2847,7 @@
28472847
DE16C17024D3989A00670EFA /* OneSignalLifecycleObserver.m in Sources */,
28482848
CAAE0DFD2195216900A57402 /* OneSignalOverrider.m in Sources */,
28492849
CA8E190B2194FE0B009DA223 /* OSMessagingControllerOverrider.m in Sources */,
2850-
3C448BA02936ADFD002F96BC /* OSBackgroundTaskManagerImpl.m in Sources */,
2850+
3C448BA02936ADFD002F96BC /* OSBackgroundTaskHandlerImpl.m in Sources */,
28512851
7A123295235DFE3B002B6CE3 /* OutcomeTests.m in Sources */,
28522852
7A4274A425D1C99600EE75FC /* SMSTests.m in Sources */,
28532853
CAA4ED0120646762005BD59B /* BadgeTests.m in Sources */,

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ of this software and associated documentation files (the "Software"), to deal
3434
#import "OneSignalWebViewManager.h"
3535
#import "UNUserNotificationCenter+OneSignalNotifications.h"
3636
#import "UIApplicationDelegate+OneSignalNotifications.h"
37+
#import <OneSignalOutcomes/OSSessionManager.h>
3738

3839
@implementation OSNotificationClickEvent
3940
@synthesize notification = _notification, result = _result;
@@ -696,10 +697,10 @@ + (void)handleNotificationOpened:(NSDictionary*)messageDict
696697

697698
// Call Action Block
698699
[self lastMessageReceived:messageDict];
699-
// if (!isActive) { TODO: Figure out session stuff from notif opened
700-
// OneSignal.appEntryState = NOTIFICATION_CLICK;
701-
// [[OSSessionManager sharedSessionManager] onDirectInfluenceFromNotificationOpen:_appEntryState withNotificationId:messageId];
702-
// }
700+
if (!isActive) {
701+
OSSessionManager.sharedSessionManager.appEntryState = NOTIFICATION_CLICK;
702+
[[OSSessionManager sharedSessionManager] onDirectInfluenceFromNotificationOpen:NOTIFICATION_CLICK withNotificationId:messageId];
703+
}
703704

704705
[self handleNotificationActionWithUrl:notification.launchURL actionID:actionID];
705706
}

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSBackgroundTaskManager.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
*/
2727

2828
import Foundation
29+
import OneSignalCore
2930

3031
@objc
31-
public protocol OSBackgroundTaskManagerDelegate {
32+
public protocol OSBackgroundTaskHandler {
3233
func beginBackgroundTask(_ taskIdentifier: String)
3334
func endBackgroundTask(_ taskIdentifier: String)
3435
func setTaskInvalid(_ taskIdentifier: String)
@@ -39,30 +40,30 @@ public protocol OSBackgroundTaskManagerDelegate {
3940
// check if Core needs to use this, then ok to live here
4041
@objc
4142
public class OSBackgroundTaskManager: NSObject {
42-
@objc public static weak var delegate: OSBackgroundTaskManagerDelegate?
43+
@objc public static var taskHandler: OSBackgroundTaskHandler?
4344

4445
@objc
4546
public static func beginBackgroundTask(_ taskIdentifier: String) {
46-
guard let delegate = delegate else {
47-
// Log error, no delegate
47+
guard let delegate = taskHandler else {
48+
OneSignalLog.onesignalLog(.LL_ERROR, message: "OSBackgroundTaskManager:beginBackgroundTask \(taskIdentifier) cannot be executed due to no task handler.")
4849
return
4950
}
5051
delegate.beginBackgroundTask(taskIdentifier)
5152
}
5253

5354
@objc
5455
public static func endBackgroundTask(_ taskIdentifier: String) {
55-
guard let delegate = delegate else {
56-
// Log error, no delegate
56+
guard let delegate = taskHandler else {
57+
OneSignalLog.onesignalLog(.LL_ERROR, message: "OSBackgroundTaskManager:endBackgroundTask \(taskIdentifier) cannot be executed due to no task handler.")
5758
return
5859
}
5960
delegate.endBackgroundTask(taskIdentifier)
6061
}
6162

6263
@objc
6364
public static func setTaskInvalid(_ taskIdentifier: String) {
64-
guard let delegate = delegate else {
65-
// Log error, no delegate
65+
guard let delegate = taskHandler else {
66+
OneSignalLog.onesignalLog(.LL_ERROR, message: "OSBackgroundTaskManager:setTaskInvalid \(taskIdentifier) cannot be executed due to no task handler.")
6667
// But not necessarily an error because this task won't exist
6768
// Can be called in initialization of services before delegate is set
6869
return

iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OSOutcomesRequests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ + (instancetype _Nonnull)withActiveTime:(NSNumber * _Nonnull)activeTime
138138
let params = [NSMutableDictionary new];
139139
params[@"app_id"] = appId;
140140
params[@"id"] = @"os__session_duration";
141-
params[@"session_time"] = activeTime;
141+
params[@"session_time"] = @([activeTime intValue]);
142142
params[@"subscription"] = @{@"id": pushSubscriptionId, @"type": @"iOSPush"};
143143
params[@"onesignal_id"] = onesignalId;
144144

iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OSSessionManager.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,20 @@
4141
+ (void)resetSharedSessionManager;
4242

4343
@property (nonatomic) id<SessionStatusDelegate> _Nullable delegate;
44+
@property AppEntryAction appEntryState;
4445

4546
- (instancetype _Nonnull)init:(Class<SessionStatusDelegate> _Nullable)delegate withTrackerFactory:(OSTrackerFactory *_Nonnull)trackerFactory;
4647

4748
- (NSArray<OSInfluence *> *_Nonnull)getInfluences;
4849
- (NSArray<OSInfluence *> *_Nonnull)getSessionInfluences;
4950
- (void)initSessionFromCache;
50-
- (void)restartSessionIfNeeded:(AppEntryAction)entryAction;
51+
- (void)restartSessionIfNeeded;
5152
- (void)onInAppMessageReceived:(NSString * _Nonnull)messageId;
5253
- (void)onDirectInfluenceFromIAMClick:(NSString * _Nonnull)directIAMId;
5354
- (void)onDirectInfluenceFromIAMClickFinished;
5455
- (void)onNotificationReceived:(NSString * _Nonnull)notificationId;
5556
- (void)onDirectInfluenceFromNotificationOpen:(AppEntryAction)entryAction withNotificationId:(NSString * _Nonnull)directNotificationId;
56-
- (void)attemptSessionUpgrade:(AppEntryAction)entryAction;
57-
- (NSDate *)sessionLaunchTime;
57+
- (void)attemptSessionUpgrade;
58+
- (NSDate *_Nullable)sessionLaunchTime;
5859

5960
@end

iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OSSessionManager.m

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ @implementation OSSessionManager
4141
static OSSessionManager *_sessionManager;
4242

4343
NSDate *_sessionLaunchTime;
44+
AppEntryAction _appEntryState = APP_CLOSE;
4445

4546
+ (OSSessionManager*)sharedSessionManager {
4647
if (!_sessionManager)
@@ -52,6 +53,14 @@ + (void)resetSharedSessionManager {
5253
_sessionManager = nil;
5354
}
5455

56+
- (AppEntryAction)appEntryState {
57+
return _appEntryState;
58+
}
59+
60+
- (void)setAppEntryState:(AppEntryAction)appEntryState {
61+
_appEntryState = appEntryState;
62+
}
63+
5564
- (instancetype _Nonnull)init:(id<SessionStatusDelegate>)delegate withTrackerFactory:(OSTrackerFactory *)trackerFactory {
5665
if (self = [super init]) {
5766
_delegate = delegate;
@@ -75,11 +84,11 @@ - (void)initSessionFromCache {
7584
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"SessionManager restored from cache with influences: %@", [self getInfluences].description]];
7685
}
7786

78-
- (void)restartSessionIfNeeded:(AppEntryAction)entryAction {
79-
NSArray<OSChannelTracker *> *channelTrackers = [_trackerFactory channelsToResetByEntryAction:entryAction];
87+
- (void)restartSessionIfNeeded {
88+
NSArray<OSChannelTracker *> *channelTrackers = [_trackerFactory channelsToResetByEntryAction:_appEntryState];
8089
NSMutableArray<OSInfluence *> *updatedInfluences = [NSMutableArray new];
8190

82-
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"OneSignal SessionManager restartSessionIfNeeded with entryAction:: %u channelTrackers: %@", entryAction, channelTrackers.description]];
91+
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"OneSignal SessionManager restartSessionIfNeeded with entryAction:: %u channelTrackers: %@", _appEntryState, channelTrackers.description]];
8392

8493
for (OSChannelTracker *channelTracker in channelTrackers) {
8594
NSArray *lastIds = [channelTracker lastReceivedIds];
@@ -134,12 +143,13 @@ - (void)onNotificationReceived:(NSString *)notificationId {
134143
}
135144

136145
- (void)onDirectInfluenceFromNotificationOpen:(AppEntryAction)entryAction withNotificationId:(NSString *)directNotificationId {
146+
_appEntryState = entryAction;
137147
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"OneSignal SessionManager onDirectInfluenceFromNotificationOpen notificationId: %@", directNotificationId]];
138148

139149
if (!directNotificationId || directNotificationId.length == 0)
140150
return;
141151

142-
[self attemptSessionUpgrade:entryAction withDirectId:directNotificationId];
152+
[self attemptSessionUpgradeWithDirectId:directNotificationId];
143153
}
144154

145155
/*
@@ -150,15 +160,15 @@ - (void)onDirectInfluenceFromNotificationOpen:(AppEntryAction)entryAction withNo
150160
* INDIRECT -> DIRECT
151161
* DIRECT -> DIRECT
152162
*/
153-
- (void)attemptSessionUpgrade:(AppEntryAction)entryAction {
154-
[self attemptSessionUpgrade:entryAction withDirectId:nil];
163+
- (void)attemptSessionUpgrade {
164+
[self attemptSessionUpgradeWithDirectId:nil];
155165
}
156166

157-
- (void)attemptSessionUpgrade:(AppEntryAction)entryAction withDirectId:(NSString *)directId {
158-
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"OneSignal SessionManager attemptSessionUpgrade with entryAction: %u", entryAction]];
167+
- (void)attemptSessionUpgradeWithDirectId:(NSString *)directId {
168+
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"OneSignal SessionManager attemptSessionUpgrade with entryAction: %u", _appEntryState]];
159169

160-
OSChannelTracker *channelTrackerByAction = [_trackerFactory channelByEntryAction:entryAction];
161-
NSArray<OSChannelTracker *> *channelTrackersToReset = [_trackerFactory channelsToResetByEntryAction:entryAction];
170+
OSChannelTracker *channelTrackerByAction = [_trackerFactory channelByEntryAction:_appEntryState];
171+
NSArray<OSChannelTracker *> *channelTrackersToReset = [_trackerFactory channelsToResetByEntryAction:_appEntryState];
162172
NSMutableArray<OSInfluence *> *influencesToEnd = [NSMutableArray new];
163173
OSInfluence *lastInfluence = nil;
164174

@@ -190,7 +200,7 @@ - (void)attemptSessionUpgrade:(AppEntryAction)entryAction withDirectId:(NSString
190200
if (channelTracker.influenceType == UNATTRIBUTED) {
191201
NSArray *lastIds = [channelTracker lastReceivedIds];
192202
// There are new ids for attribution and the application was open again without resetting session
193-
if (lastIds.count > 0 && entryAction != APP_CLOSE) {
203+
if (lastIds.count > 0 && _appEntryState != APP_CLOSE) {
194204
// Save influence to ended it later if needed
195205
// This influence will be unattributed
196206
OSInfluence *influence = [channelTracker currentSessionInfluence];

iOS_SDK/OneSignalSDK/OneSignalOutcomes/Source/OutcomeEvents/OneSignalOutcomeEventsController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ - (void)sendSessionEndOutcomes:(NSNumber * _Nonnull)timeElapsed
109109
pushSubscriptionId:(NSString * _Nonnull)pushSubscriptionId
110110
onesignalId:(NSString * _Nonnull)onesignalId
111111
influenceParams:(NSArray<OSFocusInfluenceParam *> * _Nonnull)influenceParams {
112+
// Don't send influenced session with time < 1 seconds
113+
if ([timeElapsed intValue] < 1) {
114+
[OneSignalLog onesignalLog:ONE_S_LL_DEBUG message:[NSString stringWithFormat:@"sendSessionEndOutcomes not sending active time %@", timeElapsed]];
115+
return;
116+
}
112117
// TODO: What to do onSuccess and onFailure
113118
[OneSignalClient.sharedClient executeRequest:[OSRequestSendSessionEndOutcomes
114119
withActiveTime:timeElapsed

iOS_SDK/OneSignalSDK/Source/OSBackgroundTaskManagerImpl.h renamed to iOS_SDK/OneSignalSDK/Source/OSBackgroundTaskHandlerImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
#import <Foundation/Foundation.h>
2929
#import <OneSignalOSCore/OneSignalOSCore-Swift.h>
3030

31-
@interface OSBackgroundTaskManagerImpl : NSObject <OSBackgroundTaskManagerDelegate>
31+
@interface OSBackgroundTaskHandlerImpl : NSObject <OSBackgroundTaskHandler>
3232

3333
@end

iOS_SDK/OneSignalSDK/Source/OSBackgroundTaskManagerImpl.m renamed to iOS_SDK/OneSignalSDK/Source/OSBackgroundTaskHandlerImpl.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ of this software and associated documentation files (the "Software"), to deal
2525
THE SOFTWARE.
2626
*/
2727

28-
#import "OSBackgroundTaskManagerImpl.h"
28+
#import "OSBackgroundTaskHandlerImpl.h"
2929
#import <OneSignalOSCore/OneSignalOSCore-Swift.h>
3030
#import <OneSignalCore/OneSignalCore.h>
3131
#import <UIKit/UIKit.h>
3232

33-
@implementation OSBackgroundTaskManagerImpl
33+
@implementation OSBackgroundTaskHandlerImpl
3434

3535
NSMutableDictionary<NSString*, NSNumber*> *tasks;
3636

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#import "UIApplicationDelegate+OneSignal.h"
3939
#import "OSNotification+Internal.h"
4040
#import "OSMigrationController.h"
41-
#import "OSBackgroundTaskManagerImpl.h"
41+
#import "OSBackgroundTaskHandlerImpl.h"
4242
#import "OSFocusCallParams.h"
4343

4444
#import <OneSignalNotifications/OneSignalNotifications.h>
@@ -137,15 +137,6 @@ + (OneSignalReceiveReceiptsController*)receiveReceiptsController {
137137
return _receiveReceiptsController;
138138
}
139139

140-
static AppEntryAction _appEntryState = APP_CLOSE;
141-
+ (AppEntryAction)appEntryState {
142-
return _appEntryState;
143-
}
144-
145-
+ (void)setAppEntryState:(AppEntryAction)appEntryState {
146-
_appEntryState = appEntryState;
147-
}
148-
149140
+ (NSString*)appId {
150141
return appId;
151142
}
@@ -391,7 +382,7 @@ + (void)startNewSessionInternal {
391382

392383
[OSOutcomes.sharedController clearOutcomes];
393384

394-
[[OSSessionManager sharedSessionManager] restartSessionIfNeeded:_appEntryState];
385+
[[OSSessionManager sharedSessionManager] restartSessionIfNeeded];
395386

396387
[OneSignalTrackFirebaseAnalytics trackInfluenceOpenEvent];
397388

@@ -490,7 +481,7 @@ + (void)init {
490481

491482
[[OSMigrationController new] migrate];
492483

493-
OSBackgroundTaskManager.delegate = [OSBackgroundTaskManagerImpl new];
484+
OSBackgroundTaskManager.taskHandler = [OSBackgroundTaskHandlerImpl new];
494485

495486
[self registerForAPNsToken];
496487

@@ -797,6 +788,7 @@ + (void)load {
797788

798789
[[OSMigrationController new] migrate];
799790
// sessionLaunchTime = [NSDate date];
791+
// TODO: sessionLaunchTime used to always be set in load
800792

801793
[OSDialogInstanceManager setSharedInstance:[OneSignalDialogController sharedInstance]];
802794
}

0 commit comments

Comments
 (0)