diff --git a/app/build.gradle b/app/build.gradle index 798f2c188..28438abd1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,7 +13,7 @@ plugins { id "kotlin-parcelize" id "kotlinx-serialization" id "com.google.devtools.ksp" - //id "com.huawei.agconnect" + id "com.huawei.agconnect" } @@ -193,7 +193,9 @@ dependencies { amazonImplementation "com.google.android.gms:play-services-location:21.2.0" // Huawei billing - //huaweiImplementation "com.huawei.hms:iap:$version_huawei_iap" + huaweiImplementation "com.huawei.hms:iap:$version_huawei_iap" + huaweiImplementation "com.huawei.hms:appservice:6.10.0.300" + // Google Maps gplayImplementation "com.google.maps.android:maps-compose:5.0.1" @@ -261,7 +263,7 @@ dependencies { implementation "androidx.glance:glance-appwidget:1.1.0-rc01" implementation "androidx.biometric:biometric-ktx:1.2.0-alpha05" - + implementation "androidx.profileinstaller:profileinstaller:1.3.1" //image loading from the web diff --git a/app/src/amazon/java/at/techbee/jtx/flavored/UpdateCheckManager.kt b/app/src/amazon/java/at/techbee/jtx/flavored/UpdateCheckManager.kt new file mode 100644 index 000000000..87095831d --- /dev/null +++ b/app/src/amazon/java/at/techbee/jtx/flavored/UpdateCheckManager.kt @@ -0,0 +1,20 @@ +/* + * Copyright (c) Techbee e.U. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + */ + +package at.techbee.jtx.flavored + +import android.app.Activity + + + +class UpdateCheckManager(val activity: Activity) : UpdateCheckManagerDefinition { + + override fun checkForUpdates() { + // currently only used in HUAWEI + } +} \ No newline at end of file diff --git a/app/src/generic/java/at/techbee/jtx/flavored/UpdateCheckManager.kt b/app/src/generic/java/at/techbee/jtx/flavored/UpdateCheckManager.kt new file mode 100644 index 000000000..7f034f907 --- /dev/null +++ b/app/src/generic/java/at/techbee/jtx/flavored/UpdateCheckManager.kt @@ -0,0 +1,19 @@ +/* + * Copyright (c) Techbee e.U. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + */ + +package at.techbee.jtx.flavored + +import android.app.Activity + + +class UpdateCheckManager(val activity: Activity) : UpdateCheckManagerDefinition { + + override fun checkForUpdates() { + // currently only used in HUAWEI + } +} \ No newline at end of file diff --git a/app/src/gplay/java/at/techbee/jtx/flavored/UpdateCheckManager.kt b/app/src/gplay/java/at/techbee/jtx/flavored/UpdateCheckManager.kt new file mode 100644 index 000000000..7f034f907 --- /dev/null +++ b/app/src/gplay/java/at/techbee/jtx/flavored/UpdateCheckManager.kt @@ -0,0 +1,19 @@ +/* + * Copyright (c) Techbee e.U. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + */ + +package at.techbee.jtx.flavored + +import android.app.Activity + + +class UpdateCheckManager(val activity: Activity) : UpdateCheckManagerDefinition { + + override fun checkForUpdates() { + // currently only used in HUAWEI + } +} \ No newline at end of file diff --git a/app/src/huawei/java/at/techbee/jtx/flavored/UpdateCheckManager.kt b/app/src/huawei/java/at/techbee/jtx/flavored/UpdateCheckManager.kt new file mode 100644 index 000000000..bc1d98396 --- /dev/null +++ b/app/src/huawei/java/at/techbee/jtx/flavored/UpdateCheckManager.kt @@ -0,0 +1,42 @@ +/* + * Copyright (c) Techbee e.U. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Public License v3.0 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/gpl.html + */ + +package at.techbee.jtx.flavored + +import android.app.Activity +import android.content.Intent +import android.os.Build +import com.huawei.hms.jos.JosApps +import com.huawei.updatesdk.service.appmgr.bean.ApkUpgradeInfo +import com.huawei.updatesdk.service.otaupdate.CheckUpdateCallBack +import com.huawei.updatesdk.service.otaupdate.UpdateKey + + +class UpdateCheckManager(val activity: Activity) : UpdateCheckManagerDefinition { + + override fun checkForUpdates() { + val client = JosApps.getAppUpdateClient(activity) + client.checkAppUpdate(activity, object: CheckUpdateCallBack { + override fun onUpdateInfo(intent: Intent?) { + if (intent != null) { + val info = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + intent.getSerializableExtra(UpdateKey.INFO, ApkUpgradeInfo::class.java) + } else { + intent.getSerializableExtra(UpdateKey.INFO) as ApkUpgradeInfo? + } + if(intent.getBooleanExtra(UpdateKey.MUST_UPDATE, false)) + JosApps.getAppUpdateClient(activity).showUpdateDialog(activity, info, false) + } + } + override fun onMarketInstallInfo(p0: Intent?) { } + override fun onMarketStoreError(p0: Int) { } + override fun onUpdateStoreError(p0: Int) { } + }) + } + +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 20a108181..1221418e7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -82,8 +82,10 @@ +