Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OneSignal.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneSignal"
s.version = "2.11.2"
s.version = "2.12.0"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
2 changes: 1 addition & 1 deletion OneSignalDynamic.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneSignalDynamic"
s.version = "2.11.2"
s.version = "2.12.0"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
/**
* Modified MIT License
*
* Copyright 2017 OneSignal
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 1. The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 2. All copies of substantial portions of the Software may only be used in connection
* with services provided by OneSignal.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
Modified MIT License

Copyright 2017 OneSignal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

1. The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

2. All copies of substantial portions of the Software may only be used in connection
with services provided by OneSignal.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

/***

/**
### Setting up the SDK ###
Follow the documentation from https://documentation.onesignal.com/docs/ios-sdk-setupto setup OneSignal in your app.

Expand All @@ -40,8 +39,7 @@

### More ###
iOS Push Cert: https://documentation.onesignal.com/docs/generating-an-ios-push-certificate

***/
*/

#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
Expand All @@ -68,27 +66,6 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
OSNotificationDisplayTypeNotification
};

@interface OSInAppMessageAction : NSObject

// The action name attached to the IAM action
@property (strong, nonatomic, nullable) NSString *clickName;

// The URL (if any) that should be opened when the action occurs
@property (strong, nonatomic, nullable) NSURL *clickUrl;

// Whether or not the click action is first click on the IAM
@property (nonatomic) BOOL firstClick;

// Whether or not the click action dismisses the message
@property (nonatomic) BOOL closesMessage;

@end

@protocol OSInAppMessageDelegate <NSObject>
@optional
- (void)handleMessageAction:(OSInAppMessageAction * _Nonnull)action NS_SWIFT_NAME(handleMessageAction(action:));
@end

@interface OSNotificationAction : NSObject

/* The type of the notification action */
Expand All @@ -99,9 +76,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {

@end


// #### Notification Payload Received Object

/* Notification Payload Received Object */
@interface OSNotificationPayload : NSObject

/* Unique Message Identifier */
Expand Down Expand Up @@ -174,7 +149,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {

@end

// ## OneSignal OSNotification
/* OneSignal OSNotification */
@interface OSNotification : NSObject

/* Notification Payload */
Expand Down Expand Up @@ -204,7 +179,6 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {

@end


@interface OSNotificationOpenedResult : NSObject

@property(readonly)OSNotification* notification;
Expand All @@ -215,6 +189,54 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {

@end;

@interface OSInAppMessageAction : NSObject

/* The action name attached to the IAM action */
@property (strong, nonatomic, nullable) NSString *clickName;

/* The URL (if any) that should be opened when the action occurs */
@property (strong, nonatomic, nullable) NSURL *clickUrl;

/* Whether or not the click action is first click on the IAM */
@property (nonatomic) BOOL firstClick;

/* Whether or not the click action dismisses the message */
@property (nonatomic) BOOL closesMessage;

@end

@protocol OSInAppMessageDelegate <NSObject>
@optional
- (void)handleMessageAction:(OSInAppMessageAction * _Nonnull)action NS_SWIFT_NAME(handleMessageAction(action:));
@end

/* OneSignal Session Types */
typedef NS_ENUM(NSUInteger, Session) {
DIRECT,
INDIRECT,
UNATTRIBUTED,
DISABLED
};

@interface OSOutcomeEvent : NSObject

// Session enum (DIRECT, INDIRECT, UNATTRIBUTED, or DISABLED) to determine code route and request params
@property (nonatomic) Session session;

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

// Id or name of the event
@property (strong, nonatomic, nonnull) NSString *name;

// Time of the event occurring
@property (strong, nonatomic, nonnull) NSNumber *timestamp;

// A weight to attach to the outcome name
@property (strong, nonatomic, nonnull) NSDecimalNumber *weight;

@end


typedef NS_ENUM(NSInteger, OSNotificationPermission) {
// The user has not yet made a choice regarding whether your app can show notifications.
Expand Down Expand Up @@ -308,6 +330,7 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {

typedef void (^OSWebOpenURLResultBlock)(BOOL shouldOpen);

/*Block for generic results on success and errors on failure*/
typedef void (^OSResultSuccessBlock)(NSDictionary* result);
typedef void (^OSFailureBlock)(NSError* error);

Expand All @@ -323,6 +346,10 @@ typedef void (^OSHandleNotificationActionBlock)(OSNotificationOpenedResult * res
/*Block for handling user click on an in app message*/
typedef void (^OSHandleInAppMessageActionClickBlock)(OSInAppMessageAction* action);

/*Block for handling outcome event being sent successfully*/
typedef void (^OSSendOutcomeSuccess)(OSOutcomeEvent* outcome);


/*Dictionary of keys to pass alongside the init settings*/

/*Let OneSignal directly prompt for push notifications on init*/
Expand Down Expand Up @@ -350,8 +377,6 @@ extern NSString * const kOSSettingsKeyInFocusDisplayOption;
*/
extern NSString * const kOSSettingsKeyProvidesAppNotificationSettings;



// ======= OneSignal Class Interface =========
@interface OneSignal : NSObject

Expand All @@ -362,10 +387,10 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
};


/**
/*
Initialize OneSignal.
Sends push token to OneSignal so you can later send notifications.
*/
*/

// - Initialization
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;
Expand Down Expand Up @@ -396,7 +421,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {

// - Logging
+ (void)setLogLevel:(ONE_S_LOG_LEVEL)logLevel visualLevel:(ONE_S_LOG_LEVEL)visualLogLevel;
+ (void) onesignal_Log:(ONE_S_LOG_LEVEL)logLevel message:(NSString*)message;
+ (void)onesignal_Log:(ONE_S_LOG_LEVEL)logLevel message:(NSString*)message;

// - Tagging
+ (void)sendTag:(NSString*)key value:(NSString*)value onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSFailureBlock)failureBlock;
Expand Down Expand Up @@ -466,30 +491,37 @@ typedef void (^OSEmailSuccessBlock)();
// Email Auth Token is a (recommended) optional parameter that should *NOT* be generated on the client.
// For security purposes, the emailAuthToken should be generated by your backend server.
// If you do not have a backend server for your application, use the version of thge setEmail: method without an emailAuthToken parameter.
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken;
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken withSuccess:(OSEmailSuccessBlock _Nullable)successBlock withFailure:(OSEmailFailureBlock _Nullable)failureBlock;

// Sets email without an authentication token
+ (void)setEmail:(NSString * _Nonnull)email;
+ (void)setEmail:(NSString * _Nonnull)email withSuccess:(OSEmailSuccessBlock _Nullable)successBlock withFailure:(OSEmailFailureBlock _Nullable)failureBlock;

// Logs the device out of the current email.
+ (void)logoutEmail;
+ (void)logoutEmailWithSuccess:(OSEmailSuccessBlock _Nullable)successBlock withFailure:(OSEmailFailureBlock _Nullable)failureBlock;

//convenience - no completion blocks
+ (void)logoutEmail;
+ (void)setEmail:(NSString * _Nonnull)email;
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken;

// In App Messaging Trigger methods
// External user id
+ (void)setExternalUserId:(NSString * _Nonnull)externalId;
+ (void)removeExternalUserId;

// In-App Messaging triggers
+ (void)addTrigger:(NSString * _Nonnull)key withValue:(id _Nonnull)value;
+ (void)addTriggers:(NSDictionary<NSString *, id> * _Nonnull)triggers;
+ (void)removeTriggerForKey:(NSString * _Nonnull)key;
+ (void)removeTriggersForKeys:(NSArray<NSString *> * _Nonnull)keys;
+ (NSDictionary<NSString *, id> * _Nonnull)getTriggers;
+ (id _Nullable)getTriggerValueForKey:(NSString * _Nonnull)key;

+ (void)setExternalUserId:(NSString * _Nonnull)externalId;
+ (void)removeExternalUserId;

// Outcome Events
+ (void)sendOutcome:(NSString * _Nonnull)name;
+ (void)sendOutcome:(NSString * _Nonnull)name onSuccess:(OSSendOutcomeSuccess _Nullable)success;
+ (void)sendUniqueOutcome:(NSString * _Nonnull)name;
+ (void)sendUniqueOutcome:(NSString * _Nonnull)name onSuccess:(OSSendOutcomeSuccess _Nullable)success;
+ (void)sendOutcomeWithValue:(NSString * _Nonnull)name value:(NSNumber * _Nonnull)value;
+ (void)sendOutcomeWithValue:(NSString * _Nonnull)name value:(NSNumber * _Nonnull)value onSuccess:(OSSendOutcomeSuccess _Nullable)success;
@end

#pragma clang diagnostic pop
Binary file not shown.
4 changes: 2 additions & 2 deletions iOS_SDK/OneSignalSDK/Source/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ @interface OneSignal (SessionStatusDelegate)

@implementation OneSignal

NSString* const ONESIGNAL_VERSION = @"021102";
NSString* const ONESIGNAL_VERSION = @"021200";
static NSString* mSDKType = @"native";
static BOOL coldStartFromTapOnNotification = NO;

Expand Down Expand Up @@ -2659,4 +2659,4 @@ +(void)setupUNUserNotificationCenterDelegate {


#pragma clang diagnostic pop
#pragma clang diagnostic pop
#pragma clang diagnostic pop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here twice?