From 413f1654f47e2932660c5bb025834896a614a61c Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 14:07:29 +0200 Subject: [PATCH 01/11] update gradle to 7.0.2, kotlin to 1.5.21, remove jcenter maven repository --- ChoiceSDK/build.gradle | 14 ++++++++------ ChoiceSDK/choicesdk-analytics/build.gradle | 3 --- ChoiceSDK/choicesdk-app/build.gradle | 2 +- ChoiceSDK/choicesdk-core/build.gradle | 3 --- ChoiceSDK/choicesdk-location/build.gradle | 3 --- ChoiceSDK/choicesdk-maps/build.gradle | 3 --- ChoiceSDK/choicesdk-messaging/build.gradle | 4 ---- ChoiceSDK/choicesdk-signin/build.gradle | 3 --- ChoiceSDK/gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 10 insertions(+), 27 deletions(-) diff --git a/ChoiceSDK/build.gradle b/ChoiceSDK/build.gradle index 7ce7c3e..2a36cbf 100644 --- a/ChoiceSDK/build.gradle +++ b/ChoiceSDK/build.gradle @@ -13,16 +13,18 @@ buildscript { project.ext.versionCode = 8 project.ext.groupId = "at.bluesource.choicesdk" - ext.kotlin_version = "1.5.20" + ext.kotlin_version = "1.5.21" + ext.coroutines_version = "1.5.0" repositories { google() - jcenter() - maven { url 'http://developer.huawei.com/repo/' } + gradlePluginPortal() + + maven { url 'https://developer.huawei.com/repo/' } } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' + classpath 'com.android.tools.build:gradle:7.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.jaredsburrows:gradle-license-plugin:0.8.80' @@ -45,9 +47,9 @@ plugins { allprojects { repositories { google() - jcenter() + gradlePluginPortal() - maven { url 'http://developer.huawei.com/repo/' } + maven { url 'https://developer.huawei.com/repo/' } maven { name "Gitlab" diff --git a/ChoiceSDK/choicesdk-analytics/build.gradle b/ChoiceSDK/choicesdk-analytics/build.gradle index 3f241dd..80dba47 100644 --- a/ChoiceSDK/choicesdk-analytics/build.gradle +++ b/ChoiceSDK/choicesdk-analytics/build.gradle @@ -15,9 +15,6 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } diff --git a/ChoiceSDK/choicesdk-app/build.gradle b/ChoiceSDK/choicesdk-app/build.gradle index 24b2971..7c3da33 100644 --- a/ChoiceSDK/choicesdk-app/build.gradle +++ b/ChoiceSDK/choicesdk-app/build.gradle @@ -105,7 +105,7 @@ dependencies { implementation 'com.huawei.hms:maps:5.3.0.300' // Coroutines - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" // HTTP Lib implementation "com.squareup.retrofit2:retrofit:2.9.0" diff --git a/ChoiceSDK/choicesdk-core/build.gradle b/ChoiceSDK/choicesdk-core/build.gradle index fd7b626..1feffdd 100644 --- a/ChoiceSDK/choicesdk-core/build.gradle +++ b/ChoiceSDK/choicesdk-core/build.gradle @@ -15,9 +15,6 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } diff --git a/ChoiceSDK/choicesdk-location/build.gradle b/ChoiceSDK/choicesdk-location/build.gradle index 12af5c0..6b4e013 100644 --- a/ChoiceSDK/choicesdk-location/build.gradle +++ b/ChoiceSDK/choicesdk-location/build.gradle @@ -15,9 +15,6 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } diff --git a/ChoiceSDK/choicesdk-maps/build.gradle b/ChoiceSDK/choicesdk-maps/build.gradle index 7a173e3..96b4c38 100644 --- a/ChoiceSDK/choicesdk-maps/build.gradle +++ b/ChoiceSDK/choicesdk-maps/build.gradle @@ -15,9 +15,6 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } diff --git a/ChoiceSDK/choicesdk-messaging/build.gradle b/ChoiceSDK/choicesdk-messaging/build.gradle index ad1ae80..ceb8cac 100644 --- a/ChoiceSDK/choicesdk-messaging/build.gradle +++ b/ChoiceSDK/choicesdk-messaging/build.gradle @@ -15,9 +15,6 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } @@ -49,7 +46,6 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.6.0' - def coroutines_version = "1.5.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx3:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutines_version" diff --git a/ChoiceSDK/choicesdk-signin/build.gradle b/ChoiceSDK/choicesdk-signin/build.gradle index eb12c72..bd14369 100644 --- a/ChoiceSDK/choicesdk-signin/build.gradle +++ b/ChoiceSDK/choicesdk-signin/build.gradle @@ -15,9 +15,6 @@ android { minSdkVersion 19 targetSdkVersion 29 - versionName project.sdkVersionName - versionCode project.versionCode - consumerProguardFiles "consumer-rules.pro" } diff --git a/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties b/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties index 31ca335..46bdc26 100644 --- a/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties +++ b/ChoiceSDK/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip From 499fd4d942f86181ee6cf1273f9cceb1bb7cf198 Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 14:07:38 +0200 Subject: [PATCH 02/11] fix warning in biometrics activity --- .../choicesdk_app/biometrics/BiometricsActivity.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt b/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt index f2ade61..45134b9 100644 --- a/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt +++ b/ChoiceSDK/choicesdk-app/src/main/java/com/bluesource/choicesdk_app/biometrics/BiometricsActivity.kt @@ -22,7 +22,7 @@ class BiometricsActivity : AppCompatActivity() { setContentView(R.layout.activity_biometrics) val biometricManager = BiometricManager.from(this) - when (biometricManager.canAuthenticate()) { + when (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK)) { BiometricManager.BIOMETRIC_SUCCESS -> Log.d("ChoiceSdkApp", "App can authenticate using biometrics.") BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE -> @@ -30,10 +30,14 @@ class BiometricsActivity : AppCompatActivity() { BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE -> Log.e("ChoiceSdkApp", "Biometric features are currently unavailable.") BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED -> - Log.e( - "ChoiceSdkApp", "The user hasn't associated " + - "any biometric credentials with their account." - ) + Log.e("ChoiceSdkApp", "The user hasn't associated any biometric credentials with their account.") + BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED -> + Log.e("ChoiceSdkApp", "Biometric security update required.") + BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED -> + Log.e("ChoiceSdkApp", "Biometric error unsupported.") + BiometricManager.BIOMETRIC_STATUS_UNKNOWN -> + Log.e("ChoiceSdkApp", "Biometric status unknown.") + } From 9a1daf7074276f7afc5c93b6567be81d73bd09a7 Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 14:17:14 +0200 Subject: [PATCH 03/11] update dependencies (coroutines 1.5.1, rxrelay 3.0.1, play-services-auth 19.2.0) --- ChoiceSDK/build.gradle | 2 +- ChoiceSDK/choicesdk-analytics/build.gradle | 2 +- ChoiceSDK/choicesdk-app/build.gradle | 2 +- ChoiceSDK/choicesdk-location/build.gradle | 2 +- ChoiceSDK/choicesdk-maps/build.gradle | 2 +- ChoiceSDK/choicesdk-messaging/build.gradle | 2 +- ChoiceSDK/choicesdk-signin/build.gradle | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ChoiceSDK/build.gradle b/ChoiceSDK/build.gradle index 2a36cbf..12257b3 100644 --- a/ChoiceSDK/build.gradle +++ b/ChoiceSDK/build.gradle @@ -14,7 +14,7 @@ buildscript { project.ext.groupId = "at.bluesource.choicesdk" ext.kotlin_version = "1.5.21" - ext.coroutines_version = "1.5.0" + ext.coroutines_version = "1.5.1" repositories { google() diff --git a/ChoiceSDK/choicesdk-analytics/build.gradle b/ChoiceSDK/choicesdk-analytics/build.gradle index 80dba47..f01ac83 100644 --- a/ChoiceSDK/choicesdk-analytics/build.gradle +++ b/ChoiceSDK/choicesdk-analytics/build.gradle @@ -51,7 +51,7 @@ dependencies { api 'io.reactivex.rxjava3:rxandroid:3.0.0' // RxRelay - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-app/build.gradle b/ChoiceSDK/choicesdk-app/build.gradle index 7c3da33..64b4a25 100644 --- a/ChoiceSDK/choicesdk-app/build.gradle +++ b/ChoiceSDK/choicesdk-app/build.gradle @@ -91,7 +91,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'androidx.core:core-ktx:1.6.0' - implementation 'androidx.appcompat:appcompat:1.3.0' + implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'com.android.support:multidex:1.0.3' diff --git a/ChoiceSDK/choicesdk-location/build.gradle b/ChoiceSDK/choicesdk-location/build.gradle index 6b4e013..d7049bc 100644 --- a/ChoiceSDK/choicesdk-location/build.gradle +++ b/ChoiceSDK/choicesdk-location/build.gradle @@ -51,7 +51,7 @@ dependencies { api 'io.reactivex.rxjava3:rxandroid:3.0.0' // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-maps/build.gradle b/ChoiceSDK/choicesdk-maps/build.gradle index 96b4c38..d11e3ca 100644 --- a/ChoiceSDK/choicesdk-maps/build.gradle +++ b/ChoiceSDK/choicesdk-maps/build.gradle @@ -51,7 +51,7 @@ dependencies { api 'io.reactivex.rxjava3:rxandroid:3.0.0' // RxRelay - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-messaging/build.gradle b/ChoiceSDK/choicesdk-messaging/build.gradle index ceb8cac..026c0b7 100644 --- a/ChoiceSDK/choicesdk-messaging/build.gradle +++ b/ChoiceSDK/choicesdk-messaging/build.gradle @@ -55,7 +55,7 @@ dependencies { api 'io.reactivex.rxjava3:rxandroid:3.0.0' // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-signin/build.gradle b/ChoiceSDK/choicesdk-signin/build.gradle index bd14369..ddd3032 100644 --- a/ChoiceSDK/choicesdk-signin/build.gradle +++ b/ChoiceSDK/choicesdk-signin/build.gradle @@ -51,13 +51,13 @@ dependencies { api 'io.reactivex.rxjava3:rxandroid:3.0.0' // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0' + implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' // ChoiceSDK Core api project(":choicesdk-core") // GMS - implementation 'com.google.android.gms:play-services-auth:19.0.0' + implementation 'com.google.android.gms:play-services-auth:19.2.0' // HMS implementation 'com.huawei.hms:hwid:5.3.0.302' // account kit From 57fe6346a01dbbd099023822a284296252fddefd Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 14:43:22 +0200 Subject: [PATCH 04/11] move versions of common dependencies to root gradle file --- ChoiceSDK/build.gradle | 5 +++++ ChoiceSDK/choicesdk-analytics/build.gradle | 8 ++++---- ChoiceSDK/choicesdk-app/build.gradle | 2 +- ChoiceSDK/choicesdk-core/build.gradle | 2 +- ChoiceSDK/choicesdk-location/build.gradle | 8 ++++---- ChoiceSDK/choicesdk-maps/build.gradle | 8 ++++---- ChoiceSDK/choicesdk-messaging/build.gradle | 8 ++++---- ChoiceSDK/choicesdk-signin/build.gradle | 8 ++++---- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/ChoiceSDK/build.gradle b/ChoiceSDK/build.gradle index 12257b3..2567043 100644 --- a/ChoiceSDK/build.gradle +++ b/ChoiceSDK/build.gradle @@ -15,6 +15,11 @@ buildscript { ext.kotlin_version = "1.5.21" ext.coroutines_version = "1.5.1" + ext.ktlint_version = "0.42.0" + ext.core_ktx_version = "1.6.0" + ext.rxjava_version = "3.0.13" + ext.rxandroid_version = "3.0.0" + ext.rxrelay_version = "3.0.1" repositories { google() diff --git a/ChoiceSDK/choicesdk-analytics/build.gradle b/ChoiceSDK/choicesdk-analytics/build.gradle index f01ac83..bfeee8f 100644 --- a/ChoiceSDK/choicesdk-analytics/build.gradle +++ b/ChoiceSDK/choicesdk-analytics/build.gradle @@ -44,14 +44,14 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-app/build.gradle b/ChoiceSDK/choicesdk-app/build.gradle index 64b4a25..3cd38ff 100644 --- a/ChoiceSDK/choicesdk-app/build.gradle +++ b/ChoiceSDK/choicesdk-app/build.gradle @@ -90,7 +90,7 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'com.android.support:multidex:1.0.3' diff --git a/ChoiceSDK/choicesdk-core/build.gradle b/ChoiceSDK/choicesdk-core/build.gradle index 1feffdd..80357f0 100644 --- a/ChoiceSDK/choicesdk-core/build.gradle +++ b/ChoiceSDK/choicesdk-core/build.gradle @@ -44,7 +44,7 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // GMS implementation 'com.google.android.gms:play-services-base:17.6.0' diff --git a/ChoiceSDK/choicesdk-location/build.gradle b/ChoiceSDK/choicesdk-location/build.gradle index d7049bc..0bf47bc 100644 --- a/ChoiceSDK/choicesdk-location/build.gradle +++ b/ChoiceSDK/choicesdk-location/build.gradle @@ -44,14 +44,14 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-maps/build.gradle b/ChoiceSDK/choicesdk-maps/build.gradle index d11e3ca..531c71d 100644 --- a/ChoiceSDK/choicesdk-maps/build.gradle +++ b/ChoiceSDK/choicesdk-maps/build.gradle @@ -44,14 +44,14 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-messaging/build.gradle b/ChoiceSDK/choicesdk-messaging/build.gradle index 026c0b7..11decbe 100644 --- a/ChoiceSDK/choicesdk-messaging/build.gradle +++ b/ChoiceSDK/choicesdk-messaging/build.gradle @@ -44,18 +44,18 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-rx3:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutines_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") diff --git a/ChoiceSDK/choicesdk-signin/build.gradle b/ChoiceSDK/choicesdk-signin/build.gradle index ddd3032..9155e04 100644 --- a/ChoiceSDK/choicesdk-signin/build.gradle +++ b/ChoiceSDK/choicesdk-signin/build.gradle @@ -44,14 +44,14 @@ android { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.core:core-ktx:1.6.0' + implementation "androidx.core:core-ktx:$core_ktx_version" // RX - api 'io.reactivex.rxjava3:rxjava:3.0.13' - api 'io.reactivex.rxjava3:rxandroid:3.0.0' + api "io.reactivex.rxjava3:rxjava:$rxjava_version" + api "io.reactivex.rxjava3:rxandroid:$rxandroid_version" // RxRelay3 - implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.1' + implementation "com.jakewharton.rxrelay3:rxrelay:$rxrelay_version" // ChoiceSDK Core api project(":choicesdk-core") From a5d7bb86dc230edeea7f42304f1a2a69e358e5a8 Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 15:14:57 +0200 Subject: [PATCH 05/11] #15 add resource prefix to map fragment layout --- ChoiceSDK/choicesdk-analytics/build.gradle | 2 ++ ChoiceSDK/choicesdk-core/build.gradle | 2 ++ ChoiceSDK/choicesdk-location/build.gradle | 2 ++ ChoiceSDK/choicesdk-maps/build.gradle | 2 ++ .../java/at/bluesource/choicesdk/maps/common/MapFragment.kt | 2 +- .../res/layout/{fragment_map.xml => choicesdk_fragment_map.xml} | 0 ChoiceSDK/choicesdk-messaging/build.gradle | 2 ++ ChoiceSDK/choicesdk-signin/build.gradle | 2 ++ 8 files changed, 13 insertions(+), 1 deletion(-) rename ChoiceSDK/choicesdk-maps/src/main/res/layout/{fragment_map.xml => choicesdk_fragment_map.xml} (100%) diff --git a/ChoiceSDK/choicesdk-analytics/build.gradle b/ChoiceSDK/choicesdk-analytics/build.gradle index bfeee8f..61394ea 100644 --- a/ChoiceSDK/choicesdk-analytics/build.gradle +++ b/ChoiceSDK/choicesdk-analytics/build.gradle @@ -18,6 +18,8 @@ android { consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false diff --git a/ChoiceSDK/choicesdk-core/build.gradle b/ChoiceSDK/choicesdk-core/build.gradle index 80357f0..bec63ad 100644 --- a/ChoiceSDK/choicesdk-core/build.gradle +++ b/ChoiceSDK/choicesdk-core/build.gradle @@ -18,6 +18,8 @@ android { consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false diff --git a/ChoiceSDK/choicesdk-location/build.gradle b/ChoiceSDK/choicesdk-location/build.gradle index 0bf47bc..c5aebc1 100644 --- a/ChoiceSDK/choicesdk-location/build.gradle +++ b/ChoiceSDK/choicesdk-location/build.gradle @@ -18,6 +18,8 @@ android { consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false diff --git a/ChoiceSDK/choicesdk-maps/build.gradle b/ChoiceSDK/choicesdk-maps/build.gradle index 531c71d..3bd3775 100644 --- a/ChoiceSDK/choicesdk-maps/build.gradle +++ b/ChoiceSDK/choicesdk-maps/build.gradle @@ -18,6 +18,8 @@ android { consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt index e3c3067..ab7ca6c 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt @@ -92,7 +92,7 @@ open class MapFragment( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View? { - return inflater.inflate(R.layout.fragment_map, container, false) + return inflater.inflate(R.layout.choicesdk_fragment_map, container, false) } override fun onDestroy() { diff --git a/ChoiceSDK/choicesdk-maps/src/main/res/layout/fragment_map.xml b/ChoiceSDK/choicesdk-maps/src/main/res/layout/choicesdk_fragment_map.xml similarity index 100% rename from ChoiceSDK/choicesdk-maps/src/main/res/layout/fragment_map.xml rename to ChoiceSDK/choicesdk-maps/src/main/res/layout/choicesdk_fragment_map.xml diff --git a/ChoiceSDK/choicesdk-messaging/build.gradle b/ChoiceSDK/choicesdk-messaging/build.gradle index 11decbe..b5c33b8 100644 --- a/ChoiceSDK/choicesdk-messaging/build.gradle +++ b/ChoiceSDK/choicesdk-messaging/build.gradle @@ -18,6 +18,8 @@ android { consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false diff --git a/ChoiceSDK/choicesdk-signin/build.gradle b/ChoiceSDK/choicesdk-signin/build.gradle index 9155e04..999d703 100644 --- a/ChoiceSDK/choicesdk-signin/build.gradle +++ b/ChoiceSDK/choicesdk-signin/build.gradle @@ -18,6 +18,8 @@ android { consumerProguardFiles "consumer-rules.pro" } + resourcePrefix 'choicesdk' + buildTypes { release { minifyEnabled false From 9952b1627a33a632598f89280dc8fd5e7bca7094 Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 15:18:34 +0200 Subject: [PATCH 06/11] update Firebase BoM to 28.3.0 --- ChoiceSDK/build.gradle | 2 ++ ChoiceSDK/choicesdk-analytics/build.gradle | 2 +- ChoiceSDK/choicesdk-messaging/build.gradle | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChoiceSDK/build.gradle b/ChoiceSDK/build.gradle index 2567043..d8c942e 100644 --- a/ChoiceSDK/build.gradle +++ b/ChoiceSDK/build.gradle @@ -21,6 +21,8 @@ buildscript { ext.rxandroid_version = "3.0.0" ext.rxrelay_version = "3.0.1" + ext.firebase_bom_version = "28.3.0" + repositories { google() gradlePluginPortal() diff --git a/ChoiceSDK/choicesdk-analytics/build.gradle b/ChoiceSDK/choicesdk-analytics/build.gradle index 61394ea..c201662 100644 --- a/ChoiceSDK/choicesdk-analytics/build.gradle +++ b/ChoiceSDK/choicesdk-analytics/build.gradle @@ -59,7 +59,7 @@ dependencies { api project(":choicesdk-core") // GMS - implementation platform('com.google.firebase:firebase-bom:28.2.0') + implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version") implementation 'com.google.firebase:firebase-analytics-ktx' // HMS diff --git a/ChoiceSDK/choicesdk-messaging/build.gradle b/ChoiceSDK/choicesdk-messaging/build.gradle index b5c33b8..2ad0a71 100644 --- a/ChoiceSDK/choicesdk-messaging/build.gradle +++ b/ChoiceSDK/choicesdk-messaging/build.gradle @@ -63,7 +63,7 @@ dependencies { api project(":choicesdk-core") // GMS - implementation platform('com.google.firebase:firebase-bom:28.2.0') + implementation platform("com.google.firebase:firebase-bom:$firebase_bom_version") implementation 'com.google.firebase:firebase-messaging-ktx' // HMS From ac2b5810d1d1b3da3f2c0daf727f83e82bfbffec Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Mon, 2 Aug 2021 15:48:35 +0200 Subject: [PATCH 07/11] #16 #17 provide map options for MapFragment via arguments to have an empty fragment constructor --- ChoiceSDK/choicesdk-maps/build.gradle | 1 + .../choicesdk/maps/common/MapFragment.kt | 14 ++++++++++---- .../bluesource/choicesdk/maps/common/MapOptions.kt | 3 ++- .../bluesource/choicesdk/maps/gms/GmsMapOptions.kt | 8 ++++++-- .../bluesource/choicesdk/maps/hms/HmsMapOptions.kt | 8 ++++++-- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ChoiceSDK/choicesdk-maps/build.gradle b/ChoiceSDK/choicesdk-maps/build.gradle index 3bd3775..95dc0f6 100644 --- a/ChoiceSDK/choicesdk-maps/build.gradle +++ b/ChoiceSDK/choicesdk-maps/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'kotlin-parcelize' id 'org.jetbrains.dokka' } diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt index ab7ca6c..bfde3e1 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapFragment.kt @@ -23,9 +23,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable * @see com.google.android.gms.maps.SupportMapFragment * @see com.huawei.hms.maps.SupportMapFragment */ -open class MapFragment( - private val options: MapOptions? -) : Fragment() { +open class MapFragment : Fragment() { private val disposables = CompositeDisposable() @@ -46,6 +44,8 @@ open class MapFragment( override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + val options: MapOptions? = arguments?.getParcelable(ARG_MAP_OPTIONS) + val mapFragment: Fragment = when (MobileServicesDetector.getAvailableMobileService()) { MobileService.GMS -> { val instance = if (options == null) { @@ -102,6 +102,8 @@ open class MapFragment( companion object { + private const val ARG_MAP_OPTIONS = "ARG_MAP_OPTIONS" + @JvmStatic fun newInstance(): MapFragment { return newInstance(null) @@ -109,7 +111,11 @@ open class MapFragment( @JvmStatic fun newInstance(options: MapOptions? = null): MapFragment { - return MapFragment(options) + return MapFragment().apply { + arguments = Bundle().apply { + putParcelable(ARG_MAP_OPTIONS, options) + } + } } } } \ No newline at end of file diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt index 144539c..a4990f6 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/MapOptions.kt @@ -1,5 +1,6 @@ package at.bluesource.choicesdk.maps.common +import android.os.Parcelable import at.bluesource.choicesdk.core.MobileService import at.bluesource.choicesdk.core.MobileServicesDetector import at.bluesource.choicesdk.maps.gms.GmsMapOptionsFactory @@ -7,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsMapOptionsFactory import com.google.android.gms.maps.GoogleMapOptions import com.huawei.hms.maps.HuaweiMapOptions -interface MapOptions { +interface MapOptions : Parcelable { val liteMode: Boolean? val mapToolbarEnabled: Boolean? diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt index a1750a9..590063e 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsMapOptions.kt @@ -1,11 +1,15 @@ package at.bluesource.choicesdk.maps.gms +import android.os.Parcelable import at.bluesource.choicesdk.maps.common.MapOptions import com.google.android.gms.maps.GoogleMapOptions +import kotlinx.parcelize.Parcelize -internal class GmsMapOptions : MapOptions { - private val mapOptions = GoogleMapOptions() +@Parcelize +internal class GmsMapOptions( + private val mapOptions: GoogleMapOptions = GoogleMapOptions() +) : MapOptions, Parcelable { override val liteMode: Boolean? get() = mapOptions.liteMode diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt index 1c73fc8..27e39ba 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/hms/HmsMapOptions.kt @@ -1,11 +1,15 @@ package at.bluesource.choicesdk.maps.hms +import android.os.Parcelable import at.bluesource.choicesdk.maps.common.MapOptions import com.huawei.hms.maps.HuaweiMapOptions +import kotlinx.parcelize.Parcelize -internal class HmsMapOptions : MapOptions { - private val mapOptions = HuaweiMapOptions() +@Parcelize +internal class HmsMapOptions( + private val mapOptions: HuaweiMapOptions = HuaweiMapOptions() +) : MapOptions, Parcelable { override val liteMode: Boolean? get() = mapOptions.liteMode From aef1dc7f26688203105e463124490bf1deb4a07a Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Tue, 3 Aug 2021 08:58:17 +0200 Subject: [PATCH 08/11] fix javadoc of some factories --- .../bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt | 2 +- .../choicesdk/location/factory/FusedLocationProviderFactory.kt | 2 +- .../choicesdk/location/factory/SettingsClientFactory.kt | 2 +- .../choicesdk/maps/factory/BitmapDescriptorFactory.kt | 2 +- .../choicesdk/maps/factory/GroundOverlayOptionsFactory.kt | 2 +- .../bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt | 2 +- .../choicesdk/maps/factory/TileOverlayOptionsFactory.kt | 2 +- .../bluesource/choicesdk/messaging/factory/MessagingFactory.kt | 2 +- .../choicesdk/messaging/factory/MessagingRepositoryFactory.kt | 2 +- .../at/bluesource/choicesdk/signin/factory/SignInFactory.kt | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt b/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt index af46e5a..e2d42d1 100644 --- a/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt +++ b/ChoiceSDK/choicesdk-analytics/src/main/java/at/bluesource/choicesdk/analytics/factory/AnalyticsFactory.kt @@ -11,7 +11,7 @@ import at.bluesource.choicesdk.core.MobileServicesDetector /** * Analytics factory, uses [MobileServicesDetector] to get instance of [Analytics] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt index 0e30b49..066fe94 100644 --- a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt +++ b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/FusedLocationProviderFactory.kt @@ -10,7 +10,7 @@ import at.bluesource.choicesdk.location.hms.HmsFusedLocationProviderClient /** * FusedLocationProvider factory, uses [MobileServicesDetector] to get instance of [FusedLocationProviderClient] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt index 7fe95f6..ba67b87 100644 --- a/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt +++ b/ChoiceSDK/choicesdk-location/src/main/java/at/bluesource/choicesdk/location/factory/SettingsClientFactory.kt @@ -11,7 +11,7 @@ import com.google.android.gms.location.LocationServices /** * SettingsClient factory, uses [MobileServicesDetector] to get instance of [SettingsClient] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt index 7839f05..48eeaec 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/BitmapDescriptorFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsBitmapDescriptorFactory /** * BitmapDescriptorFactory factory, uses [MobileServicesDetector] to get instance of [BitmapDescriptorFactory] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt index bf024f3..1237904 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/GroundOverlayOptionsFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsGroundOverlayOptions /** * GroundOverlayOptions factory, uses [MobileServicesDetector] to get instance of [GroundOverlayOptions] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt index c04304e..e32c5ac 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/MarkerOptionsFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsMarkerOptions /** * MarkerOptions factory, uses [MobileServicesDetector] to get instance of [MarkerOptions] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt index 8f75c71..5fa54d6 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileOverlayOptionsFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.maps.hms.HmsTileOverlayOptions /** * TileOverlayOptions factory, uses [MobileServicesDetector] to get instance of [TileOverlayOptions] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt index c87ce64..694e34b 100644 --- a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt +++ b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingFactory.kt @@ -9,7 +9,7 @@ import at.bluesource.choicesdk.messaging.hms.HmsMessaging /** * Messaging factory, uses [MobileServicesDetector] to get instance of [Messaging] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt index 7eaecbe..625a181 100644 --- a/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt +++ b/ChoiceSDK/choicesdk-messaging/src/main/java/at/bluesource/choicesdk/messaging/factory/MessagingRepositoryFactory.kt @@ -10,7 +10,7 @@ import at.bluesource.choicesdk.messaging.hms.HmsTokenProvider /** * MessagingRepository factory, uses [MobileServicesDetector] to get instance of [MessagingService] and [TokenProvider] (repository) - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * diff --git a/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt b/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt index 44092cd..f98a793 100644 --- a/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt +++ b/ChoiceSDK/choicesdk-signin/src/main/java/at/bluesource/choicesdk/signin/factory/SignInFactory.kt @@ -8,7 +8,7 @@ import at.bluesource.choicesdk.signin.hms.HmsSignInService /** * SignIn factory, uses [MobileServicesDetector] to get instance of [SignInService] - * Automatically decides if GMS or HMS should be used. GMS is always preferred first. + * Automatically decides if GMS or HMS should be used. * * Throws [UnsupportedOperationException] if no underlying api has been found. * From bfcfa5cb7d17a823f3a982a2437b6890774b86bb Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Tue, 3 Aug 2021 08:59:00 +0200 Subject: [PATCH 09/11] #14 add tile provider factory --- .../choicesdk/maps/common/TileProvider.kt | 5 +++ .../maps/factory/TileProviderFactory.kt | 34 +++++++++++++++++++ .../choicesdk/maps/gms/GmsTileProvider.kt | 4 +-- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt index dd2662a..522edd0 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/common/TileProvider.kt @@ -1,5 +1,6 @@ package at.bluesource.choicesdk.maps.common +import at.bluesource.choicesdk.maps.factory.TileProviderFactory import at.bluesource.choicesdk.maps.gms.GmsTileProvider import at.bluesource.choicesdk.maps.hms.HmsTileProvider @@ -20,6 +21,10 @@ fun interface TileProvider { @JvmStatic fun noTile(): Tile = Tile.getFactory().create(-1, -1, null) + fun create(getTile: (x: Int, y: Int, zoom: Int) -> Tile?): TileProvider { + return TileProviderFactory.getTileProvider(getTile) + } + @JvmStatic fun com.google.android.gms.maps.model.TileProvider.toChoiceTileProvider(): TileProvider { return GmsTileProvider(this@toChoiceTileProvider) diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt new file mode 100644 index 0000000..72a442c --- /dev/null +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/factory/TileProviderFactory.kt @@ -0,0 +1,34 @@ +package at.bluesource.choicesdk.maps.factory + +import at.bluesource.choicesdk.core.MobileService +import at.bluesource.choicesdk.core.MobileServicesDetector +import at.bluesource.choicesdk.maps.common.Tile +import at.bluesource.choicesdk.maps.common.TileProvider +import at.bluesource.choicesdk.maps.gms.GmsTileProvider +import at.bluesource.choicesdk.maps.hms.HmsTileProvider + +/** + * TileProvider factory, uses [MobileServicesDetector] to get instance of [TileProvider] + * Automatically decides if GMS or HMS should be used. + * + * Throws [UnsupportedOperationException] if no underlying api has been found. + * + * @see GmsTileProvider + * @see HmsTileProvider + */ +internal class TileProviderFactory { + companion object { + @Throws(UnsupportedOperationException::class) + fun getTileProvider(getTile: (x: Int, y: Int, zoom: Int) -> Tile?): TileProvider { + return when (MobileServicesDetector.getAvailableMobileService()) { + MobileService.GMS -> GmsTileProvider { x, y, zoom -> + getTile.invoke(x, y, zoom)?.let { com.google.android.gms.maps.model.Tile(it.width, it.height, it.data) } + } + + MobileService.HMS -> HmsTileProvider { x, y, zoom -> + getTile.invoke(x, y, zoom)?.let { com.huawei.hms.maps.model.Tile(it.width, it.height, it.data) } + } + } + } + } +} \ No newline at end of file diff --git a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt index c94fc29..6f4bcfa 100644 --- a/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt +++ b/ChoiceSDK/choicesdk-maps/src/main/java/at/bluesource/choicesdk/maps/gms/GmsTileProvider.kt @@ -10,8 +10,8 @@ import at.bluesource.choicesdk.maps.common.TileProvider * @property tileProvider gms TileProvider instance * @see com.google.android.gms.maps.model.TileProvider */ -internal class GmsTileProvider(private val tileProvider: com.google.android.gms.maps.model.TileProvider) : - TileProvider { +internal class GmsTileProvider(private val tileProvider: com.google.android.gms.maps.model.TileProvider) : TileProvider { + override fun getTile(x: Int, y: Int, zoom: Int): Tile? { return tileProvider.getTile(x, y, zoom)?.toChoiceTile() } From 8e174958c42280350f08c9bb610cb84f5f2f023e Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Tue, 3 Aug 2021 09:00:08 +0200 Subject: [PATCH 10/11] bump version to 0.3.0 --- ChoiceSDK/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChoiceSDK/build.gradle b/ChoiceSDK/build.gradle index d8c942e..f0f7478 100644 --- a/ChoiceSDK/build.gradle +++ b/ChoiceSDK/build.gradle @@ -8,9 +8,9 @@ buildscript { } project.ext.buildNumber = buildNumber - project.ext.sdkVersionName = "0.2.0" + project.ext.sdkVersionName = "0.3.0" project.ext.appVersionName = "${project.sdkVersionName}.${project.buildNumber}" - project.ext.versionCode = 8 + project.ext.versionCode = 9 project.ext.groupId = "at.bluesource.choicesdk" ext.kotlin_version = "1.5.21" From 1925803a06d4538317cceb0dea1c2984f54d9391 Mon Sep 17 00:00:00 2001 From: Stefan Brabenetz Date: Tue, 3 Aug 2021 09:09:30 +0200 Subject: [PATCH 11/11] update documentation --- README.md | 2 +- documentation/map.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9de4fc3..595afa5 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ apply plugin: 'com.huawei.agconnect' Add the following dependencies as required to your app. GMS, Firebase and HMS dependencies are included, so they do not need to be declared in your app. ```gradle dependencies { - def choicesdk_version = '0.2.0' + def choicesdk_version = '0.3.0' implementation "at.bluesource.choicesdk:choicesdk-analytics:$choicesdk_version" implementation "at.bluesource.choicesdk:choicesdk-location:$choicesdk_version" implementation "at.bluesource.choicesdk:choicesdk-maps:$choicesdk_version" diff --git a/documentation/map.md b/documentation/map.md index a3ac8fd..f35ff18 100644 --- a/documentation/map.md +++ b/documentation/map.md @@ -109,6 +109,15 @@ map.addPolyline( ) ``` +Adding a tile provider: +```kotlin +val tileProvider = TileProvider.create { x, y, zoom -> + // TODO return a ChoiceSDK tile via Tile.getFactory().create(...) +} +val tileOverlayOptions = TileOverlayOptions.create().tileProvider(tileProvider) +map.addTileOverlay(tileOverlayOptions) +``` + The Google or Huawei map object can be retrieved for use-cases which ChoiceSDK does not provide, e.g. clustering. Please note that you need to add the corresponding GMS/HMS dependencies in your `build.gradle` file. ```kotlin val googleMap: com.google.android.gms.maps.GoogleMap? = map.getGoogleMap()