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.1.0"
s.version = "2.1.1"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
4 changes: 1 addition & 3 deletions OneSignalExample/push-notifications/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(N

[OneSignal initWithLaunchOptions:launchOptions appId:@"b2f7f966-d8cc-11e4-bed1-df8f05be55ba" handleNotificationReceived:^(OSNotification *notification) {
NSLog(@"Received Notification - %@", notification.payload.notificationID);
} handleNotificationAction:^(OSNotificationResult *result) {
} handleNotificationAction:^(OSNotificationOpenedResult *result) {

// This block gets called when the user reacts to a notification received
OSNotificationPayload* payload = result.notification.payload;
Expand All @@ -50,8 +50,6 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(N
if(payload.title)
messageTitle = payload.title;

NSDictionary* additionalData = payload.additionalData;

if (result.action.actionID)
fullMessage = [fullMessage stringByAppendingString:[NSString stringWithFormat:@"\nPressed ButtonId:%@", result.action.actionID]];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
TargetAttributes = {
91E4D50C1C7521DE00025BA8 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = 99SW8E36CT;
SystemCapabilities = {
com.apple.BackgroundModes = {
enabled = 1;
Expand Down Expand Up @@ -264,25 +265,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 99SW8E36CT;
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../iOS_SDK/Framework\"";
INFOPLIST_FILE = OneSignalSwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalSwiftExample/OneSignalSwiftExample-Bridging-Header.h";
SWIFT_VERSION = "";
};
name = Debug;
};
91E4D5211C7521DE00025BA8 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = 99SW8E36CT;
FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../iOS_SDK/Framework\"";
INFOPLIST_FILE = OneSignalSwiftExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.onesignal.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "OneSignalSwiftExample/OneSignalSwiftExample-Bridging-Header.h";
SWIFT_VERSION = "";
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ typedef enum : NSUInteger {
requires remote-notification within UIBackgroundModes array of the Info.plist */
@property(readonly, getter=isSilentNotification)BOOL silentNotification;

/* iOS 10+: Indicates wether or not the received notification has mutableContent : 1 assigned to its payload
Used for UNNotificationServiceExtension to launch extension.
*/
#if XC8_AVAILABLE
@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 @@ -241,7 +247,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)IdsAvailable:(OSIdsAvailableBlock)idsAvailableBlock;

// - Alerting
// + (void)enableInAppAlertNotification:(BOOL)enable;
+ (void)setSubscription:(BOOL)enable;

// - Posting Notification
Expand Down
Binary file modified iOS_SDK/Framework/OneSignal.framework/Versions/A/OneSignal
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ typedef enum : NSUInteger {
requires remote-notification within UIBackgroundModes array of the Info.plist */
@property(readonly, getter=isSilentNotification)BOOL silentNotification;

/* iOS 10+: Indicates wether or not the received notification has mutableContent : 1 assigned to its payload
Used for UNNotificationServiceExtension to launch extension.
*/
#if XC8_AVAILABLE
@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 @@ -241,7 +247,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)IdsAvailable:(OSIdsAvailableBlock)idsAvailableBlock;

// - Alerting
// + (void)enableInAppAlertNotification:(BOOL)enable;
+ (void)setSubscription:(BOOL)enable;

// - Posting Notification
Expand Down
Binary file modified iOS_SDK/Framework/OneSignal.framework/Versions/B/OneSignal
Binary file not shown.
7 changes: 6 additions & 1 deletion iOS_SDK/OneSignal/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ typedef enum : NSUInteger {
requires remote-notification within UIBackgroundModes array of the Info.plist */
@property(readonly, getter=isSilentNotification)BOOL silentNotification;

/* iOS 10+: Indicates wether or not the received notification has mutableContent : 1 assigned to its payload
Used for UNNotificationServiceExtension to launch extension.
*/
#if XC8_AVAILABLE
@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 @@ -241,7 +247,6 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)IdsAvailable:(OSIdsAvailableBlock)idsAvailableBlock;

// - Alerting
// + (void)enableInAppAlertNotification:(BOOL)enable;
+ (void)setSubscription:(BOOL)enable;

// - Posting Notification
Expand Down
20 changes: 10 additions & 10 deletions iOS_SDK/OneSignal/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

@implementation OneSignal

NSString* const ONESIGNAL_VERSION = @"020100";
NSString* const ONESIGNAL_VERSION = @"020101";
static NSString* mSDKType = @"native";
static BOOL coldStartFromTapOnNotification = NO;
static BOOL registeredWithApple = NO; //Has attempted to register for push notifications with Apple.
Expand Down Expand Up @@ -205,8 +205,10 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId
trackIAPPurchase = [[OneSignalTrackIAP alloc] init];

if (NSClassFromString(@"UNUserNotificationCenter")) {
#if XC8_AVAILABLE
[OneSignalHelper registerAsUNNotificationCenterDelegate];
[OneSignalHelper clearCachedMedia];
#endif
}

return self;
Expand Down Expand Up @@ -263,8 +265,10 @@ void onesignal_Log(ONE_S_LOG_LEVEL logLevel, NSString* message) {
// "registerForRemoteNotifications*" calls didRegisterForRemoteNotificationsWithDeviceToken
// in the implementation UIApplication(OneSignalPush) below after contacting Apple's server.
+ (void)registerForPushNotifications {


#if XC8_AVAILABLE
[OneSignalHelper requestAuthorization];
#endif

// For iOS 8 devices
if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
Expand Down Expand Up @@ -761,7 +765,8 @@ + (void)notificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isActive {

[OneSignalHelper lastMessageReceived:messageDict];

if (inAppAlert) {
//Make sure it is not a silent one do display, if inAppAlerts are enabled
if (inAppAlert && ![OneSignalHelper isRemoteSilentNotification:messageDict]) {

NSArray<NSString*>* titleAndBody = [OneSignalHelper getPushTitleBody:messageDict];
id oneSignalAlertViewDelegate = [[OneSignalAlertViewDelegate alloc] initWithMessageDict:messageDict];
Expand Down Expand Up @@ -950,13 +955,8 @@ + (void) remoteSilentNotification:(UIApplication*)application UserInfo:(NSDictio
// If 'm' present then the notification has action buttons attached to it.
NSDictionary* data = nil;

if (userInfo[@"os_data"])
data = userInfo[@"os_data"][@"buttons"];
else if (userInfo[@"m"])
data = userInfo;

// - TEMP until server sends special field for attachments
else if (userInfo[@"custom"][@"at"])
// Check for buttons or attachments
if (userInfo[@"os_data"][@"buttons"] || userInfo[@"at"] || userInfo[@"o"])
data = userInfo;

//If buttons -> Data is buttons
Expand Down
9 changes: 7 additions & 2 deletions iOS_SDK/OneSignal/OneSignalHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
*/

#import "OneSignal.h"
#import "OneSignalWebView.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

@interface OneSignalHelper : NSObject

// - Web
+ (OneSignalWebView*)webVC;
+ (void) displayWebView:(NSURL*)url;

// - Notification Opened
Expand All @@ -44,15 +46,18 @@
+ (void)handleNotificationAction:(OSNotificationActionType)actionType actionID:(NSString*)actionID displayType:(OSNotificationDisplayType)displayType;

// - iOS 10
+ (BOOL)isiOS10Plus;
#if XC8_AVAILABLE
+ (void)registerAsUNNotificationCenterDelegate;
+ (void) requestAuthorization;
+ (void)conformsToUNProtocol;
+ (void)registerAsUNNotificationCenterDelegate;
+ (void)clearCachedMedia;
+ (id)prepareUNNotificationRequest:(NSDictionary *)data :(NSDictionary *)userInfo;
#endif

// - Notifications
+ (BOOL) isCapableOfGettingNotificationTypes;
+ (UILocalNotification*)prepareUILocalNotification:(NSDictionary*)data :(NSDictionary*)userInfo;
+ (id)prepareUNNotificationRequest:(NSDictionary *)data :(NSDictionary *)userInfo;
+ (BOOL)verifyURL:(NSString *)urlString;
+ (BOOL) isRemoteSilentNotification:(NSDictionary*)msg;

Expand Down
Loading