Skip to content

Commit ed6113f

Browse files
authored
Remove image reporting from FOSS build (#415)
1 parent 1d6ffdc commit ed6113f

File tree

24 files changed

+140
-42
lines changed

24 files changed

+140
-42
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data/src/test/java/com/shifthackz/aisdv1/data/mocks/SupporterMocks.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("DEPRECATION")
2+
13
package com.shifthackz.aisdv1.data.mocks
24

35
import com.shifthackz.aisdv1.domain.entity.Supporter

feature/work/src/main/java/com/shifthackz/aisdv1/work/BackgroundWorkObserverImpl.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ internal class BackgroundWorkObserverImpl : BackgroundWorkObserver {
2222
return Flowable.combineLatest(
2323
stateSubject.toFlowable(BackpressureStrategy.LATEST),
2424
messageSubject.toFlowable(BackpressureStrategy.LATEST),
25-
) { running, statusMessage ->
26-
BackgroundWorkStatus(running, statusMessage.first, statusMessage.second)
25+
) { running, (title, subTitle) ->
26+
BackgroundWorkStatus(running, title, subTitle)
2727
}
2828
}
2929

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
2-
versionName = "0.6.6"
3-
versionCode = "186"
2+
versionName = "0.6.7"
3+
versionCode = "187"
44
targetSdk = "34"
55
compileSdk = "35"
66
minSdk = "24"

presentation/src/main/java/com/shifthackz/aisdv1/presentation/core/GenerationMviViewModel.kt

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

33
package com.shifthackz.aisdv1.presentation.core
44

5+
import com.shifthackz.aisdv1.core.common.appbuild.BuildInfoProvider
56
import com.shifthackz.aisdv1.core.common.extensions.EmptyLambda
67
import com.shifthackz.aisdv1.core.common.log.errorLog
78
import com.shifthackz.aisdv1.core.common.schedulers.SchedulersProvider

presentation/src/main/java/com/shifthackz/aisdv1/presentation/di/ViewModelModule.kt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ val viewModelModule = module {
3838
viewModelOf(::DrawerViewModel)
3939
viewModelOf(::HomeNavigationViewModel)
4040
viewModelOf(::ConfigurationLoaderViewModel)
41-
viewModelOf(::ImageToImageViewModel)
4241
viewModelOf(::TextToImageViewModel)
4342
viewModelOf(::SettingsViewModel)
4443
viewModelOf(::GalleryViewModel)
@@ -94,6 +93,7 @@ val viewModelModule = module {
9493
GalleryDetailViewModel(
9594
itemId = parameters.get(),
9695
dispatchersProvider = get(),
96+
buildInfoProvider = get(),
9797
getGenerationResultUseCase = get(),
9898
getLastResultFromCacheUseCase = get(),
9999
deleteGalleryItemUseCase = get(),
@@ -118,4 +118,32 @@ val viewModelModule = module {
118118
buildInfoProvider = get(),
119119
)
120120
}
121+
122+
viewModel {
123+
ImageToImageViewModel(
124+
dispatchersProvider = get(),
125+
generationFormUpdateEvent = get(),
126+
getStableDiffusionSamplersUseCase = get(),
127+
observeHordeProcessStatusUseCase = get(),
128+
observeLocalDiffusionProcessStatusUseCase = get(),
129+
saveLastResultToCacheUseCase = get(),
130+
saveGenerationResultUseCase = get(),
131+
interruptGenerationUseCase = get(),
132+
drawerRouter = get(),
133+
dimensionValidator = get(),
134+
imageToImageUseCase = get(),
135+
getRandomImageUseCase = get(),
136+
bitmapToBase64Converter = get(),
137+
base64ToBitmapConverter = get(),
138+
preferenceManager = get(),
139+
schedulersProvider = get(),
140+
notificationManager = get(),
141+
wakeLockInterActor = get(),
142+
inPaintStateProducer = get(),
143+
mainRouter = get(),
144+
backgroundTaskManager = get(),
145+
backgroundWorkObserver = get(),
146+
buildInfoProvider = get(),
147+
)
148+
}
121149
}

presentation/src/main/java/com/shifthackz/aisdv1/presentation/modal/ModalRenderer.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ fun ModalRenderer(
111111
is Modal.Image.Single -> GenerationImageResultDialog(
112112
imageBase64 = screenModal.result.image,
113113
showSaveButton = !screenModal.autoSaveEnabled,
114+
showReportButton = screenModal.reportEnabled,
114115
onDismissRequest = dismiss,
115116
onSaveRequest = {
116117
processIntent(GenerationMviIntent.Result.Save(listOf(screenModal.result)))

presentation/src/main/java/com/shifthackz/aisdv1/presentation/model/Modal.kt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,29 @@ sealed interface Modal {
8181
sealed interface Image : Modal {
8282

8383
@Immutable
84-
data class Single(val result: AiGenerationResult, val autoSaveEnabled: Boolean) : Image
84+
data class Single(
85+
val result: AiGenerationResult,
86+
val autoSaveEnabled: Boolean,
87+
val reportEnabled: Boolean,
88+
) : Image
8589

8690
@Immutable
87-
data class Batch(val results: List<AiGenerationResult>, val autoSaveEnabled: Boolean) : Image
91+
data class Batch(val results: List<AiGenerationResult>, val autoSaveEnabled: Boolean) :
92+
Image
8893

8994
@Immutable
9095
data class Crop(val bitmap: Bitmap) : Image
9196

9297
companion object {
93-
fun create(list: List<AiGenerationResult>, autoSaveEnabled: Boolean): Image =
94-
if (list.size > 1) Batch(list, autoSaveEnabled)
95-
else Single(list.first(), autoSaveEnabled)
98+
fun create(
99+
list: List<AiGenerationResult>,
100+
autoSaveEnabled: Boolean,
101+
reportEnabled: Boolean = false,
102+
): Image = if (list.size > 1) {
103+
Batch(list, autoSaveEnabled)
104+
} else {
105+
Single(list.first(), autoSaveEnabled, reportEnabled)
106+
}
96107
}
97108
}
98109

@@ -103,7 +114,7 @@ sealed interface Modal {
103114
data class Error(val error: UiText) : Modal
104115

105116
@Immutable
106-
data class ManualPermission(val permission: UiText): Modal
117+
data class ManualPermission(val permission: UiText) : Modal
107118

108119
data object ClearInPaintConfirm : Modal
109120

presentation/src/main/java/com/shifthackz/aisdv1/presentation/screen/gallery/detail/GalleryDetailScreen.kt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,22 +193,24 @@ private fun GalleryDetailNavigationBar(
193193
.background(color = MaterialTheme.colorScheme.surface),
194194
) {
195195
if (state is GalleryDetailState.Content) {
196-
OutlinedButton(
197-
modifier = Modifier
198-
.padding(horizontal = 24.dp, vertical = 4.dp)
199-
.fillMaxWidth()
200-
.align(Alignment.CenterHorizontally),
201-
onClick = { processIntent(GalleryDetailIntent.Report) },
202-
) {
203-
Icon(
204-
modifier = Modifier.padding(end = 8.dp),
205-
imageVector = Icons.Default.Report,
206-
contentDescription = "Report",
207-
)
208-
Text(
209-
text = stringResource(LocalizationR.string.report_title),
210-
color = LocalContentColor.current
211-
)
196+
if (state.showReportButton) {
197+
OutlinedButton(
198+
modifier = Modifier
199+
.padding(horizontal = 24.dp, vertical = 4.dp)
200+
.fillMaxWidth()
201+
.align(Alignment.CenterHorizontally),
202+
onClick = { processIntent(GalleryDetailIntent.Report) },
203+
) {
204+
Icon(
205+
modifier = Modifier.padding(end = 8.dp),
206+
imageVector = Icons.Default.Report,
207+
contentDescription = "Report",
208+
)
209+
Text(
210+
text = stringResource(LocalizationR.string.report_title),
211+
color = LocalContentColor.current
212+
)
213+
}
212214
}
213215
Row(
214216
modifier = Modifier

presentation/src/main/java/com/shifthackz/aisdv1/presentation/screen/gallery/detail/GalleryDetailState.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ sealed interface GalleryDetailState : MviState {
3131
override val tabs: List<Tab> = emptyList(),
3232
override val selectedTab: Tab = Tab.IMAGE,
3333
override val screenModal: Modal = Modal.None,
34+
val showReportButton: Boolean = false,
3435
val generationType: AiGenerationResult.Type,
3536
val id: Long,
3637
val bitmap: Bitmap,

0 commit comments

Comments
 (0)