Skip to content

Commit 4023fe2

Browse files
committed
Added enableInAppAlertNotification, setSubscription, and postNotification
* Calling enableInAppAlertNotification with true will enable notifications to be displayed as alerts when one is received when the user is in your app. * Calling setSubscription with false will unsubscribe the user from receiving push notifications. * postNotification lets you create user to user notifications and schedule future notifications without have to make calls to the REST API yourself. * Added more logging to help debug issues.
1 parent 1e97b36 commit 4023fe2

File tree

11 files changed

+370
-22
lines changed

11 files changed

+370
-22
lines changed

LICENSE

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Modified MIT License
22

3-
Copyright 2014 GameThrive
3+
Copyright 2015 OneSignal
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -13,7 +13,7 @@ furnished to do so, subject to the following conditions:
1313
all copies or substantial portions of the Software.
1414

1515
2. All copies of substantial portions of the Software may only be used in connection
16-
with services provided by GameThrive.
16+
with services provided by OneSignal.
1717

1818
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1919
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -62,3 +62,13 @@ Includes portions from DTTJailbreakDetection:
6262
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
6363
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
6464
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65+
66+
Includes portions from BSMobileProvision:
67+
Copyright (c) 2013, The Blindsight Corporation
68+
All rights reserved.
69+
70+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
71+
72+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
73+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
74+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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 = "1.8.0"
3+
s.version = "1.9.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/Framework/OneSignal.framework/Versions/A/Headers/OneSignal.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
typedef void (^OneSignalResultSuccessBlock)(NSDictionary* result);
2525
typedef void (^OneSignalFailureBlock)(NSError* error);
26-
typedef void (^OneSignalIdsAvailableBlock)(NSString* playerId, NSString* pushToken);
26+
typedef void (^OneSignalIdsAvailableBlock)(NSString* userId, NSString* pushToken);
2727
typedef void (^OneSignalHandleNotificationBlock)(NSString* message, NSDictionary* additionalData, BOOL isActive);
2828

2929
/**
@@ -94,5 +94,12 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
9494

9595
- (void)IdsAvailable:(OneSignalIdsAvailableBlock)idsAvailableBlock;
9696

97+
- (void)enableInAppAlertNotification:(BOOL)enable;
98+
- (void)setSubscription:(BOOL)enable;
99+
100+
- (void)postNotification:(NSDictionary*)jsonData;
101+
- (void)postNotification:(NSDictionary*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
102+
- (void)postNotificationWithJsonString:(NSString*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
103+
97104
@end
98105

126 KB
Binary file not shown.

iOS_SDK/OneSignal.xcodeproj/project.pbxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
3724485819F6D1DE00573B5A /* OneSignalJailbreakDetection.m in Sources */ = {isa = PBXBuildFile; fileRef = 3724485719F6D1DE00573B5A /* OneSignalJailbreakDetection.m */; };
2727
37668EE91AA80B7E0095D813 /* OneSignalReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 37668EE81AA80B7E0095D813 /* OneSignalReachability.m */; };
2828
37747FC51914837300558FAD /* OneSignalHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 37747FBD1914837300558FAD /* OneSignalHTTPClient.m */; };
29+
37D6E07F1B1EAE6500EC3624 /* OneSignalMobileProvision.m in Sources */ = {isa = PBXBuildFile; fileRef = 37D6E07D1B1EAE6500EC3624 /* OneSignalMobileProvision.m */; };
2930
37E277051ACB940000D49C8D /* OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = 37E277031ACB940000D49C8D /* OneSignal.m */; };
3031
37E277261ACBB58D00D49C8D /* GameThrive.m in Sources */ = {isa = PBXBuildFile; fileRef = 37E277251ACBB58D00D49C8D /* GameThrive.m */; };
3132
37E277281ACCA5B300D49C8D /* GameThrive.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 37E277241ACBB58D00D49C8D /* GameThrive.h */; };
@@ -67,6 +68,8 @@
6768
37747FBC1914837300558FAD /* OneSignalHTTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OneSignalHTTPClient.h; sourceTree = "<group>"; };
6869
37747FBD1914837300558FAD /* OneSignalHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OneSignalHTTPClient.m; sourceTree = "<group>"; };
6970
378699FC1919B5FB00C3E7DA /* OneSignal-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OneSignal-Prefix.pch"; sourceTree = "<group>"; };
71+
37D6E07C1B1EAE6500EC3624 /* OneSignalMobileProvision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OneSignalMobileProvision.h; sourceTree = "<group>"; };
72+
37D6E07D1B1EAE6500EC3624 /* OneSignalMobileProvision.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OneSignalMobileProvision.m; sourceTree = "<group>"; };
7073
37E277031ACB940000D49C8D /* OneSignal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OneSignal.m; sourceTree = "<group>"; };
7174
37E277041ACB940000D49C8D /* OneSignal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OneSignal.h; sourceTree = "<group>"; };
7275
37E277241ACBB58D00D49C8D /* GameThrive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameThrive.h; sourceTree = "<group>"; };
@@ -108,6 +111,7 @@
108111
37747F8A19147D6400558FAD = {
109112
isa = PBXGroup;
110113
children = (
114+
37D6E07B1B1EAE6500EC3624 /* OneSignalMobileProvision */,
111115
37E277231ACBB58D00D49C8D /* GameThrive */,
112116
37668EE31AA80A560095D813 /* OneSignalReachability */,
113117
3724485519F61C3D00573B5A /* OneSignalJailbreakDetection */,
@@ -147,6 +151,15 @@
147151
path = OneSignal;
148152
sourceTree = "<group>";
149153
};
154+
37D6E07B1B1EAE6500EC3624 /* OneSignalMobileProvision */ = {
155+
isa = PBXGroup;
156+
children = (
157+
37D6E07C1B1EAE6500EC3624 /* OneSignalMobileProvision.h */,
158+
37D6E07D1B1EAE6500EC3624 /* OneSignalMobileProvision.m */,
159+
);
160+
path = OneSignalMobileProvision;
161+
sourceTree = "<group>";
162+
};
150163
37E277231ACBB58D00D49C8D /* GameThrive */ = {
151164
isa = PBXGroup;
152165
children = (
@@ -229,6 +242,7 @@
229242
371FDED919F1A486001479B7 /* OneSignalTrackIAP.m in Sources */,
230243
3724485819F6D1DE00573B5A /* OneSignalJailbreakDetection.m in Sources */,
231244
37747FC51914837300558FAD /* OneSignalHTTPClient.m in Sources */,
245+
37D6E07F1B1EAE6500EC3624 /* OneSignalMobileProvision.m in Sources */,
232246
37668EE91AA80B7E0095D813 /* OneSignalReachability.m in Sources */,
233247
37E277051ACB940000D49C8D /* OneSignal.m in Sources */,
234248
);

iOS_SDK/OneSignal.xcodeproj/project.xcworkspace/xcshareddata/OneSignal.xccheckout

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<key>IDESourceControlProjectIdentifier</key>
88
<string>82DF9B41-8B65-40E7-832A-C61D19DFA081</string>
99
<key>IDESourceControlProjectName</key>
10-
<string>OneSignal</string>
10+
<string>project</string>
1111
<key>IDESourceControlProjectOriginsDictionary</key>
1212
<dict>
1313
<key>5A4AFF41A71B5F8D4741699EC46766398BC4FE44</key>
1414
<string>https://github.com/Hiptic/GameThrive</string>
1515
</dict>
1616
<key>IDESourceControlProjectPath</key>
17-
<string>SDK/iOS/iOS_SDK/OneSignal.xcodeproj</string>
17+
<string>SDK/iOS/iOS_SDK/OneSignal.xcodeproj/project.xcworkspace</string>
1818
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
1919
<dict>
2020
<key>5A4AFF41A71B5F8D4741699EC46766398BC4FE44</key>

iOS_SDK/OneSignal/OneSignal.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
typedef void (^OneSignalResultSuccessBlock)(NSDictionary* result);
2525
typedef void (^OneSignalFailureBlock)(NSError* error);
26-
typedef void (^OneSignalIdsAvailableBlock)(NSString* playerId, NSString* pushToken);
26+
typedef void (^OneSignalIdsAvailableBlock)(NSString* userId, NSString* pushToken);
2727
typedef void (^OneSignalHandleNotificationBlock)(NSString* message, NSDictionary* additionalData, BOOL isActive);
2828

2929
/**
@@ -94,5 +94,12 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
9494

9595
- (void)IdsAvailable:(OneSignalIdsAvailableBlock)idsAvailableBlock;
9696

97+
- (void)enableInAppAlertNotification:(BOOL)enable;
98+
- (void)setSubscription:(BOOL)enable;
99+
100+
- (void)postNotification:(NSDictionary*)jsonData;
101+
- (void)postNotification:(NSDictionary*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
102+
- (void)postNotificationWithJsonString:(NSString*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
103+
97104
@end
98105

0 commit comments

Comments
 (0)