Skip to content

Commit 26002a8

Browse files
authored
Merge pull request #435 from Nightsd01/master
Release 3.1.3 • Updates to the latest version of the iOS SDK (Android SDK updates are automatically distributed via gradle) • Adds a new badge handling system in iOS which uses the OneSignalNotificationServiceExtension to perform badge handling logic instead of relying on the backend server • Removes podfiles which are no longer used to distribute the iOS SDK
2 parents af2d158 + 2d94cfe commit 26002a8

File tree

10 files changed

+55
-42
lines changed

10 files changed

+55
-42
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau
230230

231231
</p></details>
232232

233+
### Add App Groups (Optional but Recommended)
234+
In order for your application to be able to let push notifications increment/decrement the badge count, you need to set up an **App Group** for your application.
233235

236+
Please follow [this guide](https://documentation.onesignal.com/docs/ios-sdk-app-groups-setup) to set up a OneSignal app group in your app.
234237

235238
### Add Notification Service Extension
236239
This step is optional but highly recommended. The `OneSignalNotificationServiceExtension` allows your application (in iOS) to receive rich notifications with images and/or buttons. If you do not follow this step, your application will not be able to show images in push notifications, and won't be able to add action buttons to notifications either.
@@ -784,6 +787,9 @@ compile(project(':react-native-maps')){
784787

785788
If you have detached from Expo or CRNA, you might need to change the versions of Google Play Services that this library is using to make it work nicely with ExpoKit (as of SDK23). See [this issue](https://github.com/geektimecoil/react-native-onesignal/issues/301#issuecomment-327346705).
786789

790+
### Issue 6 - More than One Library with GMS License Package Name
791+
792+
787793
### Manually updating iOS OneSignalNativeSDK
788794
When you install `react-native-onesignal` it will automaticly include a specific version of the OneSignal iOS native SDK that is known to work with it. Only follow the instructions below if there is a native OneSignal SDK fix you need that isn't included already in the latest `react-native-onesignal` update.
789795

@@ -795,9 +801,22 @@ When you install `react-native-onesignal` it will automaticly include a specific
795801
6. Drop and drag this new `OneSignalNativeSDK` folder under the `RCTOneSignal.xcodeproj` in Xccode.
796802
7. Select "Create groups" and check RCTOneSignal and press Finish.
797803

804+
Please see the `examples/RNOneSignal/redux-index.js` file for example code and comments. Note that it will not compile, but instead serves as a template for how to handle Redux integration in general, and specifically including the edge case for intercepting the `onOpened` event when a User taps a push notification and prompts the app to open from a previously unopened state.
805+
806+
798807
### Issue 6 - Make `react-native-onesignal` work with Redux
808+
If you see this error:
799809

800-
Please see the `examples/RNOneSignal/redux-index.js` file for example code and comments. Note that it will not compile, but instead serves as a template for how to handle Redux integration in general, and specifically including the edge case for intercepting the `onOpened` event when a User taps a push notification and prompts the app to open from a previously unopened state.
810+
`Error: more than one library with package name 'com.google.android.gms.license'`
811+
812+
You can resolve it by adding this code to the top of your app's `build.gradle` file:
813+
814+
```
815+
plugins {
816+
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
817+
}
818+
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
819+
```
801820

802821
## CREDITS
803822
Thanks for all the awesome fellows that contributed to this repository!

android/build.gradle

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,31 @@ buildscript {
22
repositories {
33
jcenter()
44
mavenCentral()
5+
maven { url 'https://maven.google.com' }
56
}
67

78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
910
}
1011
}
1112

1213
apply plugin: 'com.android.library'
1314

1415
android {
15-
compileSdkVersion 23
16-
buildToolsVersion "25.0.0"
16+
compileSdkVersion 27
17+
buildToolsVersion '27.0.3'
1718

1819
defaultConfig {
1920
minSdkVersion 16
20-
targetSdkVersion 22
2121
versionCode 1
22-
versionName "1.0"
22+
versionName '1.0'
2323
// Do not set onesignal_app_id here, it will be set in the app project.
2424
// Leave onesignal_google_project_number as it is now pulled from the dashboard.
2525
manifestPlaceholders = [onesignal_app_id: "",
2626
onesignal_google_project_number: "REMOTE"]
2727
}
2828
buildTypes {
2929
release {
30-
minifyEnabled false
3130
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
3231
}
3332
}
@@ -36,9 +35,18 @@ android {
3635
dependencies {
3736
compile fileTree(include: ['*.jar'], dir: 'libs')
3837
compile 'com.facebook.react:react-native:+'
39-
compile 'com.google.android.gms:play-services-gcm:+'
40-
compile 'com.google.android.gms:play-services-analytics:+'
41-
compile 'com.google.android.gms:play-services-location:+'
4238
testCompile 'junit:junit:4.12'
43-
compile 'com.onesignal:OneSignal:3.+@aar'
39+
compile 'com.onesignal:OneSignal:3.+'
4440
}
41+
42+
// Add the following to the top (Line 1) of your app/build.gradle if you run into any issues with duplicate classes.
43+
// Such as the following error
44+
// Error: more than one library with package name 'com.google.android.gms.license'
45+
/*
46+
47+
plugins {
48+
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
49+
}
50+
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
51+
52+
*/

examples/RNOneSignal/android/app/build.gradle

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
plugins {
2+
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
3+
}
4+
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
5+
16
apply plugin: "com.android.application"
27

38
import com.android.build.OutputFile
@@ -83,19 +88,19 @@ def enableSeparateBuildPerCPUArchitecture = false
8388
def enableProguardInReleaseBuilds = false
8489

8590
android {
86-
compileSdkVersion 23
87-
buildToolsVersion "23.0.1"
91+
compileSdkVersion 27
92+
buildToolsVersion "27.0.3"
8893

8994
defaultConfig {
9095
applicationId "com.rnonesignal"
9196
minSdkVersion 16
92-
targetSdkVersion 22
97+
targetSdkVersion 25
9398
versionCode 1
9499
versionName "1.0"
95100
ndk {
96101
abiFilters "armeabi-v7a", "x86"
97102
}
98-
manifestPlaceholders = [onesignal_app_id: "73a522ac-dc37-45f1-9d67-2791f3247179",
103+
manifestPlaceholders = [onesignal_app_id: "78e8aff3-7ce2-401f-9da0-2d41f287ebaf",
99104
onesignal_google_project_number: "REMOTE"]
100105
}
101106
splits {
@@ -130,7 +135,7 @@ android {
130135
dependencies {
131136
compile project(':react-native-onesignal')
132137
compile fileTree(dir: "libs", include: ["*.jar"])
133-
compile "com.android.support:appcompat-v7:23.0.1"
138+
compile "com.android.support:appcompat-v7:27.1.0"
134139
compile "com.facebook.react:react-native:+" // From node_modules
135140
}
136141

examples/RNOneSignal/android/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.2.2'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
@@ -16,6 +17,7 @@ allprojects {
1617
repositories {
1718
mavenLocal()
1819
jcenter()
20+
google()
1921
maven {
2022
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
2123
url "$rootDir/../node_modules/react-native/android"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Wed Mar 28 17:50:32 PDT 2018
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

examples/RNOneSignal/ios/Podfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

ios/OneSignal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
122122

123123
/* The badge assigned to the application icon */
124124
@property(readonly)NSUInteger badge;
125+
@property(readonly)NSInteger badgeIncrement;
125126

126127
/* The sound parameter passed to the notification
127128
By default set to UILocalNotificationDefaultSoundName */

ios/libOneSignal.a

112 KB
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-onesignal",
3-
"version": "3.1.2",
3+
"version": "3.1.3",
44
"description": "React Native OneSignal Component",
55
"main": "index",
66
"scripts": {

react-native-onesignal.podspec

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)