diff --git a/README.md b/README.md index 14fbab37..c0798e36 100755 --- a/README.md +++ b/README.md @@ -230,7 +230,10 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau

+### 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. @@ -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. @@ -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! diff --git a/android/build.gradle b/android/build.gradle index 025bccc9..97f39b24 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,24 +2,24 @@ 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: "", @@ -27,7 +27,6 @@ android { } buildTypes { release { - minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } @@ -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' + +*/ \ No newline at end of file diff --git a/examples/RNOneSignal/android/app/build.gradle b/examples/RNOneSignal/android/app/build.gradle index 4992a764..f1e953ba 100644 --- a/examples/RNOneSignal/android/app/build.gradle +++ b/examples/RNOneSignal/android/app/build.gradle @@ -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 @@ -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 { @@ -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 } diff --git a/examples/RNOneSignal/android/build.gradle b/examples/RNOneSignal/android/build.gradle index f3bd7d31..605f1092 100644 --- a/examples/RNOneSignal/android/build.gradle +++ b/examples/RNOneSignal/android/build.gradle @@ -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 @@ -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" diff --git a/examples/RNOneSignal/android/gradle/wrapper/gradle-wrapper.properties b/examples/RNOneSignal/android/gradle/wrapper/gradle-wrapper.properties index dbdc05d2..4afac646 100644 --- a/examples/RNOneSignal/android/gradle/wrapper/gradle-wrapper.properties +++ b/examples/RNOneSignal/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/examples/RNOneSignal/ios/Podfile b/examples/RNOneSignal/ios/Podfile deleted file mode 100644 index 631e3672..00000000 --- a/examples/RNOneSignal/ios/Podfile +++ /dev/null @@ -1,5 +0,0 @@ -project 'RNOneSignal.xcodeproj' - -target 'RNOneSignal' do - pod 'OneSignal' -end diff --git a/ios/OneSignal.h b/ios/OneSignal.h index 0194f846..4ce7aac9 100755 --- a/ios/OneSignal.h +++ b/ios/OneSignal.h @@ -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 */ diff --git a/ios/libOneSignal.a b/ios/libOneSignal.a index 023dbe6f..8cd9c355 100644 Binary files a/ios/libOneSignal.a and b/ios/libOneSignal.a differ diff --git a/package.json b/package.json index 832dc59c..c017ecba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-onesignal", - "version": "3.1.2", + "version": "3.1.3", "description": "React Native OneSignal Component", "main": "index", "scripts": { diff --git a/react-native-onesignal.podspec b/react-native-onesignal.podspec deleted file mode 100644 index 45f1f801..00000000 --- a/react-native-onesignal.podspec +++ /dev/null @@ -1,18 +0,0 @@ -require 'json' -package_json = JSON.parse(File.read('package.json')) - -Pod::Spec.new do |s| - - s.name = "react-native-onesignal" - s.version = package_json["version"] - s.summary = package_json["description"] - s.homepage = "https://github.com/geektimecoil/react-native-onesignal" - s.license = package_json["license"] - s.author = { package_json["author"] => package_json["author"] } - s.platform = :ios, "7.0" - s.source = { :git => "#{package_json["repository"]["url"]}.git", :tag => "v#{s.version}" } - s.source_files = 'ios/RCTOneSignal/*.{h,m}' - s.dependency 'React' - s.dependency 'OneSignal' - -end