From 6c0384495f5c916dc1d1a351b8630053b618226a Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Sun, 8 May 2022 20:56:16 +0300 Subject: [PATCH] [#676] add huawei link to Support Us logic (#693) --- .../com/oztechan/ccc/android/ui/main/MainActivity.kt | 3 ++- .../ccc/android/ui/settings/SettingsFragment.kt | 5 +++-- .../kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt | 10 ++++++++++ resources/src/commonMain/resources/MR/base/strings.xml | 5 +++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt index d1a4e3ba5d..22db800b96 100755 --- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt +++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt @@ -16,6 +16,7 @@ import com.github.submob.basemob.activity.BaseActivity import com.oztechan.ccc.ad.AdManager import com.oztechan.ccc.analytics.AnalyticsManager import com.oztechan.ccc.analytics.model.UserProperty +import com.oztechan.ccc.android.util.getMarketLink import com.oztechan.ccc.android.util.requestAppReview import com.oztechan.ccc.android.util.showDialog import com.oztechan.ccc.android.util.updateAppTheme @@ -67,7 +68,7 @@ class MainActivity : BaseActivity() { positiveButton = R.string.update, cancelable = isCancelable ) { - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_market_link)))) + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getMarketLink()))) } private fun checkDestination() = with(getNavigationController()) { diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt index 7f5367ca91..4ebacd9b06 100644 --- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt +++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt @@ -15,6 +15,7 @@ import com.github.submob.basemob.fragment.BaseVBFragment import com.oztechan.ccc.ad.AdManager import com.oztechan.ccc.analytics.AnalyticsManager import com.oztechan.ccc.analytics.model.FirebaseEvent +import com.oztechan.ccc.android.util.getMarketLink import com.oztechan.ccc.android.util.setBannerAd import com.oztechan.ccc.android.util.showDialog import com.oztechan.ccc.android.util.showSingleChoiceDialog @@ -151,7 +152,7 @@ class SettingsFragment : BaseVBFragment() { startIntent( Intent( Intent.ACTION_VIEW, - Uri.parse(getString(R.string.app_market_link)) + Uri.parse(requireContext().getMarketLink()) ) ) } @@ -228,7 +229,7 @@ class SettingsFragment : BaseVBFragment() { private fun share() = Intent(Intent.ACTION_SEND).apply { type = TEXT_TYPE - putExtra(Intent.EXTRA_TEXT, getString(R.string.app_market_link)) + putExtra(Intent.EXTRA_TEXT, requireContext().getMarketLink()) startActivity(Intent.createChooser(this, getString(R.string.settings_item_share_title))) } diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt b/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt index cebcb08749..17850d0115 100644 --- a/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt +++ b/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt @@ -9,7 +9,10 @@ import android.content.res.Configuration import android.content.res.Resources import android.os.Build import androidx.appcompat.app.AppCompatDelegate +import com.oztechan.ccc.client.device import com.oztechan.ccc.client.model.AppTheme +import com.oztechan.ccc.client.model.Device +import mustafaozhan.github.com.mycurrencies.R import java.util.Locale fun updateBaseContextLocale(context: Context): Context? { @@ -45,3 +48,10 @@ private fun updateResourcesLocaleLegacy(context: Context, locale: Locale): Conte resources.updateConfiguration(configuration, resources.displayMetrics) return context } + +fun Context.getMarketLink() = getString( + when (device as Device.ANDROID) { + Device.ANDROID.GOOGLE -> R.string.app_market_link_google + Device.ANDROID.HUAWEI -> R.string.app_market_link_huawei + } +) diff --git a/resources/src/commonMain/resources/MR/base/strings.xml b/resources/src/commonMain/resources/MR/base/strings.xml index 14aa40125c..fc3eab78ff 100644 --- a/resources/src/commonMain/resources/MR/base/strings.xml +++ b/resources/src/commonMain/resources/MR/base/strings.xml @@ -52,7 +52,9 @@ Copied to clipboard! - Please rate us and review the app on Google Play Store :) + You can rate us and review our app in the market :) + https://play.google.com/store/apps/details?id=mustafaozhan.github.com.mycurrencies + https://appgallery.huawei.com/app/C104920917 RATE Update https://github.com/CurrencyConverterCalculator/CCC @@ -63,7 +65,6 @@ Feedback for CCC Dear Developer, Send Feedback: - https://play.google.com/store/apps/details?id=mustafaozhan.github.com.mycurrencies NEXT