react-native-onesignal
Advanced tools
Comparing version 3.0.3 to 3.0.4
{ | ||
"name": "react-native-onesignal", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "React Native OneSignal Component", | ||
@@ -28,3 +28,3 @@ "main": "index", | ||
"type": "git", | ||
"url": "git://git@github.com:geektimecoil/react-native-onesignal.git" | ||
"url": "https://github.com/geektimecoil/react-native-onesignal" | ||
}, | ||
@@ -31,0 +31,0 @@ "author": "Geektime <http://www.geektime.co.il>", |
103
README.md
@@ -7,2 +7,4 @@ # React Native OneSignal | ||
[![npm downloads](https://img.shields.io/npm/dm/react-native-onesignal.svg?style=flat-square)](https://www.npmjs.com/package/react-native-onesignal) | ||
[![Build Status](https://travis-ci.org/geektimecoil/react-native-onesignal.svg?branch=master)](https://travis-ci.org/geektimecoil/react-native-onesignal) | ||
[![Tests Status](https://circleci.com/gh/geektimecoil/react-native-onesignal.svg?style=shield&circle-token=a8b65c174b2a8d21c29bac81004b62740f84cf49)](https://circleci.com/gh/geektimecoil/react-native-onesignal/11) | ||
@@ -13,3 +15,3 @@ <!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --> | ||
- [Breaking Change](#breaking-change) | ||
- [Note Regarding 0.39 <= React Native >= 0.40 Support](#note-regarding-039-react-native-040-support) | ||
- [Note Regarding 0.39 <= React Native >= 0.40 Support](#note-regarding-039--react-native--040-support) | ||
- [Running Example project](#running-example-project) | ||
@@ -26,2 +28,3 @@ - [Installation](#installation) | ||
- [Getting Player ID and Push Token](#getting-player-id-and-push-token) | ||
- [Set Email for Better Targeting](#set-email-for-better-targeting) | ||
- [Enable Vibration](#enable-vibration) | ||
@@ -38,6 +41,7 @@ - [Enable Sound](#enable-sound) | ||
- [Register For Push Notifications (iOS Only)](#register-for-push-notifications-ios-only) | ||
- [FAQ / Repeating Issues](#faq-repeating-issues) | ||
- [Issue 1 - Multiple dex files define:](#issue-1-multiple-dex-files-define) | ||
- [Issue 2 - Multiple dex files define (Again):](#issue-2-multiple-dex-files-define-again) | ||
- [Issue 3 - symbol(s) not found for architecture x86_64 and/or OneSignal/OneSignal.h file not found](#issue-3-symbols-not-found-for-architecture-x8664-andor-onesignalonesignalh-file-not-found) | ||
- [FAQ / Repeating Issues](#faq--repeating-issues) | ||
- [Issue 1 - Multiple dex files define:](#issue-1---multiple-dex-files-define) | ||
- [Issue 2 - Multiple dex files define (Again):](#issue-2---multiple-dex-files-define-again) | ||
- [Issue 3 - symbol(s) not found for architecture x86_64 and/or OneSignal/OneSignal.h file not found](#issue-3---symbols-not-found-for-architecture-x86_64-andor-onesignalonesignalh-file-not-found) | ||
- [Issue 4 - Make react-native-onesignal work with react-native-maps](#issue-4---make-react-native-onesignal-work-with-react-native-maps) | ||
- [CREDITS](#credits) | ||
@@ -102,3 +106,3 @@ - [TODO](#todo) | ||
In `android/gradle/wrapper/gradle-wrapper.properties` | ||
````javascript | ||
```javascript | ||
... | ||
@@ -189,2 +193,9 @@ | ||
```objc | ||
// For requiring push notification permissions manually. | ||
self.oneSignal = [[RCTOneSignal alloc] initWithLaunchOptions:launchOptions | ||
appId:@"YOUR_ONESIGNAL_APP_ID" | ||
settings:@{kOSSettingsKeyAutoPrompt: @false}]; | ||
``` | ||
* After `application ` insert the code for the notification event: | ||
@@ -211,3 +222,3 @@ | ||
export default class App extends Component { | ||
componentWillMount() { | ||
@@ -292,3 +303,3 @@ OneSignal.addEventListener('received', this.onReceived); | ||
````javascript | ||
```javascript | ||
// Sending single tag | ||
@@ -307,4 +318,12 @@ OneSignal.sendTag("key", "value"); | ||
OneSignal.deleteTag("key"); | ||
```` | ||
``` | ||
### Set Email for Better Targeting | ||
Sync hashed email if you have a login system or collect it. Will be used to reach the user at the most optimal time of day. | ||
```javascript | ||
OneSignal.syncHashedEmail("test@domain.com"); | ||
``` | ||
### Getting Player ID and Push Token | ||
@@ -315,3 +334,3 @@ | ||
````javascript | ||
```javascript | ||
componentWillMount() { | ||
@@ -328,3 +347,3 @@ OneSignal.addEventListener('ids', this.onIds); | ||
} | ||
```` | ||
``` | ||
@@ -337,6 +356,6 @@ ### Enable Vibration | ||
````javascript | ||
```javascript | ||
// Setting enableVibrate | ||
OneSignal.enableVibrate(true); | ||
```` | ||
``` | ||
@@ -349,6 +368,6 @@ ### Enable Sound | ||
````javascript | ||
```javascript | ||
// Setting enableSound | ||
OneSignal.enableSound(true); | ||
```` | ||
``` | ||
@@ -365,6 +384,6 @@ ### Set In App Focus Behavior | ||
````javascript | ||
```javascript | ||
// Example, always display notification in shade. | ||
OneSignal.inFocusDisplaying(2); | ||
```` | ||
``` | ||
@@ -391,6 +410,6 @@ #### iOS: | ||
````javascript | ||
```javascript | ||
// Setting setSubscription | ||
OneSignal.setSubscription(true); | ||
```` | ||
``` | ||
@@ -406,3 +425,3 @@ ### Post Notification (Peer-to-Peer Notifications) | ||
````javascript | ||
```javascript | ||
// Calling postNotification | ||
@@ -423,3 +442,3 @@ let data = arr // some array as payload | ||
} | ||
```` | ||
``` | ||
@@ -433,6 +452,6 @@ ### Prompt Location | ||
````javascript | ||
```javascript | ||
// Calling promptLocation | ||
OneSignal.promptLocation(); | ||
```` | ||
``` | ||
@@ -445,6 +464,6 @@ ### Clear Notifications (Android Only) | ||
````javascript | ||
```javascript | ||
// Calling clearOneSignalNotifications | ||
OneSignal.clearOneSignalNotifications(); | ||
```` | ||
``` | ||
@@ -457,6 +476,6 @@ ### Cancel Notifications (Android Only) | ||
````javascript | ||
```javascript | ||
// Calling cancelNotification | ||
OneSignal.cancelNotification(id); | ||
```` | ||
``` | ||
@@ -467,3 +486,3 @@ ### Check Push Notification Permissions (iOS Only) | ||
````javascript | ||
```javascript | ||
// Requesting permissions | ||
@@ -473,3 +492,3 @@ OneSignal.checkPermissions((permissions) => { | ||
}); | ||
```` | ||
``` | ||
@@ -480,3 +499,3 @@ ### Request Push Notification Permissions (iOS Only) | ||
````javascript | ||
```javascript | ||
// Setting requestPermissions | ||
@@ -489,3 +508,3 @@ permissions = { | ||
OneSignal.requestPermissions(permissions); | ||
```` | ||
``` | ||
@@ -496,9 +515,9 @@ ### Register For Push Notifications (iOS Only) | ||
*Call when you want to prompt the user to accept push notifications. Only call once and only if you passed @YES to `kOSSettingsKeyAutoPrompt` on init. | ||
*Call when you want to prompt the user to accept push notifications. Only call once and only if you passed @NO to `kOSSettingsKeyAutoPrompt` on init. | ||
````javascript | ||
```javascript | ||
// Calling registerForPushNotifications | ||
OneSignal.registerForPushNotifications(); | ||
```` | ||
``` | ||
@@ -567,3 +586,3 @@ The following example is from our own App and needs to be customized in order to work. | ||
Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION: | ||
Unknown source file : com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim;```` | ||
Unknown source file : com.android.dex.DexException: Multiple dex files define Landroid/support/v7/appcompat/R$anim; | ||
``` | ||
@@ -596,6 +615,18 @@ | ||
### Issue 4 - Make `react-native-onesignal` work with `react-native-maps` | ||
If you have both `react native maps` and `react-native-onesignal` make sure you compile `react-native-maps` in the following way (android/app/build.gradle). | ||
```gradle | ||
compile(project(':react-native-maps')){ | ||
exclude group: 'com.google.android.gms', module: 'play-services-base' | ||
exclude group: 'com.google.android.gms', module: 'play-services-maps' | ||
} | ||
compile 'com.google.android.gms:play-services-base:+' | ||
compile 'com.google.android.gms:play-services-maps:+' | ||
``` | ||
### 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. | ||
1. Download the [latest OneSiganl iOS native](https://github.com/OneSignal/OneSignal-iOS-SDK/releases) release. | ||
1. Download the [latest OneSignal iOS native](https://github.com/OneSignal/OneSignal-iOS-SDK/releases) release. | ||
2. In XCode, delete `OneSignalNativeSDK` under `Libraries/RCTOneSignal.xcodeproj` | ||
@@ -602,0 +633,0 @@ 3. Press "Move to trash" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
426904
73
619