From 74afc381d800d0d949f08e960910132e5614fa00 Mon Sep 17 00:00:00 2001 From: ijunaid Date: Tue, 15 Dec 2020 22:12:54 +0500 Subject: [PATCH] [sdk-184] APM fixes app_start, foreground and background tracking. (#80) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * — APM changes implemented for app_start, foreground and background. — old iOS platform check was not working fixed. - android plugin auto initialise implemented * Example app updated for APM changes * onLoad callback added in example app. * Changelog file added * Changelog updated * Update Countly.js Added missing bracket --- CHANGELOG.md | 11 +++++++++++ Countly.js | 21 +++++++++++++++++--- change.log | 34 --------------------------------- hooks/createService.js | 4 ++-- index.html | 14 ++++++++++---- plugin.xml | 1 + src/android/CountlyCordova.java | 32 ++++++++++++++++++++++++++++++- src/android/CountlyNative.java | 25 +++++++++++++++++++++++- src/ios/CountlyCordova.h | 1 + src/ios/CountlyCordova.m | 12 ++++++++++++ src/ios/CountlyNative.m | 6 ++++++ 11 files changed, 116 insertions(+), 45 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 change.log diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..29cf94a --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +## 20.11.0 +* !! 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 +* Updated underlying android SDK to 20.11.2 +* Updated underlying ios SDK to 20.11.1 + +## 20.4.0 diff --git a/Countly.js b/Countly.js index 19590fb..7fc0a85 100644 --- a/Countly.js +++ b/Countly.js @@ -4,12 +4,11 @@ Countly.appKey = ""; Countly.ready = false; Countly.version = "20.11.0"; Countly.isDebug = false; -var userAgent = navigator.userAgent || navigator.vendor || window.opera; -if (/android/i.test(userAgent)) { +if (window.cordova.platformId == "android") { Countly.isAndroid = true; Countly.messagingMode = {"TEST": "2", "PRODUCTION": "0"}; } -if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) { +if (window.cordova.platformId == "ios") { Countly.isiOS = true; Countly.messagingMode = {"TEST": "1", "PRODUCTION": "0", "ADHOC": "2"}; } @@ -520,6 +519,22 @@ Countly.askForFeedback = function(widgetId, buttonText){ cordova.exec(Countly.onSuccess,Countly.onError,"CountlyCordova","askForFeedback",[widgetId, buttonText || ""]); } +// 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(){ + Countly.isInitialized().then((result) => { + if(result != "true") { + if(Countly.isDebug){ + console.warn('[CountlyCordova] appLoadingFinished, init must be called before appLoadingFinished'); + } + return; + } + },(err) => { + console.error(err); + }); + cordova.exec(Countly.onSuccess,Countly.onError,"CountlyCordova","appLoadingFinished",[]); +} + /** * Get a list of available feedback widgets for this device ID */ diff --git a/change.log b/change.log deleted file mode 100644 index bdf5fba..0000000 --- a/change.log +++ /dev/null @@ -1,34 +0,0 @@ -Developer release notes. - -plugin.xml update version -package.json update version -package.js update version, update app.use version of meteor.js -Countly.js update version -ionic.countly.js update version -create tag / release based on the same version -Sync Countly.js with ngCountly.js some angular customer depends on it. - -Updating index.html should also update ionic/home.html - -Making a new release on github, should also release on npm and meteor. -Make sure all of them have the same versioning. - -Apply documentation to the sdk, for a newbie to understand. - -Provide callback to the user instead of handling the callback manually. - -Please review the documentation once the changes are made. - -npm publish --release -meteor publish - -1. Update both sdk to 18.08.1 -2. review plugin.xml files - (ProxyActivity in xml file) - (review both code to confirm no outling files) - `Notification channels` there -3. Test push on android 8 and 9 version -4. Make a release on meteor community. - -Change quest to Gorkem -1. Change header "Phonegap, Icenium & Meteor" -> "Cordova" to keep it simple diff --git a/hooks/createService.js b/hooks/createService.js index 7f7e7bd..05e7cd4 100644 --- a/hooks/createService.js +++ b/hooks/createService.js @@ -41,8 +41,8 @@ module.exports = function(context) { }); var countlyFiles = [ - __dirname +'/../../../platforms/ios/Pods/Countly/' +'CountlyNotificationService.h', - __dirname +'/../../../platforms/ios/Pods/Countly/' +'CountlyNotificationService.m' + __dirname +'/../../../platforms/ios/Pods/CountlyPod/' +'CountlyNotificationService.h', + __dirname +'/../../../platforms/ios/Pods/CountlyPod/' +'CountlyNotificationService.m' ]; extFiles.push(countlyFiles[0]); extFiles.push(countlyFiles[1]); diff --git a/index.html b/index.html index 965c126..d0e4dc5 100644 --- a/index.html +++ b/index.html @@ -18,11 +18,10 @@ Countly Cordova Demo App - +

Countly Cordova Demo App

- @@ -147,12 +146,18 @@

Countly Cordova Demo App