Skip to content

Commit

Permalink
021100 release commit (#530)
Browse files Browse the repository at this point in the history
* 021100 release commit

* Changed logging and app id in demo app
  • Loading branch information
mikechoch authored Sep 9, 2019
1 parent 6a70518 commit 7f85d89
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 50 deletions.
4 changes: 2 additions & 2 deletions iOS_SDK/OneSignalDevApp/OneSignalDevApp/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

NSLog(@"Bundle URL: %@", [[NSBundle mainBundle] bundleURL]);

[OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
[OneSignal setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_ERROR];

OneSignal.inFocusDisplayType = OSNotificationDisplayTypeInAppAlert;

Expand Down Expand Up @@ -98,7 +98,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
+ (NSString*)getOneSignalAppId {
NSString* onesignalAppId = [[NSUserDefaults standardUserDefaults] objectForKey:ONESIGNAL_APP_ID_KEY_FOR_TESTING];
if (!onesignalAppId)
onesignalAppId = @"77e32082-ea27-42e3-a898-c72e141824ef";
onesignalAppId = @"0ba9731b-33bd-43f4-8b59-61172e27447d";

return onesignalAppId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@
***/

#import <Foundation/Foundation.h>

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
#define XC8_AVAILABLE 1
#import <UserNotifications/UserNotifications.h>
#endif


#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
Expand All @@ -73,6 +68,26 @@ 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

Expand Down Expand Up @@ -155,7 +170,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
/* Parses an APS push payload into a OSNotificationPayload object.
Useful to call from your NotificationServiceExtension when the
didReceiveNotificationRequest:withContentHandler: method fires. */
+(instancetype)parseWithApns:(nonnull NSDictionary*)message;
+ (instancetype)parseWithApns:(nonnull NSDictionary*)message;

@end

Expand All @@ -181,11 +196,8 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
@property(readonly, getter=isSilentNotification)BOOL silentNotification;

/* iOS 10+: Indicates whether or not the received notification has mutableContent : 1 assigned to its payload
Used for UNNotificationServiceExtension to launch extension.
*/
#if XC8_AVAILABLE
Used for UNNotificationServiceExtension to launch extension. */
@property(readonly, getter=hasMutableContent)BOOL mutableContent;
#endif

/* Convert object into an NSString that can be convertible into a custom Dictionary / JSON Object */
- (NSString*)stringify;
Expand Down Expand Up @@ -218,16 +230,6 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {
OSNotificationPermissionProvisional
};

typedef void (^OSNotificationDisplayTypeResponse)(OSNotificationDisplayType displayType);

// Notification Display Type Delegate
// Allows apps to customize per-notification display-type
@protocol OSNotificationDisplayTypeDelegate <NSObject>
- (void)willPresentInFocusNotificationWithPayload:(OSNotificationPayload *)payload
withCompletion:(OSNotificationDisplayTypeResponse)completion;
@end


// Permission Classes
@interface OSPermissionState : NSObject

Expand Down Expand Up @@ -318,6 +320,9 @@ typedef void (^OSHandleNotificationReceivedBlock)(OSNotification* notification);
/*Block for handling a user reaction to a notification*/
typedef void (^OSHandleNotificationActionBlock)(OSNotificationOpenedResult * result);

/*Block for handling user click on an in app message*/
typedef void (^OSHandleInAppMessageActionClickBlock)(OSInAppMessageAction* action);

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

/*Let OneSignal directly prompt for push notifications on init*/
Expand Down Expand Up @@ -415,10 +420,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {

+ (OSPermissionSubscriptionState*)getPermissionSubscriptionState;

// When the app is in-focus, this allows you to add a delegate that can customize the
// display type for specific notifications
+ (void)setNotificationDisplayTypeDelegate:(NSObject<OSNotificationDisplayTypeDelegate>*)delegate;

+ (void)addPermissionObserver:(NSObject<OSPermissionObserver>*)observer;
+ (void)removePermissionObserver:(NSObject<OSPermissionObserver>*)observer;

Expand All @@ -429,6 +430,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)removeEmailSubscriptionObserver:(NSObject<OSEmailSubscriptionObserver>*)observer;

+ (void)setSubscription:(BOOL)enable;
+ (BOOL)isInAppMessagingPaused;
+ (void)pauseInAppMessages:(BOOL)pause;

// - Posting Notification
+ (void)postNotification:(NSDictionary*)jsonData;
Expand All @@ -444,6 +447,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
// Only used for wrapping SDKs, such as Unity, Cordova, Xamarin, etc.
+ (void)setMSDKType:(NSString*)type;

+ (void)setInAppMessageClickHandler:(OSHandleInAppMessageActionClickBlock)delegate;

// iOS 10 only
// Process from Notification Service Extension.
Expand Down Expand Up @@ -474,6 +478,14 @@ typedef void (^OSEmailSuccessBlock)();
+ (void)setEmail:(NSString * _Nonnull)email;
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken;

// In App Messaging Trigger methods
+ (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;

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@
***/

#import <Foundation/Foundation.h>

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000
#define XC8_AVAILABLE 1
#import <UserNotifications/UserNotifications.h>
#endif


#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
Expand All @@ -73,6 +68,26 @@ 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

Expand Down Expand Up @@ -155,7 +170,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
/* Parses an APS push payload into a OSNotificationPayload object.
Useful to call from your NotificationServiceExtension when the
didReceiveNotificationRequest:withContentHandler: method fires. */
+(instancetype)parseWithApns:(nonnull NSDictionary*)message;
+ (instancetype)parseWithApns:(nonnull NSDictionary*)message;

@end

Expand All @@ -181,11 +196,8 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
@property(readonly, getter=isSilentNotification)BOOL silentNotification;

/* iOS 10+: Indicates whether or not the received notification has mutableContent : 1 assigned to its payload
Used for UNNotificationServiceExtension to launch extension.
*/
#if XC8_AVAILABLE
Used for UNNotificationServiceExtension to launch extension. */
@property(readonly, getter=hasMutableContent)BOOL mutableContent;
#endif

/* Convert object into an NSString that can be convertible into a custom Dictionary / JSON Object */
- (NSString*)stringify;
Expand Down Expand Up @@ -218,16 +230,6 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {
OSNotificationPermissionProvisional
};

typedef void (^OSNotificationDisplayTypeResponse)(OSNotificationDisplayType displayType);

// Notification Display Type Delegate
// Allows apps to customize per-notification display-type
@protocol OSNotificationDisplayTypeDelegate <NSObject>
- (void)willPresentInFocusNotificationWithPayload:(OSNotificationPayload *)payload
withCompletion:(OSNotificationDisplayTypeResponse)completion;
@end


// Permission Classes
@interface OSPermissionState : NSObject

Expand Down Expand Up @@ -318,6 +320,9 @@ typedef void (^OSHandleNotificationReceivedBlock)(OSNotification* notification);
/*Block for handling a user reaction to a notification*/
typedef void (^OSHandleNotificationActionBlock)(OSNotificationOpenedResult * result);

/*Block for handling user click on an in app message*/
typedef void (^OSHandleInAppMessageActionClickBlock)(OSInAppMessageAction* action);

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

/*Let OneSignal directly prompt for push notifications on init*/
Expand Down Expand Up @@ -415,10 +420,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {

+ (OSPermissionSubscriptionState*)getPermissionSubscriptionState;

// When the app is in-focus, this allows you to add a delegate that can customize the
// display type for specific notifications
+ (void)setNotificationDisplayTypeDelegate:(NSObject<OSNotificationDisplayTypeDelegate>*)delegate;

+ (void)addPermissionObserver:(NSObject<OSPermissionObserver>*)observer;
+ (void)removePermissionObserver:(NSObject<OSPermissionObserver>*)observer;

Expand All @@ -429,6 +430,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)removeEmailSubscriptionObserver:(NSObject<OSEmailSubscriptionObserver>*)observer;

+ (void)setSubscription:(BOOL)enable;
+ (BOOL)isInAppMessagingPaused;
+ (void)pauseInAppMessages:(BOOL)pause;

// - Posting Notification
+ (void)postNotification:(NSDictionary*)jsonData;
Expand All @@ -444,6 +447,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
// Only used for wrapping SDKs, such as Unity, Cordova, Xamarin, etc.
+ (void)setMSDKType:(NSString*)type;

+ (void)setInAppMessageClickHandler:(OSHandleInAppMessageActionClickBlock)delegate;

// iOS 10 only
// Process from Notification Service Extension.
Expand Down Expand Up @@ -474,6 +478,14 @@ typedef void (^OSEmailSuccessBlock)();
+ (void)setEmail:(NSString * _Nonnull)email;
+ (void)setEmail:(NSString * _Nonnull)email withEmailAuthHashToken:(NSString * _Nullable)hashToken;

// In App Messaging Trigger methods
+ (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;

Expand Down
Binary file not shown.

0 comments on commit 7f85d89

Please sign in to comment.