Skip to content

Commit a3839ff

Browse files
committed
2.7.0 Release Commit
• Fixes an issue where the Send Tags callback will never get called if executed within the first 30 seconds of the app being launched for the very first time • Fixes an iOS specific issue with the OneSignal Unity SDK where "Fatal: Invalid AppId Format" error was printed to console and initialization didn't finish on the first init() call (OneSignal-Unity-SDK Error #77) • Adds HTTP request re-attempt logic. If an HTTP request fails due to a server error (code ~500), the SDK will automatically reattempt the request soon after. • Fixes a race condition issue described in #327 where the subscription observer should be delayed until OneSignal's server has received the updated notification permissions • Adds exception handling logic to the extension to download attachments to prevent unnecessary crash reports.
1 parent b3044eb commit a3839ff

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

OneSignal.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "OneSignal"
3-
s.version = "2.6.2"
3+
s.version = "2.7.0"
44
s.summary = "OneSignal push notification library for mobile apps."
55
s.homepage = "https://onesignal.com"
66
s.license = { :type => 'MIT', :file => 'LICENSE' }

iOS_SDK/OneSignalSDK/Framework/OneSignal.framework/Versions/A/Headers/OneSignal.h

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,26 +236,42 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {
236236

237237
@end
238238

239-
@interface OSSubscriptionStateChanges : NSObject
240239

240+
@interface OSEmailSubscriptionState : NSObject
241+
@property (readonly, nonatomic) NSString* emailUserId; // The new Email user ID
242+
@property (readonly, nonatomic) NSString *emailAddress;
243+
@property (readonly, nonatomic) BOOL subscribed;
244+
- (NSDictionary*)toDictionary;
245+
@end
246+
247+
@interface OSSubscriptionStateChanges : NSObject
241248
@property (readonly) OSSubscriptionState* to;
242249
@property (readonly) OSSubscriptionState* from;
243-
244250
- (NSDictionary*)toDictionary;
251+
@end
245252

253+
@interface OSEmailSubscriptionStateChanges : NSObject
254+
@property (readonly) OSEmailSubscriptionState* to;
255+
@property (readonly) OSEmailSubscriptionState* from;
256+
- (NSDictionary*)toDictionary;
246257
@end
247258

248259
@protocol OSSubscriptionObserver <NSObject>
249260
- (void)onOSSubscriptionChanged:(OSSubscriptionStateChanges*)stateChanges;
250261
@end
251262

263+
@protocol OSEmailSubscriptionObserver <NSObject>
264+
- (void)onOSEmailSubscriptionChanged:(OSEmailSubscriptionStateChanges*)stateChanges;
265+
@end
266+
252267

253268

254269
// Permission+Subscription Classes
255270
@interface OSPermissionSubscriptionState : NSObject
256271

257272
@property (readonly) OSPermissionState* permissionStatus;
258273
@property (readonly) OSSubscriptionState* subscriptionStatus;
274+
@property (readonly) OSEmailSubscriptionState *emailSubscriptionStatus;
259275
- (NSDictionary*)toDictionary;
260276

261277
@end
@@ -341,7 +357,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
341357
+ (void)deleteTags:(NSArray*)keys onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSFailureBlock)failureBlock;
342358
+ (void)deleteTags:(NSArray*)keys;
343359
+ (void)deleteTagsWithJsonString:(NSString*)jsonString;
344-
345360
// Optional method that sends us the user's email as an anonymized hash so that we can better target and personalize notifications sent to that user across their devices.
346361
// Sends as MD5 and SHA1 of the provided email
347362
+ (void)syncHashedEmail:(NSString*)email;
@@ -357,6 +372,9 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
357372
+ (void)addSubscriptionObserver:(NSObject<OSSubscriptionObserver>*)observer;
358373
+ (void)removeSubscriptionObserver:(NSObject<OSSubscriptionObserver>*)observer;
359374

375+
+ (void)addEmailSubscriptionObserver:(NSObject<OSEmailSubscriptionObserver>*)observer;
376+
+ (void)removeEmailSubscriptionObserver:(NSObject<OSEmailSubscriptionObserver>*)observer;
377+
360378
+ (void)setSubscription:(BOOL)enable;
361379

362380
// - Posting Notification
@@ -380,4 +398,27 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
380398
+ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest*)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent;
381399
+ (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotificationRequest*)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent;
382400

401+
// Email methods
402+
403+
// Typedefs defining completion blocks for email & simultaneous HTTP requests
404+
typedef void (^OSEmailFailureBlock)(NSError* error);
405+
typedef void (^OSEmailSuccessBlock)();
406+
407+
// Allows you to set the email for this user.
408+
// Email Auth Token is a (recommended) optional parameter that should *NOT* be generated on the client.
409+
// For security purposes, the emailAuthToken should be generated by your backend server.
410+
// If you do not have a backend server for your application, use the version of thge setEmail: method without an emailAuthToken parameter.
411+
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken withSuccess:(OSEmailSuccessBlock _Nullable)successBlock withFailure:(OSEmailFailureBlock _Nullable)failureBlock;
412+
413+
// Sets email without an authentication token
414+
+ (void)setEmail:(NSString * _Nonnull)email withSuccess:(OSEmailSuccessBlock _Nullable)successBlock withFailure:(OSEmailFailureBlock _Nullable)failureBlock;
415+
416+
// Logs the device out of the current email.
417+
+ (void)logoutEmailWithSuccess:(OSEmailSuccessBlock _Nullable)successBlock withFailure:(OSEmailFailureBlock _Nullable)failureBlock;
418+
419+
//convenience - no completion blocks
420+
+ (void)logoutEmail;
421+
+ (void)setEmail:(NSString * _Nonnull)email;
422+
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken;
423+
383424
@end
Binary file not shown.

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ @implementation OSPendingCallbacks
125125

126126
@implementation OneSignal
127127

128-
NSString* const ONESIGNAL_VERSION = @"020602";
128+
NSString* const ONESIGNAL_VERSION = @"020700";
129129
static NSString* mSDKType = @"native";
130130
static BOOL coldStartFromTapOnNotification = NO;
131131

@@ -1280,6 +1280,8 @@ + (void)registerUserInternal {
12801280
//If the failed registration is priority, force the next one to be a high priority
12811281
nextRegistrationIsHighPriority = YES;
12821282

1283+
let error = (NSError *)(errors[@"push"] ?: errors[@"email"]);
1284+
12831285
if (nowProcessingCallbacks) {
12841286
for (OSPendingCallbacks *callbackSet in nowProcessingCallbacks) {
12851287
callbackSet.failureBlock(error);

0 commit comments

Comments
 (0)