countly-sdk-react-native-bridge
Advanced tools
Comparing version 20.4.9 to 20.11.0
@@ -0,1 +1,15 @@ | ||
## 20.11.0 | ||
* !! Due to cocoapods issue with Xcode 12, we have created a new temporary Pod with a fix for Countly iOS SDK and named it "CounltyPod". Due to that change if you have already add the reference of files "CountlyNotificationService.h/m" then you need to update these files references by adding the files from "CountlyPod" and remove the old reference files. | ||
* !! Consent change !! To use remote config, you now need to give "remote-config" consent | ||
* !! Push breaking changes !! Google play vulnerability issue fixed due to broadcast receiver for android push notification | ||
* Added Surveys and NPS feedback widgets | ||
* Added replaceAllAppKeysInQueueWithCurrentAppKey method to replace all app keys in queue with the current app key | ||
* Added removeDifferentAppKeysFromQueue method to remove all different app keys from the queue | ||
* Added setStarRatingDialogTexts method to set text's for different fields of star rating dialog | ||
* Added setViewTracking deprecated method back. | ||
* Example app updated with single plugin for both IDFA and App tracking permission for iOS. | ||
* Device id NSNull check added for iOS to fix the length on null crash. | ||
* Updated underlying android SDK to 20.11.0 | ||
* Updated underlying ios SDK to 20.11.0 | ||
## 20.4.9 | ||
@@ -32,2 +46,2 @@ * Hotfix for compilation issue | ||
* Please refer to this documentation for released work https://support.count.ly/hc/en-us/articles/360037813231-React-Native-Bridge- | ||
* Please refer to this documentation for released work https://support.count.ly/hc/en*us/articles/360037813231*React*Native*Bridge* |
@@ -27,3 +27,3 @@ /** | ||
// countly initialization | ||
Countly.init = async function(serverUrl, appKey, deviceId = ""){ | ||
Countly.init = async function(serverUrl, appKey, deviceId){ | ||
@@ -102,2 +102,14 @@ if(deviceId == "") { | ||
/** | ||
* Enable or disable automatic view tracking | ||
* | ||
* @deprecated in 20.04.6 | ||
* | ||
*/ | ||
Countly.setViewTracking = async function(boolean) { | ||
if(await CountlyReactNative.isLoggingEnabled()) { | ||
console.log("[CountlyReactNative] setViewTracking is deprecated."); | ||
} | ||
} | ||
/** | ||
* Record custom view to Countly. | ||
@@ -607,2 +619,16 @@ * | ||
} | ||
/** | ||
* Set's the text's for the different fields in the star rating dialog. Set value null if for some field you want to keep the old value | ||
* | ||
* @param {String} starRatingTextTitle - dialog's title text (Only for Android) | ||
* @param {String} starRatingTextMessage - dialog's message text | ||
* @param {String} starRatingTextDismiss - dialog's dismiss buttons text (Only for Android) | ||
*/ | ||
Countly.setStarRatingDialogTexts = function(starRatingTextTitle, starRatingTextMessage, starRatingTextDismiss){ | ||
var args = []; | ||
args.push(starRatingTextTitle); | ||
args.push(starRatingTextMessage); | ||
args.push(starRatingTextDismiss); | ||
CountlyReactNative.setStarRatingDialogTexts(args); | ||
} | ||
@@ -617,5 +643,23 @@ Countly.showStarRating = function(callback){ | ||
} | ||
/** | ||
* Get a list of available feedback widgets for this device ID | ||
*/ | ||
Countly.getAvailableFeedbackWidgets = async function(){ | ||
const result = await CountlyReactNative.getAvailableFeedbackWidgets(); | ||
return result; | ||
} | ||
/** | ||
* Present a chosen feedback widget | ||
* | ||
* @param {String} widgetType - type of widget : "nps" or "survey" | ||
* @param {String} widgetId - id of widget to present | ||
* @param {String} closeButtonText - text for cancel/close button | ||
*/ | ||
Countly.presentFeedbackWidget = function(widgetType, widgetId, closeButtonText,){ | ||
CountlyReactNative.presentFeedbackWidget([widgetId.toString() || "",widgetType.toString() || "", closeButtonText.toString()]); | ||
} | ||
/** | ||
* | ||
* Events get grouped together and are sent either every minute or after the unsent event count reaches a threshold. By default it is 10 | ||
@@ -705,3 +749,2 @@ * Should be call before Countly init | ||
*/ | ||
Countly.recordAttributionID = function(attributionID){ | ||
@@ -713,3 +756,34 @@ if (!Platform.OS.match("ios")) return "recordAttributionID : To be implemented"; | ||
} | ||
/** | ||
* Replaces all requests with a different app key with the current app key. | ||
* In request queue, if there are any request whose app key is different than the current app key, | ||
* these requests' app key will be replaced with the current app key. | ||
*/ | ||
Countly.replaceAllAppKeysInQueueWithCurrentAppKey = function(){ | ||
CountlyReactNative.replaceAllAppKeysInQueueWithCurrentAppKey(); | ||
} | ||
/** | ||
* Removes all requests with a different app key in request queue. | ||
* In request queue, if there are any request whose app key is different than the current app key, | ||
* these requests will be removed from request queue. | ||
*/ | ||
Countly.removeDifferentAppKeysFromQueue = function(){ | ||
CountlyReactNative.removeDifferentAppKeysFromQueue() | ||
} | ||
/** | ||
* Call this function when app is loaded, so that the app launch duration can be recorded. | ||
* Should be call after init. | ||
*/ | ||
Countly.appLoadingFinished = async function(){ | ||
if(!await Countly.isInitialized()) { | ||
if(await CountlyReactNative.isLoggingEnabled()) { | ||
console.warn('[CountlyReactNative] appLoadingFinished, init must be called before appLoadingFinished'); | ||
} | ||
return "init must be called before appLoadingFinished"; | ||
} | ||
CountlyReactNative.appLoadingFinished() | ||
} | ||
/* | ||
@@ -716,0 +790,0 @@ Countly.initNative = function(){ |
import React, { Component } from 'react'; | ||
import { Text, Button, ScrollView, Image, View, Alert } from 'react-native'; | ||
import Countly from 'countly-sdk-react-native-bridge'; | ||
/* | ||
First add "react-native-permissions" and "react-native-idfa" plugins to implement the attribution feature for iOS. | ||
Here is the link of both plugins: | ||
https://www.npmjs.com/package/react-native-permissions | ||
https://www.npmjs.com/package/react-native-idfa | ||
Here is the required import from above mentioned plugins | ||
import {request, PERMISSIONS, RESULTS} from 'react-native-permissions'; | ||
import { IDFA } from 'react-native-idfa'; | ||
*/ | ||
var successCodes = [100, 101, 200, 201, 202, 205, 300, 301, 303, 305]; | ||
@@ -22,2 +11,3 @@ var failureCodes = [400, 402, 405, 408, 500, 501, 502, 505]; | ||
super(props); | ||
this.config = {}; | ||
@@ -52,2 +42,3 @@ | ||
componentDidMount(){ | ||
this.onInit(); | ||
} | ||
@@ -61,3 +52,3 @@ | ||
Countly.setRequiresConsent(true); // Set that consent should be required for features to work. | ||
Countly.giveConsentInit(["location", "sessions", "attribution", "push", "events", "views", "crashes", "users", "push", "star-rating", "apm"]); // give conset for specific features before init. | ||
Countly.giveConsentInit(["location", "sessions", "attribution", "push", "events", "views", "crashes", "users", "push", "star-rating", "apm", "feedback", "remote-config"]); // give conset for specific features before init. | ||
Countly.setLocationInit("TR", "Istanbul", "41.0082,28.9784", "10.2.33.12"); // Set user initial location. | ||
@@ -71,52 +62,12 @@ | ||
Countly.pushTokenType(Countly.messagingMode.DEVELOPMENT, "Channel Name", "Channel Description"); // Set messaging mode for push notifications | ||
if (!Platform.OS.match("ios")){ | ||
Countly.enableAttribution(); // Enable to measure your marketing campaign performance by attributing installs from specific campaigns. | ||
} | ||
/* | ||
For iOS 14+ apple changes regarding app tracking you need to ask the user for permission to track app. | ||
For permission you can use this plugin | ||
https://www.npmjs.com/package/react-native-permissions | ||
For IDFA you can use this plugin | ||
https://www.npmjs.com/package/react-native-idfa | ||
Below is the example app that how you can use both these plugins Countly SDK iOS attibution feature. | ||
if (Platform.OS.match("ios")) { | ||
request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY) | ||
.then((result) => { | ||
switch (result) { | ||
case RESULTS.UNAVAILABLE: | ||
console.log( | ||
'This feature is not available (on this device / in this context)', | ||
); | ||
break; | ||
case RESULTS.DENIED: | ||
console.log( | ||
'The permission has not been requested / is denied but requestable', | ||
); | ||
break; | ||
case RESULTS.GRANTED: | ||
console.log('The permission is granted'); | ||
IDFA.getIDFA().then((idfa) => { | ||
console.log('idfa : ' + idfa); | ||
Countly.recordAttributionID(idfa); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
}); | ||
break; | ||
case RESULTS.BLOCKED: | ||
console.log('The permission is denied and not requestable anymore'); | ||
break; | ||
} | ||
}) | ||
.catch((error) => { | ||
// … | ||
}); | ||
Countly.recordAttributionID("ADVERTISING_ID"); | ||
} | ||
*/ | ||
await Countly.init("https://master.count.ly", "5b77e4c785410351f32d8aa286d2383195d13b93", "123456"); // Initialize the countly SDK. | ||
else { | ||
Countly.enableAttribution(); // Enable to measure your marketing campaign performance by attributing installs from specific campaigns. | ||
} | ||
Countly.setStarRatingDialogTexts("Title", "Message", "Dismiss"); | ||
await Countly.init("https://try.count.ly", "YOUR_APP_KEY"); // Initialize the countly SDK. | ||
Countly.appLoadingFinished(); | ||
/** | ||
@@ -131,2 +82,3 @@ * Push notifications settings | ||
Countly.askForNotificationPermission(); // This method will ask for permission, enables push notification and send push token to countly server. | ||
} | ||
@@ -393,5 +345,25 @@ } | ||
showFeedbackPopup(){ | ||
Countly.showFeedbackPopup("5e4254507975d006a22535fc", "Submit"); | ||
Countly.showFeedbackPopup("5f8c837a5294f7aae370067c", "Submit"); | ||
} | ||
showSurvey = function(){ | ||
Countly.getAvailableFeedbackWidgets().then((retrivedWidgets) => { | ||
if("survey" in retrivedWidgets) { | ||
Countly.presentFeedbackWidget("survey", retrivedWidgets.survey, "Close") | ||
} | ||
},(err) => { | ||
console.error("[CountlyCordova] getAvailableFeedbackWidgets error : " +err); | ||
}); | ||
} | ||
showNPS = function(){ | ||
Countly.getAvailableFeedbackWidgets().then((retrivedWidgets) => { | ||
if("nps" in retrivedWidgets) { | ||
Countly.presentFeedbackWidget("nps", retrivedWidgets.survey, "Cancel") | ||
} | ||
},(err) => { | ||
console.error("[CountlyCordova] getAvailableFeedbackWidgets error : " +err); | ||
}); | ||
} | ||
addCrashLog(){ | ||
@@ -565,2 +537,4 @@ Countly.addCrashLog("My crash log in string."); | ||
< Button onPress = { this.showFeedbackPopup } title = "Show FeedBack Model" color = "#00b5ad"> </Button> | ||
< Button onPress = { this.showSurvey } title = "Show Survey" color = "#00b5ad"> </Button> | ||
< Button onPress = { this.showNPS } title = "Show NPS" color = "#00b5ad"> </Button> | ||
< Button onPress = { this.eventSendThreshold } title = "Set Event Threshold" color = "#00b5ad"> </Button> | ||
@@ -567,0 +541,0 @@ < Button onPress = { this.setCustomCrashSegments } title = "Set Custom Crash Segment" color = "#00b5ad"> </Button> |
{ | ||
"name": "countly-sdk-react-native-bridge", | ||
"version": "20.4.9", | ||
"version": "20.11.0", | ||
"author": "Countly <hello@count.ly> (https://count.ly/)", | ||
@@ -5,0 +5,0 @@ "bugs": { |
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
38
2376
271329