Skip to content

Commit 70929fa

Browse files
committed
Updated to last native SDKs. Android 2.2.0 and iOS 1.13.0
* Adds automatic badge count support for Android launchers. * Adds support for geotagging to iOS. * Added SetEmail.
1 parent 69d97bd commit 70929fa

32 files changed

+286
-125
lines changed

LICENSE

+23-1
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,26 @@ Includes portions from BSMobileProvision:
120120

121121
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
122122
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.
123-
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.
123+
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.
124+
125+
Includes ShortcutBadger:
126+
Unless required by applicable law or agreed to in writing, software
127+
distributed under these Licenses is distributed on an "AS IS" BASIS,
128+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129+
See each License for the specific language governing permissions and
130+
limitations under that License.
131+
132+
133+
Copyright 2014 Leo Lin
134+
135+
Licensed under the Apache License, Version 2.0 (the "License");
136+
you may not use this file except in compliance with the License.
137+
You may obtain a copy of the License at
138+
139+
http://www.apache.org/licenses/LICENSE-2.0
140+
141+
Unless required by applicable law or agreed to in writing, software
142+
distributed under the License is distributed on an "AS IS" BASIS,
143+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
144+
See the License for the specific language governing permissions and
145+
limitations under the License.

Unity4.6-4.7OneSignalSDK.unitypackage

143 KB
Binary file not shown.

Unity4.6OneSignalExample/Assets/Plugins/Android/OneSignal/AndroidManifest.xml

+19
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,23 @@
1818
<uses-permission android:name="android.permission.VIBRATE" />
1919
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2020
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
21+
22+
<!-- START: ShortcutBadger -->
23+
<!--for Samsung-->
24+
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/>
25+
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>
26+
27+
<!--for htc-->
28+
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/>
29+
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT"/>
30+
31+
<!--for sony-->
32+
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/>
33+
34+
<!--for apex-->
35+
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT"/>
36+
37+
<!--for solid-->
38+
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>
39+
<!-- End: ShortcutBadger -->
2140
</manifest>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Android Setup
22
=====================
33

4-
1. Open AndroidManifest.xml and follow the update insturctions.
4+
1. Open Plugins/Android/OneSignalConfig/AndroidManifest.xml and follow the insturctions.
55
2. Replace the example small notification icons in the res folder with your own with by follwing the insturctions below.
66
- https://documentation.onesignal.com/docs/android-notification-customizations#small-notification-icon
7-
3. The large notification icon is option, rmeove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.
7+
3. The large notification icon is optional, remove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignal.cs

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -246,10 +246,22 @@ public static void PostNotification(Dictionary<string, object> data, OnPostNotif
246246
oneSignalPlatform.PostNotification(data);
247247
#endif
248248
}
249+
250+
public static void SetEmail(string email) {
251+
#if ONESIGNAL_PLATFORM
252+
oneSignalPlatform.SetEmail(email);
253+
#endif
254+
}
255+
256+
public void PromptLocation() {
257+
#if ONESIGNAL_PLATFORM
258+
oneSignalPlatform.PromptLocation();
259+
#endif
260+
}
249261

250262

251-
/*** protected and private methods ****/
252-
#if ONESIGNAL_PLATFORM
263+
/*** protected and private methods ****/
264+
#if ONESIGNAL_PLATFORM
253265
// Called from the native SDK - Called when a push notification is open or app is running when one comes in.
254266
private void onPushNotificationReceived(string jsonString) {
255267
if (notificationDelegate != null)
@@ -289,5 +301,5 @@ private void onPostNotificationFailed(string response) {
289301
tempPostNotificationFailureDelegate(Json.Deserialize(response) as Dictionary<string, object>);
290302
}
291303
}
292-
#endif
304+
#endif
293305
}

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignalAndroid.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -100,5 +100,11 @@ public void SetSubscription(bool enable) {
100100
public void PostNotification(Dictionary<string, object> data) {
101101
mOneSignal.Call("postNotification", Json.Serialize(data));
102102
}
103+
104+
public void SetEmail(string email) { }
105+
106+
public void PromptLocation() {
107+
mOneSignal.Call("promptLocation");
108+
}
103109
}
104110
#endif

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignalIOS.cs

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -66,7 +66,13 @@ public class OneSignalIOS : OneSignalPlatform {
6666
[System.Runtime.InteropServices.DllImport("__Internal")]
6767
extern static public void _postNotification(string json);
6868

69-
[System.Runtime.InteropServices.DllImport("__Internal")]
69+
[System.Runtime.InteropServices.DllImport("__Internal")]
70+
extern static public void _setEmail(string email);
71+
72+
[System.Runtime.InteropServices.DllImport("__Internal")]
73+
extern static public void _promptLocation();
74+
75+
[System.Runtime.InteropServices.DllImport("__Internal")]
7076
extern static public void _setLogLevel(int logLevel, int visualLogLevel);
7177

7278

@@ -114,7 +120,16 @@ public void PostNotification(Dictionary<string, object> data) {
114120
_postNotification(Json.Serialize(data));
115121
}
116122

117-
public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {
123+
124+
public void SetEmail(string email) {
125+
_setEmail(email);
126+
}
127+
128+
public void PromptLocation() {
129+
_promptLocation();
130+
}
131+
132+
public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {
118133
var dict = Json.Deserialize(jsonString) as Dictionary<string, object>;
119134

120135
string message = (string)(dict["alertMessage"]);

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignalPlatform.cs

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -30,16 +30,18 @@
3030
// Shared interface so OneSignal.cs can use each mobile platform in a generic way
3131
public interface OneSignalPlatform {
3232
void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel);
33-
void RegisterForPushNotifications();
34-
void SendTag(string tagName, string tagValue);
35-
void SendTags(IDictionary<string, string> tags);
36-
void GetTags();
37-
void DeleteTag(string key);
38-
void DeleteTags(IList<string> keys);
39-
void IdsAvailable();
40-
void EnableInAppAlertNotification(bool enable);
41-
void SetSubscription(bool enable);
42-
void PostNotification(Dictionary<string, object> data);
33+
void RegisterForPushNotifications();
34+
void SendTag(string tagName, string tagValue);
35+
void SendTags(IDictionary<string, string> tags);
36+
void GetTags();
37+
void DeleteTag(string key);
38+
void DeleteTags(IList<string> keys);
39+
void IdsAvailable();
40+
void EnableInAppAlertNotification(bool enable);
41+
void SetSubscription(bool enable);
42+
void PostNotification(Dictionary<string, object> data);
43+
void SetEmail(string email);
44+
void PromptLocation();
4345

44-
void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived);
46+
void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived);
4547
}

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignalWP80.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -90,6 +90,9 @@ public void FireNotificationReceivedEvent(string jsonString, OneSignal.Notificat
9090

9191
public void RegisterForPushNotifications() { } // Doesn't apply to Windows Phone: The Native SDK always registers.
9292

93-
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {} // The Native SDK does not implement this.
93+
// The Native SDK does not implement these.
94+
public void SetEmail(string email) { }
95+
public void PromptLocation() { }
96+
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {}
9497
}
9598
#endif

Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignalWPWNS.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -90,7 +90,10 @@ public void PostNotification(Dictionary<string, object> data) { }
9090
public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {}
9191

9292
public void RegisterForPushNotifications() { } // Doesn't apply to Windows Phone: The Native SDK always registers.
93-
94-
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {} // The Native SDK does not implement this.
93+
94+
// The Native SDK does not implement these.
95+
public void SetEmail(string email) { }
96+
public void PromptLocation() { }
97+
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {}
9598
}
9699
#endif
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.13.1
1+
1.14.0

Unity4.6OneSignalExample/Assets/Plugins/iOS/OneSignal.h

+9-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020

2121
#import <Foundation/Foundation.h>
22-
#import <objc/runtime.h>
2322

2423
typedef void (^OneSignalResultSuccessBlock)(NSDictionary* result);
2524
typedef void (^OneSignalFailureBlock)(NSError* error);
@@ -42,7 +41,7 @@ typedef void (^OneSignalHandleNotificationBlock)(NSString* message, NSDictionary
4241

4342
@property(nonatomic, readonly, copy) NSString* app_id;
4443

45-
extern NSString* const VERSION;
44+
extern NSString* const ONESIGNAL_VERSION;
4645

4746
typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
4847
ONE_S_LL_NONE, ONE_S_LL_FATAL, ONE_S_LL_ERROR, ONE_S_LL_WARN, ONE_S_LL_INFO, ONE_S_LL_DEBUG, ONE_S_LL_VERBOSE
@@ -61,10 +60,14 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
6160

6261
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions autoRegister:(BOOL)autoRegister;
6362

63+
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;
64+
6465
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions handleNotification:(OneSignalHandleNotificationBlock)callback;
6566

6667
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotification:(OneSignalHandleNotificationBlock)callback;
6768

69+
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;
70+
6871
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;
6972

7073
// Only use if you passed FALSE to autoRegister
@@ -82,6 +85,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
8285
- (void)sendTags:(NSDictionary*)keyValuePair;
8386
- (void)sendTagsWithJsonString:(NSString*)jsonString;
8487

88+
- (void)setEmail:(NSString*)email;
89+
8590
- (void)getTags:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
8691
- (void)getTags:(OneSignalResultSuccessBlock)successBlock;
8792

@@ -101,5 +106,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
101106
- (void)postNotification:(NSDictionary*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
102107
- (void)postNotificationWithJsonString:(NSString*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
103108

109+
- (void)promptLocation;
110+
104111
@end
105112

Unity4.6OneSignalExample/Assets/Plugins/iOS/OneSignalUnityRuntime.m

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -198,6 +198,14 @@ void _postNotification(const char* jsonData) {
198198

199199
}
200200

201+
void _setEmail(const char* email) {
202+
[oneSignal setEmail:email];
203+
}
204+
205+
void _promptLocation() {
206+
[oneSignal promptLocation];
207+
}
208+
201209
void _setLogLevel(int logLevel, int visualLogLevel) {
202210
[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];
203211
}
Binary file not shown.
Binary file not shown.

Unity5OneSignalExample/Assets/OneSignal/Platforms/iOS/OneSignal.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
*/
2020

2121
#import <Foundation/Foundation.h>
22-
#import <objc/runtime.h>
2322

2423
typedef void (^OneSignalResultSuccessBlock)(NSDictionary* result);
2524
typedef void (^OneSignalFailureBlock)(NSError* error);
@@ -67,6 +66,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
6766

6867
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotification:(OneSignalHandleNotificationBlock)callback;
6968

69+
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;
70+
7071
- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;
7172

7273
// Only use if you passed FALSE to autoRegister
@@ -84,6 +85,8 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
8485
- (void)sendTags:(NSDictionary*)keyValuePair;
8586
- (void)sendTagsWithJsonString:(NSString*)jsonString;
8687

88+
- (void)setEmail:(NSString*)email;
89+
8790
- (void)getTags:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
8891
- (void)getTags:(OneSignalResultSuccessBlock)successBlock;
8992

@@ -103,5 +106,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
103106
- (void)postNotification:(NSDictionary*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
104107
- (void)postNotificationWithJsonString:(NSString*)jsonData onSuccess:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
105108

109+
- (void)promptLocation;
110+
106111
@end
107112

Unity5OneSignalExample/Assets/OneSignal/Platforms/iOS/OneSignalUnityRuntime.m

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -198,6 +198,14 @@ void _postNotification(const char* jsonData) {
198198

199199
}
200200

201+
void _setEmail(const char* email) {
202+
[oneSignal setEmail:email];
203+
}
204+
205+
void _promptLocation() {
206+
[oneSignal promptLocation];
207+
}
208+
201209
void _setLogLevel(int logLevel, int visualLogLevel) {
202210
[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];
203211
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.13.2
1+
1.14.0

0 commit comments

Comments
 (0)