Skip to content

Commit

Permalink
Merge pull request #435 from Nightsd01/master
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Nightsd01 committed Mar 29, 2018
2 parents af2d158 + 2d94cfe commit 26002a8
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 42 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau

</p></details>

### Add App Groups (Optional but Recommended)
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.

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

### Add Notification Service Extension
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.
Expand Down Expand Up @@ -784,6 +787,9 @@ compile(project(':react-native-maps')){

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).

### Issue 6 - More than One Library with GMS License Package Name


### Manually updating iOS OneSignalNativeSDK
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.

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

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.


### Issue 6 - Make `react-native-onesignal` work with Redux
If you see this error:

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.
`Error: more than one library with package name 'com.google.android.gms.license'`

You can resolve it by adding this code to the top of your app's `build.gradle` file:

```
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
```

## CREDITS
Thanks for all the awesome fellows that contributed to this repository!
Expand Down
28 changes: 18 additions & 10 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,31 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}

dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:3.0.1'
}
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
compileSdkVersion 27
buildToolsVersion '27.0.3'

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
versionName '1.0'
// Do not set onesignal_app_id here, it will be set in the app project.
// Leave onesignal_google_project_number as it is now pulled from the dashboard.
manifestPlaceholders = [onesignal_app_id: "",
onesignal_google_project_number: "REMOTE"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand All @@ -36,9 +35,18 @@ android {
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.facebook.react:react-native:+'
compile 'com.google.android.gms:play-services-gcm:+'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'
testCompile 'junit:junit:4.12'
compile 'com.onesignal:OneSignal:3.+@aar'
compile 'com.onesignal:OneSignal:3.+'
}

// Add the following to the top (Line 1) of your app/build.gradle if you run into any issues with duplicate classes.
// Such as the following error
// Error: more than one library with package name 'com.google.android.gms.license'
/*
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
*/
15 changes: 10 additions & 5 deletions examples/RNOneSignal/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

apply plugin: "com.android.application"

import com.android.build.OutputFile
Expand Down Expand Up @@ -83,19 +88,19 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.rnonesignal"
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
manifestPlaceholders = [onesignal_app_id: "73a522ac-dc37-45f1-9d67-2791f3247179",
manifestPlaceholders = [onesignal_app_id: "78e8aff3-7ce2-401f-9da0-2d41f287ebaf",
onesignal_google_project_number: "REMOTE"]
}
splits {
Expand Down Expand Up @@ -130,7 +135,7 @@ android {
dependencies {
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.android.support:appcompat-v7:27.1.0"
compile "com.facebook.react:react-native:+" // From node_modules
}

Expand Down
4 changes: 3 additions & 1 deletion examples/RNOneSignal/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,6 +17,7 @@ allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Mar 28 17:50:32 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
5 changes: 0 additions & 5 deletions examples/RNOneSignal/ios/Podfile

This file was deleted.

1 change: 1 addition & 0 deletions ios/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {

/* The badge assigned to the application icon */
@property(readonly)NSUInteger badge;
@property(readonly)NSInteger badgeIncrement;

/* The sound parameter passed to the notification
By default set to UILocalNotificationDefaultSoundName */
Expand Down
Binary file modified ios/libOneSignal.a
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-onesignal",
"version": "3.1.2",
"version": "3.1.3",
"description": "React Native OneSignal Component",
"main": "index",
"scripts": {
Expand Down
18 changes: 0 additions & 18 deletions react-native-onesignal.podspec

This file was deleted.

0 comments on commit 26002a8

Please sign in to comment.