Skip to content

Commit 4e7df87

Browse files
authored
FOSS : Remove app version check (#72)
* FOSS : Remove app version check - Patch 1 * FOSS : Remove app version check - Patch 2
1 parent 289b372 commit 4e7df87

File tree

8 files changed

+26
-23
lines changed

8 files changed

+26
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Stable-Diffusion-Android
44

5-
[![Version](https://img.shields.io/badge/Version-0.4.9-blue)](https://github.com/ShiftHackZ/Stable-Diffusion-Android/releases)
5+
[![Version](https://img.shields.io/badge/Version-0.4.10-blue)](https://github.com/ShiftHackZ/Stable-Diffusion-Android/releases)
66

77

88
[![Google Play](docs/assets/google_play.png)](https://play.google.com/store/apps/details?id=com.shifthackz.aisdv1.app)

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ android {
2121
namespace 'com.shifthackz.aisdv1.app'
2222
defaultConfig {
2323
applicationId "com.shifthackz.aisdv1.app"
24-
versionName "0.4.9"
25-
versionCode 156
24+
versionName "0.4.10"
25+
versionCode 157
2626

2727
buildConfigField "String", "CLOUD_AI_URL", "\"https://sdai.moroz.cc\""
2828
buildConfigField "String", "HORDE_AI_URL", "\"https://stablehorde.net\""
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
package com.shifthackz.aisdv1.data.remote
22

3-
import com.shifthackz.aisdv1.core.common.appbuild.BuildInfoProvider
43
import com.shifthackz.aisdv1.core.common.appbuild.BuildVersion
54
import com.shifthackz.aisdv1.domain.datasource.AppVersionDataSource
65
import com.shifthackz.aisdv1.network.api.sdai.AppUpdateRestApi
6+
import com.shifthackz.aisdv1.network.response.AppVersionResponse
77
import io.reactivex.rxjava3.core.Single
88

99
internal class AppVersionRemoteDataSource(
10-
private val buildInfoProvider: BuildInfoProvider,
1110
private val api: AppUpdateRestApi,
1211
) : AppVersionDataSource.Remote {
1312

1413
override fun get(): Single<BuildVersion> = api
1514
.fetchAppVersion()
16-
.map { response ->
17-
val version = when (buildInfoProvider.buildType) {
18-
com.shifthackz.aisdv1.core.common.appbuild.BuildType.FOSS -> response.fDroid
19-
com.shifthackz.aisdv1.core.common.appbuild.BuildType.GOOGLE_PLAY -> response.googlePlay
20-
}
21-
BuildVersion(version)
22-
}
15+
.map(AppVersionResponse::googlePlay)
16+
.map(::BuildVersion)
2317
}
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package com.shifthackz.aisdv1.domain.usecase.version
22

3+
import com.shifthackz.aisdv1.core.common.appbuild.BuildInfoProvider
4+
import com.shifthackz.aisdv1.core.common.appbuild.BuildType
35
import com.shifthackz.aisdv1.core.common.appbuild.BuildVersion
46
import com.shifthackz.aisdv1.domain.repository.AppVersionRepository
57
import io.reactivex.rxjava3.core.Single
68

79
internal class CheckAppVersionUpdateUseCaseImpl(
10+
private val buildInfoProvider: BuildInfoProvider,
811
private val repository: AppVersionRepository,
912
) : CheckAppVersionUpdateUseCase {
1013

@@ -18,13 +21,18 @@ internal class CheckAppVersionUpdateUseCaseImpl(
1821
repository.getLocalVersion()
1922
}
2023

21-
override fun invoke() = Single
22-
.zip(remoteVersionProducer(), localVersionProducer(), ::Pair)
23-
.map { (actualVer, localVer) ->
24-
if (localVer < actualVer) {
25-
CheckAppVersionUpdateUseCase.Result.NewVersionAvailable(actualVer)
26-
} else {
27-
CheckAppVersionUpdateUseCase.Result.NoUpdateNeeded
28-
}
24+
override fun invoke(): Single<CheckAppVersionUpdateUseCase.Result> =
25+
when (buildInfoProvider.buildType) {
26+
BuildType.GOOGLE_PLAY -> Single
27+
.zip(remoteVersionProducer(), localVersionProducer(), ::Pair)
28+
.map { (actualVer, localVer) ->
29+
if (localVer < actualVer) {
30+
CheckAppVersionUpdateUseCase.Result.NewVersionAvailable(actualVer)
31+
} else {
32+
CheckAppVersionUpdateUseCase.Result.NoUpdateNeeded
33+
}
34+
}
35+
36+
else -> Single.just(CheckAppVersionUpdateUseCase.Result.NoUpdateNeeded)
2937
}
3038
}

network/src/main/java/com/shifthackz/aisdv1/network/response/AppVersionResponse.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ import com.google.gson.annotations.SerializedName
55
data class AppVersionResponse(
66
@SerializedName("googleplay")
77
val googlePlay: String,
8-
@SerializedName("fdroid")
9-
val fDroid: String
108
)

presentation/src/main/java/com/shifthackz/aisdv1/presentation/screen/settings/SettingsContract.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sealed interface SettingsState : MviState {
2727
val saveToMediaStore: Boolean,
2828
val formAdvancedOptionsAlwaysShow: Boolean,
2929
val appVersion: String,
30+
val showCheckForUpdates: Boolean,
3031
val showRewardedSdAiAd: Boolean,
3132
val showSdModelSelector: Boolean,
3233
val showMonitorConnectionOption: Boolean,

presentation/src/main/java/com/shifthackz/aisdv1/presentation/screen/settings/SettingsScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private fun ContentSettingsState(
323323
text = R.string.settings_item_report_problem.asUiText(),
324324
onClick = onReportProblemItemClick,
325325
)
326-
SettingsItem(
326+
if (state.showCheckForUpdates) SettingsItem(
327327
modifier = itemModifier,
328328
startIcon = Icons.Filled.GetApp,
329329
text = R.string.settings_item_check_updates.asUiText(),
@@ -391,6 +391,7 @@ private fun PreviewStateContent() {
391391
autoSaveAiResults = true,
392392
saveToMediaStore = true,
393393
formAdvancedOptionsAlwaysShow = false,
394+
showCheckForUpdates = true,
394395
showSdModelSelector = true,
395396
showMonitorConnectionOption = true,
396397
showRateGooglePlay = true,

presentation/src/main/java/com/shifthackz/aisdv1/presentation/screen/settings/SettingsStateProducer.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class SettingsStateProducer(
3232
saveToMediaStore = settings.saveToMediaStore,
3333
formAdvancedOptionsAlwaysShow = settings.formAdvancedOptionsAlwaysShow,
3434
appVersion = version,
35+
showCheckForUpdates = buildInfoProvider.buildType == BuildType.GOOGLE_PLAY,
3536
showRewardedSdAiAd = settings.useSdAiCloud,
3637
showSdModelSelector = settings.source == ServerSource.CUSTOM,
3738
showMonitorConnectionOption = settings.source == ServerSource.CUSTOM,

0 commit comments

Comments
 (0)