Updated on 2026-08-14
This commit is contained in:
parent
26bba893ff
commit
51e650c360
47 changed files with 1628 additions and 73 deletions
|
|
@ -3,6 +3,10 @@
|
|||
"name": "AND_15901_STORIES_CONTAINER_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "TWI_1322_FORCE_UPDATE_ENABLED",
|
||||
"version": "undefined"
|
||||
},
|
||||
{
|
||||
"name": "NEW_CARD_SCANNING_ENABLED",
|
||||
"version": "undefined"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ interface TangemTechApi {
|
|||
@GET("v1/geo")
|
||||
suspend fun getUserCountryCode(): GeoResponse
|
||||
|
||||
@GET("v1/application/versions")
|
||||
suspend fun getApplicationVersions(): ApiResponse<ApplicationVersionsResponse>
|
||||
|
||||
@PUT("/v1/wallets/{walletId}/tokens")
|
||||
suspend fun saveTokens(
|
||||
@Path(value = "walletId") userId: String,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.tangem.datasource.api.tangemTech.models
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
/**
|
||||
* Response of `GET v1/application/versions`. All fields are nullable — the backend may omit any, in
|
||||
* which case the corresponding check is skipped.
|
||||
*
|
||||
* @property minSupportedVersion app version threshold for a mandatory update: if
|
||||
* `installedVersion <= minSupportedVersion` the app must force-update (or show "update your OS"
|
||||
* when [minSupportedOSVersion] is not met). Inclusive. E.g. "5.30".
|
||||
* @property minSupportedOSVersion minimal device OS version required to install the update for the
|
||||
* [minSupportedVersion] case: if `deviceOsVersion < minSupportedOSVersion` the device can't update
|
||||
* and the "OS too old" screen is shown. Exclusive.
|
||||
* @property criticalVersion app version threshold for a critical mandatory update: if
|
||||
* `installedVersion <= criticalVersion` the app must force-update (or permanently "brick" when
|
||||
* [criticalOSVersion] is not met). Inclusive.
|
||||
* @property criticalOSVersion minimal device OS version required to install the critical update:
|
||||
* if `deviceOsVersion < criticalOSVersion` the app is bricked (update impossible). Exclusive.
|
||||
* @property latestVersion latest available app version: if `installedVersion < latestVersion`
|
||||
* an optional update is offered. Exclusive. E.g. "5.40".
|
||||
*/
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class ApplicationVersionsResponse(
|
||||
@Json(name = "minSupportedVersion") val minSupportedVersion: String?,
|
||||
@Json(name = "minSupportedOSVersion") val minSupportedOSVersion: String?,
|
||||
@Json(name = "criticalVersion") val criticalVersion: String?,
|
||||
@Json(name = "criticalOSVersion") val criticalOSVersion: String?,
|
||||
@Json(name = "latestVersion") val latestVersion: String?,
|
||||
)
|
||||
|
|
@ -33,6 +33,16 @@ object PreferencesKeys {
|
|||
|
||||
val APP_LAUNCH_COUNT_KEY by lazy { intPreferencesKey(name = "launchCount") }
|
||||
|
||||
val LAST_OPTIONAL_UPDATE_SHOWN_VERSION_KEY by lazy {
|
||||
stringPreferencesKey(name = "lastOptionalUpdateShownVersion")
|
||||
}
|
||||
|
||||
val LAST_OPTIONAL_UPDATE_SHOWN_AT_KEY by lazy { longPreferencesKey(name = "lastOptionalUpdateShownAt") }
|
||||
|
||||
val CACHED_APP_VERSIONS_KEY by lazy { stringPreferencesKey(name = "cachedApplicationVersions") }
|
||||
|
||||
val CACHED_APP_VERSIONS_AT_KEY by lazy { longPreferencesKey(name = "cachedApplicationVersionsAt") }
|
||||
|
||||
val SHOW_RATING_DIALOG_AT_LAUNCH_COUNT_KEY by lazy { intPreferencesKey(name = "showRatingDialogAtLaunchCount") }
|
||||
|
||||
val FUNDS_FOUND_DATE_KEY by lazy { longPreferencesKey(name = "fundsFoundDate") }
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ android {
|
|||
|
||||
dependencies {
|
||||
|
||||
// region Core modules
|
||||
implementation(projects.core.utils)
|
||||
// endregion
|
||||
|
||||
// region DI
|
||||
implementation(deps.hilt.android)
|
||||
// endregion
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
package com.tangem.core.navigation.url
|
||||
|
||||
interface AppStoreOpener {
|
||||
|
||||
fun openStorePage()
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.tangem.core.navigation.url
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.net.toUri
|
||||
import com.tangem.utils.buildConfig.AppConfigurationProvider
|
||||
import com.tangem.utils.logging.TangemLogger
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
|
||||
class DefaultAppStoreOpener @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
private val appConfigurationProvider: AppConfigurationProvider,
|
||||
) : AppStoreOpener {
|
||||
|
||||
override fun openStorePage() {
|
||||
val storeUri: String
|
||||
val webUrl: String
|
||||
if (appConfigurationProvider.isHuawei()) {
|
||||
storeUri = "$HUAWEI_STORE_SCHEME$STORE_PACKAGE_NAME"
|
||||
webUrl = "$HUAWEI_WEB_URL$STORE_PACKAGE_NAME"
|
||||
} else {
|
||||
storeUri = "$GOOGLE_STORE_SCHEME$STORE_PACKAGE_NAME"
|
||||
webUrl = "$GOOGLE_WEB_URL$STORE_PACKAGE_NAME"
|
||||
}
|
||||
|
||||
openUri(storeUri) || openUri(webUrl)
|
||||
}
|
||||
|
||||
private fun openUri(uri: String): Boolean {
|
||||
return try {
|
||||
context.startActivity(
|
||||
Intent(Intent.ACTION_VIEW, uri.toUri()).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||
)
|
||||
true
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
TangemLogger.e("Unable to open store uri: $uri", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
const val STORE_PACKAGE_NAME = "com.tangem.wallet"
|
||||
const val GOOGLE_STORE_SCHEME = "market://details?id="
|
||||
const val GOOGLE_WEB_URL = "https://play.google.com/store/apps/details?id="
|
||||
const val HUAWEI_STORE_SCHEME = "appmarket://details?id="
|
||||
const val HUAWEI_WEB_URL = "https://appgallery.huawei.com/app/"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue