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
9 changes: 0 additions & 9 deletions Examples/SwiftExample/OneSignalDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, OSPermissionObserver, OSS
if let additionalData = result!.notification.payload!.additionalData {
print("additionalData = \(additionalData)")

// DEEP LINK and open url in RedViewController
// Send notification with Additional Data > example key: "OpenURL" example value: "https://google.com"
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let instantiateRedViewController : RedViewController = mainStoryboard.instantiateViewController(withIdentifier: "RedViewControllerID") as! RedViewController
instantiateRedViewController.receivedURL = additionalData["OpenURL"] as! String!
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = instantiateRedViewController
self.window?.makeKeyAndVisible()


if let actionSelected = payload?.actionButtons {
print("actionSelected = \(actionSelected)")
Expand Down
22 changes: 22 additions & 0 deletions iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
CA08FC801FE99B25004C445F /* Requests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA08FC7D1FE99B25004C445F /* Requests.m */; };
CA08FC811FE99B25004C445F /* Requests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA08FC7D1FE99B25004C445F /* Requests.m */; };
CA08FC871FE99BB4004C445F /* OneSignalClientOverrider.m in Sources */ = {isa = PBXBuildFile; fileRef = CA08FC831FE99BB4004C445F /* OneSignalClientOverrider.m */; };
CA1873BD2049F7070079CA09 /* NSMutableDictionary+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = CA1873BC2049F7070079CA09 /* NSMutableDictionary+OneSignal.m */; };
CA1873BF2049FB4F0079CA09 /* NSMutableDictionary+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = CA1873BC2049F7070079CA09 /* NSMutableDictionary+OneSignal.m */; };
CA1873C02049FB540079CA09 /* NSMutableDictionary+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = CA1873BC2049F7070079CA09 /* NSMutableDictionary+OneSignal.m */; };
CA63AF8420211F7400E340FB /* EmailTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA63AF8320211F7400E340FB /* EmailTests.m */; };
CA63AF8720211FF800E340FB /* UnitTestCommonMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = CA63AF8620211FF800E340FB /* UnitTestCommonMethods.m */; };
CA63AFC22022670A00E340FB /* ReattemptRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = CA63AFC02022670A00E340FB /* ReattemptRequest.h */; };
Expand All @@ -144,6 +147,10 @@
CA810FD1202BA97300A60FED /* OSEmailSubscription.m in Sources */ = {isa = PBXBuildFile; fileRef = CA810FD0202BA97300A60FED /* OSEmailSubscription.m */; };
CA810FD2202BA97600A60FED /* OSEmailSubscription.m in Sources */ = {isa = PBXBuildFile; fileRef = CA810FD0202BA97300A60FED /* OSEmailSubscription.m */; };
CA810FD3202BA97600A60FED /* OSEmailSubscription.m in Sources */ = {isa = PBXBuildFile; fileRef = CA810FD0202BA97300A60FED /* OSEmailSubscription.m */; };
CA97E14E2051C0A5003B8CB8 /* OneSignalWebOpenDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = CA97E14C2051C0A5003B8CB8 /* OneSignalWebOpenDialog.h */; };
CA97E14F2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CA97E14D2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m */; };
CA97E1502051C0A5003B8CB8 /* OneSignalWebOpenDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CA97E14D2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m */; };
CA97E1512051C0A5003B8CB8 /* OneSignalWebOpenDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CA97E14D2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m */; };
CAEA1C66202BB3C600FBFE9E /* OSEmailSubscription.h in Headers */ = {isa = PBXBuildFile; fileRef = CA810FCF202BA97300A60FED /* OSEmailSubscription.h */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -267,6 +274,8 @@
CA08FC7D1FE99B25004C445F /* Requests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Requests.m; sourceTree = "<group>"; };
CA08FC821FE99BB4004C445F /* OneSignalClientOverrider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalClientOverrider.h; sourceTree = "<group>"; };
CA08FC831FE99BB4004C445F /* OneSignalClientOverrider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalClientOverrider.m; sourceTree = "<group>"; };
CA1873BB2049F7070079CA09 /* NSMutableDictionary+OneSignal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+OneSignal.h"; sourceTree = "<group>"; };
CA1873BC2049F7070079CA09 /* NSMutableDictionary+OneSignal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+OneSignal.m"; sourceTree = "<group>"; };
CA63AF8320211F7400E340FB /* EmailTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EmailTests.m; sourceTree = "<group>"; };
CA63AF8520211FF800E340FB /* UnitTestCommonMethods.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UnitTestCommonMethods.h; sourceTree = "<group>"; };
CA63AF8620211FF800E340FB /* UnitTestCommonMethods.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UnitTestCommonMethods.m; sourceTree = "<group>"; };
Expand All @@ -277,6 +286,8 @@
CA70E3382023F24500019273 /* OneSignalCommonDefines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalCommonDefines.h; sourceTree = "<group>"; };
CA810FCF202BA97300A60FED /* OSEmailSubscription.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSEmailSubscription.h; sourceTree = "<group>"; };
CA810FD0202BA97300A60FED /* OSEmailSubscription.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OSEmailSubscription.m; sourceTree = "<group>"; };
CA97E14C2051C0A5003B8CB8 /* OneSignalWebOpenDialog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalWebOpenDialog.h; sourceTree = "<group>"; };
CA97E14D2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalWebOpenDialog.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -457,6 +468,8 @@
912411F31E73342200E41FD7 /* OneSignalAlertViewDelegate.m */,
912412061E73342200E41FD7 /* OneSignalWebView.h */,
912412071E73342200E41FD7 /* OneSignalWebView.m */,
CA97E14C2051C0A5003B8CB8 /* OneSignalWebOpenDialog.h */,
CA97E14D2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m */,
);
name = UI;
sourceTree = "<group>";
Expand All @@ -472,6 +485,8 @@
912412091E73342200E41FD7 /* UIApplicationDelegate+OneSignal.m */,
9124120A1E73342200E41FD7 /* UNUserNotificationCenter+OneSignal.h */,
9124120B1E73342200E41FD7 /* UNUserNotificationCenter+OneSignal.m */,
CA1873BB2049F7070079CA09 /* NSMutableDictionary+OneSignal.h */,
CA1873BC2049F7070079CA09 /* NSMutableDictionary+OneSignal.m */,
);
name = Categories;
sourceTree = "<group>";
Expand Down Expand Up @@ -554,6 +569,7 @@
912412391E73342200E41FD7 /* OneSignalWebView.h in Headers */,
91C7725E1E7CCE1000D612D0 /* OneSignalInternal.h in Headers */,
9129C6BD1E89E7AB009CB6A0 /* OSSubscription.h in Headers */,
CA97E14E2051C0A5003B8CB8 /* OneSignalWebOpenDialog.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -705,6 +721,7 @@
9129C6B81E89E59B009CB6A0 /* OSPermission.m in Sources */,
912412121E73342200E41FD7 /* OneSignalAlertViewDelegate.m in Sources */,
912412421E73342200E41FD7 /* UNUserNotificationCenter+OneSignal.m in Sources */,
CA97E14F2051C0A5003B8CB8 /* OneSignalWebOpenDialog.m in Sources */,
9124123A1E73342200E41FD7 /* OneSignalWebView.m in Sources */,
9124123E1E73342200E41FD7 /* UIApplicationDelegate+OneSignal.m in Sources */,
912412261E73342200E41FD7 /* OneSignalMobileProvision.m in Sources */,
Expand All @@ -717,6 +734,7 @@
CA810FD1202BA97300A60FED /* OSEmailSubscription.m in Sources */,
CA63AFC32022670A00E340FB /* ReattemptRequest.m in Sources */,
912412221E73342200E41FD7 /* OneSignalLocation.m in Sources */,
CA1873BD2049F7070079CA09 /* NSMutableDictionary+OneSignal.m in Sources */,
1AF75EAE1E8567FD0097B315 /* NSString+OneSignal.m in Sources */,
454F94F51FAD2E5A00D74CCF /* OSNotificationPayload.m in Sources */,
9129C6BE1E89E7AB009CB6A0 /* OSSubscription.m in Sources */,
Expand All @@ -741,6 +759,7 @@
91F58D841E7C88220017D24D /* OneSignalNotificationSettingsIOS10.m in Sources */,
9129C6B91E89E59B009CB6A0 /* OSPermission.m in Sources */,
912412131E73342200E41FD7 /* OneSignalAlertViewDelegate.m in Sources */,
CA97E1502051C0A5003B8CB8 /* OneSignalWebOpenDialog.m in Sources */,
0338566B1FBBD2270002F7C1 /* OSNotificationPayload.m in Sources */,
912412431E73342200E41FD7 /* UNUserNotificationCenter+OneSignal.m in Sources */,
9124123B1E73342200E41FD7 /* OneSignalWebView.m in Sources */,
Expand All @@ -753,6 +772,7 @@
CA810FD2202BA97600A60FED /* OSEmailSubscription.m in Sources */,
CA63AFC42022670A00E340FB /* ReattemptRequest.m in Sources */,
91F58D8A1E7C9A240017D24D /* OneSignalNotificationSettingsIOS7.m in Sources */,
CA1873BF2049FB4F0079CA09 /* NSMutableDictionary+OneSignal.m in Sources */,
912412231E73342200E41FD7 /* OneSignalLocation.m in Sources */,
1AF75EB01E8569720097B315 /* NSString+OneSignal.m in Sources */,
9129C6BF1E89E7AB009CB6A0 /* OSSubscription.m in Sources */,
Expand Down Expand Up @@ -797,6 +817,8 @@
1AF75EAF1E8569710097B315 /* NSString+OneSignal.m in Sources */,
4529DEE71FA82CDC00CEAB1D /* UNUserNotificationCenterOverrider.m in Sources */,
4529DEDB1FA8284E00CEAB1D /* NSDataOverrider.m in Sources */,
CA97E1512051C0A5003B8CB8 /* OneSignalWebOpenDialog.m in Sources */,
CA1873C02049FB540079CA09 /* NSMutableDictionary+OneSignal.m in Sources */,
4529DEF31FA8440A00CEAB1D /* UIAlertViewOverrider.m in Sources */,
4529DEEA1FA8360C00CEAB1D /* UIApplicationOverrider.m in Sources */,
912412281E73342200E41FD7 /* OneSignalMobileProvision.m in Sources */,
Expand Down
32 changes: 32 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/NSMutableDictionary+OneSignal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Modified MIT License
*
* Copyright 2018 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.
*/

#import <Foundation/Foundation.h>

@interface NSMutableDictionary (OneSignal)
- (void)convertDatesToISO8061Strings;
@end
48 changes: 48 additions & 0 deletions iOS_SDK/OneSignalSDK/Source/NSMutableDictionary+OneSignal.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Modified MIT License
*
* Copyright 2018 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.
*/

#import "NSMutableDictionary+OneSignal.h"

@implementation NSMutableDictionary (OneSignal)

//NSJSONSerialization will not handle NSDates
//this method converts any occurrences of NSDate into an ISO8061 compliant string

- (void)convertDatesToISO8061Strings {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:enUSPOSIXLocale];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZZZ"];

for (NSString *key in self.allKeys) {
id value = self[key];

if ([value isKindOfClass:[NSDate class]])
self[key] = [dateFormatter stringFromDate:(NSDate *)value];
}
}
@end
6 changes: 5 additions & 1 deletion iOS_SDK/OneSignalSDK/Source/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ typedef NS_ENUM(NSInteger, OSNotificationPermission) {
@end


typedef void (^OSWebOpenURLResultBlock)(BOOL shouldOpen);

typedef void (^OSResultSuccessBlock)(NSDictionary* result);
typedef void (^OSFailureBlock)(NSError* error);
Expand All @@ -306,6 +307,9 @@ extern NSString * const kOSSettingsKeyInAppAlerts;
/*Enable In-App display of Launch URLs*/
extern NSString * const kOSSettingsKeyInAppLaunchURL;

/*Prompt user yes/no to open URL's from push notifications*/
extern NSString * const kOSSSettingsKeyPromptBeforeOpeningPushURL;

/* iOS10 +
Set notification's in-focus display option.
Value must be an OSNotificationDisplayType enum
Expand Down Expand Up @@ -364,7 +368,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)deleteTagsWithJsonString:(NSString*)jsonString;
// 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.
// Sends as MD5 and SHA1 of the provided email
+ (void)syncHashedEmail:(NSString*)email;
+ (void)syncHashedEmail:(NSString*)email __deprecated_msg("Please refer to our new Email methods/functionality such as setEmail(). This method will be removed in a future version of the OneSignal SDK");

// - Subscription and Permissions
+ (void)IdsAvailable:(OSIdsAvailableBlock)idsAvailableBlock __deprecated_msg("Please use getPermissionSubscriptionState or addSubscriptionObserver and addPermissionObserver instead.");
Expand Down
Loading