react-native-play-install-referrer
Advanced tools
Comparing version 1.1.4 to 1.1.5
30
index.js
// | ||
// index.js | ||
// play-install-referrer-react-native | ||
// version: 1.1.5 | ||
// | ||
@@ -13,5 +14,7 @@ // Created by Uglješa Erceg (@ugi) on 24th April 2020. | ||
NativeModules, | ||
NativeEventEmitter, | ||
} from 'react-native'; | ||
const modulePlayInstallReferrer = NativeModules.PlayInstallReferrer; | ||
let modulePlayInstallReferrer = NativeModules.PlayInstallReferrer; | ||
let modulePlayInstallReferrerEmitter = new NativeEventEmitter(NativeModules.PlayInstallReferrer); | ||
@@ -21,5 +24,28 @@ var PlayInstallReferrer = {}; | ||
PlayInstallReferrer.getInstallReferrerInfo = function(callback) { | ||
modulePlayInstallReferrer.getInstallReferrerInfo(callback); | ||
// subscribe to get play install referrer value if successfully read | ||
const subscriptionValue = modulePlayInstallReferrerEmitter.addListener('play_install_referrer_value', (playInstallReferrerValue) => { | ||
callback(playInstallReferrerValue, null); | ||
// clean up subscriptions if they exist | ||
if (subscriptionValue != null) { | ||
subscriptionValue.remove(); | ||
} | ||
if (subscriptionError != null) { | ||
subscriptionError.remove(); | ||
} | ||
}); | ||
// subscribe to get error in case play install referrer value reading failed | ||
const subscriptionError = modulePlayInstallReferrerEmitter.addListener('play_install_referrer_error', (error) => { | ||
callback(null, error); | ||
// clean up subscriptions if they exist | ||
if (subscriptionValue != null) { | ||
subscriptionValue.remove(); | ||
} | ||
if (subscriptionError != null) { | ||
subscriptionError.remove(); | ||
} | ||
}); | ||
// invoke native API | ||
modulePlayInstallReferrer.getInstallReferrerInfo(); | ||
}; | ||
module.exports = { PlayInstallReferrer } |
{ | ||
"name": "react-native-play-install-referrer", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Play Install Referrer Library wrapper for React Native", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://github.com/ugi/play-install-referrer-react-native/plugin" | ||
"homepage": "https://github.com/ugi/play-install-referrer-react-native" | ||
} |
@@ -10,3 +10,3 @@ # Play Install Referrer Library wrapper for React Native | ||
<td align="left">Current version:</td> | ||
<td align="left"><a href=../../releases/tag/v1.1.4><b>1.1.4</b></a></td> | ||
<td align="left"><a href=../../releases/tag/v1.1.5><b>1.1.5</b></a></td> | ||
</tr> | ||
@@ -91,1 +91,5 @@ <tr> | ||
Play Install Referrer Library is added to **react-native-play-install-referrer** plugin as an [Gradle dependency](./plugin/android/build.gradle#L30) and it will automatically make sure that manifest file ends up with above mentioned permission added to it upon building your app. | ||
## Todos | ||
List of tasks to be done in this repository can be found in [here](./TODO.md). |
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
25829
14
55
0
94