Skip to content

Commit

Permalink
Clean code: remove version
Browse files Browse the repository at this point in the history
  • Loading branch information
furenster committed Oct 17, 2024
1 parent 6899c39 commit c2d47c5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ interface ConfigRepository {

fun setAuthRequired(enabled: Boolean)

fun getAppVersion(): String

fun setAppVersion(version: String, type: AppVersionType)

fun appVersionActual(current: String): Boolean

fun getAppVersionSkip(): String

fun setAppVersionSkip(version: String)
Expand Down Expand Up @@ -81,12 +75,6 @@ interface ConfigRepository {

fun increaseLaunchNumber()

enum class AppVersionType {
Alpha,
Beta,
Prod,
}

companion object {
fun getGemNodeUrl(chain: Chain) = "https://${chain.string}.gemnodes.com"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,6 @@ class OfflineFirstConfigRepository(
putBoolean(Keys.Auth, enabled)
}

override fun getAppVersion(): String = getString(Keys.AppVersionProd)

override fun setAppVersion(version: String, type: ConfigRepository.AppVersionType) {
val key = when (type) {
ConfigRepository.AppVersionType.Alpha -> Keys.AppVersionAlpha
ConfigRepository.AppVersionType.Beta -> Keys.AppVersionBeta
ConfigRepository.AppVersionType.Prod -> Keys.AppVersionProd
}
putString(key, version)
}

override fun appVersionActual(current: String): Boolean {
if (BuildConfig.DEBUG) {
return true
}
val appAppVersion = getAppVersion()
return current.compareTo(appAppVersion) >= 0
}

override fun setAppVersionSkip(version: String) {
putString(Keys.AppVersionSkip, version)
}
Expand Down Expand Up @@ -217,9 +198,6 @@ class OfflineFirstConfigRepository(
enum class Keys(val string: String) {
Auth("auth"),
DeviceId("device-uuid"),
AppVersionProd("app-version-production"),
AppVersionBeta("app-version-beta"),
AppVersionAlpha("app-version-alpha"),
AppVersionSkip("app-version-skip"),
FiatAssetsVersion("fiat-assets-version"),
FiatAssetsOfflineVersion("fiat-offline-version"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class SyncConfig(
private fun saveConfig(config: ConfigResponse) {
with(configRepository) {
setFiatAssetsVersion(config.versions.fiatAssets)
setAppVersion(config.app.android.version.alpha, ConfigRepository.AppVersionType.Alpha)
setAppVersion(config.app.android.version.beta, ConfigRepository.AppVersionType.Beta)
setAppVersion(config.app.android.version.production, ConfigRepository.AppVersionType.Prod)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ data class AptosAccount (
val sequence_number: String
)

@Serializable
data class AptosError (
val message: String,
val error_code: String
)

@Serializable
data class AptosGasFee (
val gas_estimate: Int,
Expand Down Expand Up @@ -42,11 +48,19 @@ data class AptosResourceBalance (

@Serializable
data class AptosTransaction (
val success: Boolean
val success: Boolean,
val gas_used: String,
val gas_unit_price: String
)

@Serializable
data class AptosTransactionBroacast (
val hash: String
)

@Serializable
enum class AptosErrorCode(val string: String) {
@SerialName("account_not_found")
account_not_found("account_not_found"),
}

1 change: 0 additions & 1 deletion gemcore/src/main/java/com/wallet/core/primitives/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ data class ConfigVersions (

@Serializable
data class ConfigResponse (
val app: ConfigApp,
val releases: List<Release>,
val versions: ConfigVersions
)
Expand Down

0 comments on commit c2d47c5

Please sign in to comment.