Skip to content

Commit

Permalink
Updated to last native SDKs. Android 2.2.0 and iOS 1.13.0
Browse files Browse the repository at this point in the history
* Adds automatic badge count support for Android launchers.
* Adds support for geotagging to iOS.
* Added SetEmail.
  • Loading branch information
jkasten2 committed Apr 1, 2016
1 parent 69d97bd commit 70929fa
Show file tree
Hide file tree
Showing 32 changed files with 286 additions and 125 deletions.
24 changes: 23 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,26 @@ Includes portions from BSMobileProvision:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
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.
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.
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.

Includes ShortcutBadger:
Unless required by applicable law or agreed to in writing, software
distributed under these Licenses is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See each License for the specific language governing permissions and
limitations under that License.


Copyright 2014 Leo Lin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Binary file modified Unity4.6-4.7OneSignalSDK.unitypackage
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,23 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

<!-- START: ShortcutBadger -->
<!--for Samsung-->
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/>
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>

<!--for htc-->
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/>
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT"/>

<!--for sony-->
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/>

<!--for apex-->
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT"/>

<!--for solid-->
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>
<!-- End: ShortcutBadger -->
</manifest>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Android Setup
=====================

1. Open AndroidManifest.xml and follow the update insturctions.
1. Open Plugins/Android/OneSignalConfig/AndroidManifest.xml and follow the insturctions.
2. Replace the example small notification icons in the res folder with your own with by follwing the insturctions below.
- https://documentation.onesignal.com/docs/android-notification-customizations#small-notification-icon
3. The large notification icon is option, rmeove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.
3. The large notification icon is optional, remove or replace res/drawable-xxhdpi-v11/ic_onesignal_large_icon_default.png.
20 changes: 16 additions & 4 deletions Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignal.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -246,10 +246,22 @@ public static void PostNotification(Dictionary<string, object> data, OnPostNotif
oneSignalPlatform.PostNotification(data);
#endif
}

public static void SetEmail(string email) {
#if ONESIGNAL_PLATFORM
oneSignalPlatform.SetEmail(email);
#endif
}

public void PromptLocation() {
#if ONESIGNAL_PLATFORM
oneSignalPlatform.PromptLocation();
#endif
}


/*** protected and private methods ****/
#if ONESIGNAL_PLATFORM
/*** protected and private methods ****/
#if ONESIGNAL_PLATFORM
// Called from the native SDK - Called when a push notification is open or app is running when one comes in.
private void onPushNotificationReceived(string jsonString) {
if (notificationDelegate != null)
Expand Down Expand Up @@ -289,5 +301,5 @@ private void onPostNotificationFailed(string response) {
tempPostNotificationFailureDelegate(Json.Deserialize(response) as Dictionary<string, object>);
}
}
#endif
#endif
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -100,5 +100,11 @@ public void SetSubscription(bool enable) {
public void PostNotification(Dictionary<string, object> data) {
mOneSignal.Call("postNotification", Json.Serialize(data));
}

public void SetEmail(string email) { }

public void PromptLocation() {
mOneSignal.Call("promptLocation");
}
}
#endif
21 changes: 18 additions & 3 deletions Unity4.6OneSignalExample/Assets/Plugins/OneSignal/OneSignalIOS.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -66,7 +66,13 @@ public class OneSignalIOS : OneSignalPlatform {
[System.Runtime.InteropServices.DllImport("__Internal")]
extern static public void _postNotification(string json);

[System.Runtime.InteropServices.DllImport("__Internal")]
[System.Runtime.InteropServices.DllImport("__Internal")]
extern static public void _setEmail(string email);

[System.Runtime.InteropServices.DllImport("__Internal")]
extern static public void _promptLocation();

[System.Runtime.InteropServices.DllImport("__Internal")]
extern static public void _setLogLevel(int logLevel, int visualLogLevel);


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

public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {

public void SetEmail(string email) {
_setEmail(email);
}

public void PromptLocation() {
_promptLocation();
}

public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {
var dict = Json.Deserialize(jsonString) as Dictionary<string, object>;

string message = (string)(dict["alertMessage"]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -30,16 +30,18 @@
// Shared interface so OneSignal.cs can use each mobile platform in a generic way
public interface OneSignalPlatform {
void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel);
void RegisterForPushNotifications();
void SendTag(string tagName, string tagValue);
void SendTags(IDictionary<string, string> tags);
void GetTags();
void DeleteTag(string key);
void DeleteTags(IList<string> keys);
void IdsAvailable();
void EnableInAppAlertNotification(bool enable);
void SetSubscription(bool enable);
void PostNotification(Dictionary<string, object> data);
void RegisterForPushNotifications();
void SendTag(string tagName, string tagValue);
void SendTags(IDictionary<string, string> tags);
void GetTags();
void DeleteTag(string key);
void DeleteTags(IList<string> keys);
void IdsAvailable();
void EnableInAppAlertNotification(bool enable);
void SetSubscription(bool enable);
void PostNotification(Dictionary<string, object> data);
void SetEmail(string email);
void PromptLocation();

void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived);
void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -90,6 +90,9 @@ public void FireNotificationReceivedEvent(string jsonString, OneSignal.Notificat

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

public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {} // The Native SDK does not implement this.
// The Native SDK does not implement these.
public void SetEmail(string email) { }
public void PromptLocation() { }
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -90,7 +90,10 @@ public void PostNotification(Dictionary<string, object> data) { }
public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {}

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

public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {} // The Native SDK does not implement this.

// The Native SDK does not implement these.
public void SetEmail(string email) { }
public void PromptLocation() { }
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {}
}
#endif
2 changes: 1 addition & 1 deletion Unity4.6OneSignalExample/Assets/Plugins/OneSignal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.13.1
1.14.0
11 changes: 9 additions & 2 deletions Unity4.6OneSignalExample/Assets/Plugins/iOS/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#import <Foundation/Foundation.h>
#import <objc/runtime.h>

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

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

extern NSString* const VERSION;
extern NSString* const ONESIGNAL_VERSION;

typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
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
Expand All @@ -61,10 +60,14 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {

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

- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;

- (id)initWithLaunchOptions:(NSDictionary*)launchOptions handleNotification:(OneSignalHandleNotificationBlock)callback;

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

- (id)initWithLaunchOptions:(NSDictionary*)launchOptions handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;

- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;

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

- (void)setEmail:(NSString*)email;

- (void)getTags:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
- (void)getTags:(OneSignalResultSuccessBlock)successBlock;

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

- (void)promptLocation;

@end

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -198,6 +198,14 @@ void _postNotification(const char* jsonData) {

}

void _setEmail(const char* email) {
[oneSignal setEmail:email];
}

void _promptLocation() {
[oneSignal promptLocation];
}

void _setLogLevel(int logLevel, int visualLogLevel) {
[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];
}
Expand Down
Binary file modified Unity4.6OneSignalExample/Assets/Plugins/iOS/libOneSignal.a
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#import <Foundation/Foundation.h>
#import <objc/runtime.h>

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

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

- (id)initWithLaunchOptions:(NSDictionary*)launchOptions handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;

- (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotification:(OneSignalHandleNotificationBlock)callback autoRegister:(BOOL)autoRegister;

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

- (void)setEmail:(NSString*)email;

- (void)getTags:(OneSignalResultSuccessBlock)successBlock onFailure:(OneSignalFailureBlock)failureBlock;
- (void)getTags:(OneSignalResultSuccessBlock)successBlock;

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

- (void)promptLocation;

@end

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Modified MIT License
*
* Copyright 2015 OneSignal
* Copyright 2016 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
Expand Down Expand Up @@ -198,6 +198,14 @@ void _postNotification(const char* jsonData) {

}

void _setEmail(const char* email) {
[oneSignal setEmail:email];
}

void _promptLocation() {
[oneSignal promptLocation];
}

void _setLogLevel(int logLevel, int visualLogLevel) {
[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];
}
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Unity5OneSignalExample/Assets/OneSignal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.13.2
1.14.0
Loading

0 comments on commit 70929fa

Please sign in to comment.