Skip to content

Commit bba8b53

Browse files
authored
Push Notifications rewrite (#478)
1 parent 58b7f9c commit bba8b53

File tree

88 files changed

+3634
-2250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+3634
-2250
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
if: (tag IS present) OR (type = pull_request)
33

44
language: objective-c
5-
osx_image: xcode12.5
5+
osx_image: xcode13.1
66

77
xcode_workspace: Leanplum.xcworkspace
88
xcode_scheme: LeanplumSDKApp
9-
xcode_destination: platform=iOS Simulator,OS=14.5,name=iPhone 12
9+
xcode_destination: platform=iOS Simulator,OS=15.0,name=iPhone 12
1010

1111
cache: cocoapods
1212
podfile: Podfile

LeanplumSDK/LeanplumSDK.xcodeproj/project.pbxproj

Lines changed: 130 additions & 74 deletions
Large diffs are not rendered by default.

LeanplumSDK/LeanplumSDK/Classes/Features/Actions/LPActionManager.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#import <Foundation/Foundation.h>
2828
#import "LPContextualValues.h"
2929
#import <UserNotifications/UserNotifications.h>
30-
#import "LPPushNotificationsManager.h"
3130
#import "LPLocalNotificationsManager.h"
3231

3332
NS_ASSUME_NONNULL_BEGIN

LeanplumSDK/LeanplumSDK/Classes/Features/Actions/LPActionManager.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ + (void)reset
8787
- (id)init
8888
{
8989
if (self = [super init]) {
90-
[[LPLocalNotificationsManager sharedManager] listenForLocalNotifications];
9190
_sessionOccurrences = [NSMutableDictionary dictionary];
9291
_messageImpressionOccurrences = [NSMutableDictionary dictionary];
9392
_messageTriggerOccurrences = [NSMutableDictionary dictionary];

LeanplumSDK/LeanplumSDK/Classes/Features/Inbox/LPInbox.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#import "Leanplum.h"
2828
#import "LeanplumInternal.h"
2929
#import "LPVarCache.h"
30-
#import "LeanplumInternal.h"
3130
#import "LPAES.h"
3231
#import "LPKeychainWrapper.h"
3332
#import "LPFileManager.h"

LeanplumSDK/LeanplumSDK/Classes/Internal/LPConstants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ OBJC_EXPORT NSString *LEANPLUM_DEFAULTS_APP_VERSION_KEY;
133133
OBJC_EXPORT NSString *LEANPLUM_DEFAULTS_VARS_JSON_KEY;
134134
OBJC_EXPORT NSString *LEANPLUM_DEFAULTS_VARS_SIGNATURE_KEY;
135135
OBJC_EXPORT NSString *LEANPLUM_DEFAULTS_LOCAL_CAPS_KEY;
136+
OBJC_EXPORT NSString *LEANPLUM_DEFAULTS_PUSH_IDS_KEY;
136137

137138
OBJC_EXPORT NSString *LEANPLUM_SQLITE_NAME;
138139

LeanplumSDK/LeanplumSDK/Classes/Internal/LPConstants.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ - (id)init {
8989
NSString *LEANPLUM_DEFAULTS_VARS_JSON_KEY = @"__leanplum_variables_json";
9090
NSString *LEANPLUM_DEFAULTS_VARS_SIGNATURE_KEY = @"__leanplum_variables_signature";
9191
NSString *LEANPLUM_DEFAULTS_LOCAL_CAPS_KEY = @"__leanplum_local_caps";
92+
NSString *LEANPLUM_DEFAULTS_PUSH_IDS_KEY = @"__leanplum_push_ids";
9293

9394
NSString *LEANPLUM_SQLITE_NAME = @"__leanplum.sqlite";
9495

LeanplumSDK/LeanplumSDK/Classes/Internal/Leanplum.m

Lines changed: 126 additions & 77 deletions
Large diffs are not rendered by default.

LeanplumSDK/LeanplumSDK/Classes/Internal/LeanplumInternal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
3535

3636
@class LeanplumSocket;
3737
@class LPRegisterDevice;
38+
@class NotificationsManager;
3839

3940
/**
4041
* Keys for the plist file name
@@ -56,6 +57,8 @@ typedef void (^LeanplumStartIssuedBlock)(void);
5657
typedef void (^LeanplumEventsChangedBlock)(void);
5758
typedef void (^LeanplumHandledBlock)(BOOL success);
5859

60+
+ (NotificationsManager*)notificationsManager;
61+
5962
+ (void)throwError:(NSString *)reason;
6063

6164
+ (void)onHasStartedAndRegisteredAsDeveloper;

LeanplumSDK/LeanplumSDK/Classes/LPMessageTemplates.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
#import "LPConfirmMessageTemplate.h"
4242
#import "LPAppRatingMessageTemplate.h"
4343
#import "LPIconChangeMessageTemplate.h"
44-
#import "LPPushNotificationsManager.h"
44+
#import "LeanplumInternal.h"
45+
#import <Leanplum/Leanplum-Swift.h>
4546

4647
#define APP_NAME (([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]) ?: \
4748
([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]))
@@ -104,12 +105,12 @@ - (void)defineActions
104105
// refreshPushPermissions is called by [Leanplum start].
105106
- (void)refreshPushPermissions
106107
{
107-
[[LPPushNotificationsManager sharedManager] refreshPushPermissions];
108+
[[Leanplum notificationsManager] refreshPushPermissions];
108109
}
109110

110111
- (void)disableAskToAsk
111112
{
112-
[[LPPushNotificationsManager sharedManager] disableAskToAsk];
113+
[Leanplum notificationsManager].isAskToAskDisabled = YES;
113114
}
114115

115116
@end

0 commit comments

Comments
 (0)