Skip to content

Commit b44161d

Browse files
committed
removing from OneSignal.m and .h
* Remove dead code from OneSignalFramework.h and OneSignal.m * usesAutoPrompt was always false, so remove it
1 parent 99a8e64 commit b44161d

File tree

8 files changed

+23
-67
lines changed

8 files changed

+23
-67
lines changed

iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
#import <UIKit/UIKit.h>
3232
#import <OneSignalFramework/OneSignalFramework.h>
3333

34-
@interface AppDelegate : UIResponder <UIApplicationDelegate, OSPermissionObserver, OSSubscriptionObserver, OSInAppMessageLifecycleHandler>
34+
// TODO: Add subscription observer
35+
@interface AppDelegate : UIResponder <UIApplicationDelegate, OSPermissionObserver, OSInAppMessageLifecycleHandler>
3536

3637
@property (strong, nonatomic) UIWindow *window;
3738

iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,12 @@ - (void) onOSPermissionChanged:(OSPermissionStateChanges*)stateChanges {
120120
NSLog(@"onOSPermissionChanged: %@", stateChanges);
121121
}
122122

123-
- (void) onOSSubscriptionChanged:(OSSubscriptionStateChanges*)stateChanges {
124-
NSLog(@"onOSSubscriptionChanged: %@", stateChanges);
125-
ViewController* mainController = (ViewController*) self.window.rootViewController;
126-
mainController.subscriptionSegmentedControl.selectedSegmentIndex = (NSInteger) stateChanges.to.isSubscribed;
127-
}
123+
// TODO: Add push sub observer
124+
//- (void) onOSSubscriptionChanged:(OSSubscriptionStateChanges*)stateChanges {
125+
// NSLog(@"onOSSubscriptionChanged: %@", stateChanges);
126+
// ViewController* mainController = (ViewController*) self.window.rootViewController;
127+
// mainController.subscriptionSegmentedControl.selectedSegmentIndex = (NSInteger) stateChanges.to.isSubscribed;
128+
//}
128129

129130
#pragma mark OSInAppMessageDelegate
130131

iOS_SDK/OneSignalDevApp/OneSignalDevAppClip/AppDelegate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
#import <UIKit/UIKit.h>
1010
#import <OneSignalFramework/OneSignalFramework.h>
1111

12-
@interface AppDelegate : UIResponder <UIApplicationDelegate, OSPermissionObserver, OSSubscriptionObserver>
12+
// TODO: Add subscription observer
13+
@interface AppDelegate : UIResponder <UIApplicationDelegate, OSPermissionObserver>
1314

1415
@property (strong, nonatomic) UIWindow *window;
1516

iOS_SDK/OneSignalDevApp/OneSignalDevAppClip/AppDelegate.m

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ - (void) onOSPermissionChanged:(OSPermissionStateChanges*)stateChanges {
116116
NSLog(@"onOSPermissionChanged: %@", stateChanges);
117117
}
118118

119-
- (void) onOSSubscriptionChanged:(OSSubscriptionStateChanges*)stateChanges {
120-
NSLog(@"onOSSubscriptionChanged: %@", stateChanges);
121-
ViewController* mainController = (ViewController*) self.window.rootViewController;
122-
mainController.subscriptionSegmentedControl.selectedSegmentIndex = (NSInteger) stateChanges.to.isSubscribed;
123-
}
119+
// TODO: Add push sub observer
120+
//- (void) onOSSubscriptionChanged:(OSSubscriptionStateChanges*)stateChanges {
121+
// NSLog(@"onOSSubscriptionChanged: %@", stateChanges);
122+
// ViewController* mainController = (ViewController*) self.window.rootViewController;
123+
// mainController.subscriptionSegmentedControl.selectedSegmentIndex = (NSInteger) stateChanges.to.isSubscribed;
124+
//}
124125

125126
- (void)applicationWillResignActive:(UIApplication *)application {
126127
}

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSPermission.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ + (void)fireChangesObserver:(OSPermissionStateInternal*)state {
241241
@implementation OSPermissionStateChanges
242242

243243
- (NSString*)description {
244-
static NSString* format = @"<OSSubscriptionStateChanges:\nfrom: %@,\nto: %@\n>";
244+
static NSString* format = @"<OSPermissionStateChanges:\nfrom: %@,\nto: %@\n>";
245245
return [NSString stringWithFormat:format, _from, _to];
246246
}
247247

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,6 @@ @implementation OneSignal
9696

9797
static NSString* mSDKType = @"native";
9898

99-
static NSMutableArray* pendingSendTagCallbacks;
100-
static OSResultSuccessBlock pendingGetTagsSuccessBlock;
101-
static OSFailureBlock pendingGetTagsFailureBlock;
102-
10399
// Has attempted to register for push notifications with Apple since app was installed.
104100
static BOOL registeredWithApple = NO;
105101

@@ -126,14 +122,8 @@ + (DelayedConsentInitializationParameters *)delayedInitParameters {
126122
// Set when the app is launched
127123
static NSDate *sessionLaunchTime;
128124

129-
NSString* emailToSet;
130125
static LanguageContext* languageContext;
131126

132-
BOOL usesAutoPrompt = false;
133-
134-
static BOOL performedOnSessionRequest = false;
135-
136-
137127
// static property def to add developer's OSPermissionStateChanges observers to.
138128
static ObservablePermissionStateChangesType* _permissionStateChangesObserver;
139129
+ (ObservablePermissionStateChangesType*)permissionStateChangesObserver {
@@ -207,7 +197,6 @@ + (void)clearStatics {
207197
launchOptions = false;
208198
appSettings = nil;
209199
initDone = false;
210-
usesAutoPrompt = false;
211200

212201
[OSNotificationsManager clearStatics];
213202
registeredWithApple = false;
@@ -218,16 +207,13 @@ + (void)clearStatics {
218207
_didCallDownloadParameters = false;
219208

220209
sessionLaunchTime = [NSDate date];
221-
performedOnSessionRequest = false;
222210

223211
[OSOutcomes clearStatics];
224212

225213
[OSSessionManager resetSharedSessionManager];
226214
}
227215

228-
#pragma mark User Model 🔥
229-
230-
#pragma mark User Model - User Identity 🔥
216+
#pragma mark Namespaces
231217

232218
+ (id<OSUser>)User {
233219
return [OneSignalUserManagerImpl.sharedInstance User];
@@ -255,7 +241,6 @@ + (void)logout {
255241
[OneSignalUserManagerImpl.sharedInstance logout];
256242
}
257243

258-
#pragma mark User Model - Notifications namespace 🔥
259244
+ (Class<OSNotifications>)Notifications {
260245
return [OSNotificationsManager Notifications];
261246
}
@@ -272,6 +257,8 @@ + (void)logout {
272257
return [OneSignalLocation Location];
273258
}
274259

260+
#pragma mark Initialization
261+
275262
/*
276263
This is should be set from all OneSignal entry points.
277264
*/
@@ -358,8 +345,6 @@ + (void)setProvidesNotificationSettingsView:(BOOL)providesView {
358345
}
359346
}
360347

361-
#pragma mark Initialization
362-
363348
+ (BOOL)shouldStartNewSession {
364349
// return if the user has not granted privacy permissions
365350
if ([OSPrivacyConsentController shouldLogMissingPrivacyConsentErrorWithMethodName:nil])
@@ -654,7 +639,7 @@ + (void)downloadIOSParamsWithAppId:(NSString *)appId {
654639
OneSignalUserManagerImpl.sharedInstance.requiresUserAuth = [result[IOS_REQUIRES_USER_ID_AUTHENTICATION] boolValue];
655640
}
656641

657-
if (!usesAutoPrompt && result[IOS_USES_PROVISIONAL_AUTHORIZATION] != (id)[NSNull null]) {
642+
if (result[IOS_USES_PROVISIONAL_AUTHORIZATION] != (id)[NSNull null]) {
658643
[OneSignalUserDefaults.initStandard saveBoolForKey:OSUD_USES_PROVISIONAL_PUSH_AUTHORIZATION withValue:[result[IOS_USES_PROVISIONAL_AUTHORIZATION] boolValue]];
659644

660645
[OSNotificationsManager checkProvisionalAuthorizationStatus];

iOS_SDK/OneSignalSDK/Source/OneSignalFramework.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -55,29 +55,6 @@
5555
#pragma clang diagnostic ignored "-Wstrict-prototypes"
5656
#pragma clang diagnostic ignored "-Wnullability-completeness"
5757

58-
// TODO: Need to remove these too for user model
59-
60-
// Subscription Classes
61-
@interface OSSubscriptionState : NSObject
62-
63-
@property (readonly, nonatomic) BOOL isSubscribed; // (yes only if userId, pushToken, and setSubscription exists / are true)
64-
@property (readonly, nonatomic) BOOL isPushDisabled; // returns value of disablePush.
65-
@property (readonly, nonatomic, nullable) NSString* userId; // AKA OneSignal PlayerId
66-
@property (readonly, nonatomic, nullable) NSString* pushToken; // AKA Apple Device Token
67-
- (NSDictionary* _Nonnull)toDictionary;
68-
69-
@end
70-
71-
@interface OSSubscriptionStateChanges : NSObject
72-
@property (readonly, nonnull) OSSubscriptionState* to;
73-
@property (readonly, nonnull) OSSubscriptionState* from;
74-
- (NSDictionary* _Nonnull)toDictionary;
75-
@end
76-
77-
@protocol OSSubscriptionObserver <NSObject>
78-
- (void)onOSSubscriptionChanged:(OSSubscriptionStateChanges* _Nonnull)stateChanges;
79-
@end
80-
8158
typedef void (^OSWebOpenURLResultBlock)(BOOL shouldOpen);
8259

8360
/*Block for generic results on success and errors on failure*/
@@ -94,16 +71,14 @@ typedef void (^OSFailureBlock)(NSError* error);
9471
// Only used for wrapping SDKs, such as Unity, Cordova, Xamarin, etc.
9572
+ (void)setMSDKType:(NSString* _Nonnull)type;
9673

97-
#pragma mark User Model 🔥
98-
99-
#pragma mark User Model - User Identity 🔥
74+
#pragma mark User
10075
+ (id<OSUser>)User NS_REFINED_FOR_SWIFT;
10176
+ (void)login:(NSString * _Nonnull)externalId;
10277
+ (void)login:(NSString * _Nonnull)externalId withToken:(NSString * _Nullable)token
10378
NS_SWIFT_NAME(login(externalId:token:));
10479
+ (void)logout;
10580

106-
#pragma mark User Model - Notifications namespace 🔥
81+
#pragma mark Notifications
10782
+ (Class<OSNotifications>)Notifications NS_REFINED_FOR_SWIFT;
10883

10984
#pragma mark Initialization

iOS_SDK/OneSignalSDK/Source/OneSignalInternal.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,11 @@
3939

4040
@interface OneSignal (OneSignalInternal)
4141

42-
+ (BOOL)shouldPromptToShowURL;
43-
+ (void)setIsOnSessionSuccessfulForCurrentState:(BOOL)value;
44-
+ (BOOL)shouldRegisterNow;
45-
4642
+ (NSDate *_Nonnull)sessionLaunchTime;
4743

4844

4945
@property (class, readonly) BOOL didCallDownloadParameters;
5046
@property (class, readonly) BOOL downloadedParameters;
51-
//Indicates we have attempted to register the user and it has succeeded or failed
52-
@property (class, readonly) BOOL isRegisterUserFinished;
53-
//Indicates that registering the user was successful
54-
@property (class, readonly) BOOL isRegisterUserSuccessful;
5547

5648
@property (class) AppEntryAction appEntryState;
5749
@property (class) OSSessionManager* _Nonnull sessionManager;

0 commit comments

Comments
 (0)