From 23949af9fb3fcc0bb7c9c85bf91d0aac749654ea Mon Sep 17 00:00:00 2001 From: OhMyGuus Date: Tue, 9 Feb 2021 14:21:15 +0100 Subject: [PATCH] Fixed background plugin to be silent --- android/app/build.gradle | 4 +-- .../app/BetterCrewlinkNativePlugin.java | 2 +- package-lock.json | 5 ++-- package.json | 2 +- src/app/services/game-helper.service.ts | 25 ++++++++++--------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ccc080a..988c574 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "io.bettercrewlink.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 20 - versionName "1.0.13" + versionCode 21 + versionName "1.0.20" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/android/app/src/main/java/io/bettercrewlink/app/BetterCrewlinkNativePlugin.java b/android/app/src/main/java/io/bettercrewlink/app/BetterCrewlinkNativePlugin.java index 60375a7..f7eb59b 100644 --- a/android/app/src/main/java/io/bettercrewlink/app/BetterCrewlinkNativePlugin.java +++ b/android/app/src/main/java/io/bettercrewlink/app/BetterCrewlinkNativePlugin.java @@ -115,7 +115,7 @@ public void CreateNotification() { String body = "Guus(red) talking
player2(lime) talking"; SpannableString spannableString = new SpannableString(Build.VERSION.SDK_INT < Build.VERSION_CODES.N ? Html.fromHtml(body) : Html.fromHtml(body, Html.FROM_HTML_MODE_LEGACY)); - NotificationCompat.Builder builder = new NotificationCompat.Builder(this.getContext(), "cordova-plugin-background-mode-id") + NotificationCompat.Builder builder = new NotificationCompat.Builder(this.getContext(), "bettercrewlink-background-id") .setSmallIcon(R.drawable.ic_notification) .setContentIntent(refreshAction) .setContentTitle("BetterCrewlink") diff --git a/package-lock.json b/package-lock.json index c6119ee..dfd85a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5256,9 +5256,8 @@ "integrity": "sha512-Kh7Nv6U+oa8rg6lMep8NJIMmmNYFN1aZyF68u9GBI5SG8MeMB2kkPuFc6aSq9KeuV5BTSGyW80xmQX1Mag/n5g==" }, "cordova-plugin-background-mode": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/cordova-plugin-background-mode/-/cordova-plugin-background-mode-0.7.3.tgz", - "integrity": "sha512-LsU1v7EgTUROaks+tcQ8TnMzVUcU/TwjDVwj2O/4e4aI2q2ldLGsiZorqKqfqvwh2HoIssmY73OwJk91hQi62w==" + "version": "git+https://github.com/OhMyGuus/cordova-plugin-background-mode.git#57d793adab092b864c35caa19d4fcae51c5be37a", + "from": "git+https://github.com/OhMyGuus/cordova-plugin-background-mode.git" }, "cordova-plugin-device": { "version": "2.0.3", diff --git a/package.json b/package.json index c67872f..7802ca4 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "cordova-plugin-appcenter-analytics": "^0.5.1", "cordova-plugin-appcenter-crashes": "^0.5.1", "cordova-plugin-appcenter-shared": "^0.5.1", - "cordova-plugin-background-mode": "^0.7.3", + "cordova-plugin-background-mode": "git+https://github.com/OhMyGuus/cordova-plugin-background-mode.git", "cordova-plugin-device": "^2.0.3", "jetifier": "^1.6.6", "ng2-fittext": "^1.2.12", diff --git a/src/app/services/game-helper.service.ts b/src/app/services/game-helper.service.ts index d2cd649..dac7467 100644 --- a/src/app/services/game-helper.service.ts +++ b/src/app/services/game-helper.service.ts @@ -68,13 +68,14 @@ export class GameHelperService extends EventEmitterO implements IGameHelperServi connect() { this.disconnect(false); - this.appCenterAnalytics.trackEvent('connect', { - gameCode: this.settings.gamecode.toUpperCase(), - username: this.settings.username, - micrphone: this.settings.selectedMicrophone.deviceId, - natfixEnabled: this.settings.natFix ? 'true' : 'false', - time: new Date().toISOString(), - }); + this.appCenterAnalytics + .trackEvent('connect', { + gameCode: this.settings.gamecode.toUpperCase(), + username: this.settings.username, + micrphone: this.settings.selectedMicrophone.deviceId, + natfixEnabled: this.settings.natFix ? 'true' : 'false', + }) + .then(() => {}); this.requestPermissions().then((haspermissions) => { if (!haspermissions) { @@ -99,13 +100,13 @@ export class GameHelperService extends EventEmitterO implements IGameHelperServi if (disableBackgroundMode) { this.backgroundMode.disable(); BetterCrewlinkNativePlugin.disconnect(); + this.appCenterAnalytics + .trackEvent('disconnect', { + disableBackgroundMode: disableBackgroundMode ? 'true' : 'false', + }) + .then(() => {}); } this.cManager.disconnect(true); - - this.appCenterAnalytics.trackEvent('disconnect', { - disableBackgroundMode: disableBackgroundMode ? 'true' : 'false', - time: new Date().toISOString(), - }); } muteMicrophone() {