File tree 14 files changed +359
-55
lines changed
data/src/main/java/com/shifthackz/aisdv1/data/repository
domain/src/main/java/com/shifthackz/aisdv1/domain
presentation/src/main/java/com/shifthackz/aisdv1/presentation
14 files changed +359
-55
lines changed Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ internal class BackupRepositoryImpl(
145
145
preferenceManager.localOnnxAllowCancel = value as Boolean
146
146
}
147
147
KEY_LOCAL_DIFFUSION_SCHEDULER_THREAD -> {
148
- preferenceManager.localOnnxSchedulerThread = value as SchedulersToken
148
+ preferenceManager.localOnnxSchedulerThread = SchedulersToken .valueOf( value as String )
149
149
}
150
150
KEY_MONITOR_CONNECTIVITY -> {
151
151
preferenceManager.monitorConnectivity = value as Boolean
@@ -163,7 +163,7 @@ internal class BackupRepositoryImpl(
163
163
preferenceManager.formPromptTaggedInput = value as Boolean
164
164
}
165
165
KEY_SERVER_SOURCE -> {
166
- preferenceManager.source = value as ServerSource
166
+ preferenceManager.source = ServerSource .valueOf( value as String )
167
167
}
168
168
KEY_SD_MODEL -> {
169
169
preferenceManager.sdModel = value as String
@@ -217,7 +217,7 @@ internal class BackupRepositoryImpl(
217
217
preferenceManager.backgroundGeneration = value as Boolean
218
218
}
219
219
KEY_GALLERY_GRID -> {
220
- preferenceManager.galleryGrid = value as Grid
220
+ preferenceManager.galleryGrid = Grid .valueOf( value as String )
221
221
}
222
222
}
223
223
}
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import com.shifthackz.aisdv1.domain.interactor.wakelock.WakeLockInterActor
6
6
import com.shifthackz.aisdv1.domain.interactor.wakelock.WakeLockInterActorImpl
7
7
import com.shifthackz.aisdv1.domain.usecase.backup.CreateBackupUseCase
8
8
import com.shifthackz.aisdv1.domain.usecase.backup.CreateBackupUseCaseImpl
9
+ import com.shifthackz.aisdv1.domain.usecase.backup.RestoreBackupUseCase
10
+ import com.shifthackz.aisdv1.domain.usecase.backup.RestoreBackupUseCaseImpl
9
11
import com.shifthackz.aisdv1.domain.usecase.caching.ClearAppCacheUseCase
10
12
import com.shifthackz.aisdv1.domain.usecase.caching.ClearAppCacheUseCaseImpl
11
13
import com.shifthackz.aisdv1.domain.usecase.caching.DataPreLoaderUseCase
@@ -130,6 +132,7 @@ import org.koin.dsl.module
130
132
131
133
internal val useCasesModule = module {
132
134
factoryOf(::CreateBackupUseCaseImpl ) bind CreateBackupUseCase ::class
135
+ factoryOf(::RestoreBackupUseCaseImpl ) bind RestoreBackupUseCase ::class
133
136
factoryOf(::TextToImageUseCaseImpl ) bind TextToImageUseCase ::class
134
137
factoryOf(::ImageToImageUseCaseImpl ) bind ImageToImageUseCase ::class
135
138
factoryOf(::PingStableDiffusionServiceUseCaseImpl ) bind PingStableDiffusionServiceUseCase ::class
Original file line number Diff line number Diff line change
1
+ package com.shifthackz.aisdv1.domain.usecase.backup
2
+
3
+ import io.reactivex.rxjava3.core.Completable
4
+
5
+ interface RestoreBackupUseCase {
6
+ operator fun invoke (data : ByteArray ): Completable
7
+ }
Original file line number Diff line number Diff line change
1
+ package com.shifthackz.aisdv1.domain.usecase.backup
2
+
3
+ import com.shifthackz.aisdv1.domain.repository.BackupRepository
4
+
5
+ internal class RestoreBackupUseCaseImpl (
6
+ private val backupRepository : BackupRepository ,
7
+ ) : RestoreBackupUseCase {
8
+
9
+ override fun invoke (data : ByteArray ) = backupRepository.restore(data)
10
+ }
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import com.shifthackz.aisdv1.presentation.modal.language.LanguageBottomSheet
31
31
import com.shifthackz.aisdv1.presentation.modal.ldscheduler.LDSchedulerBottomSheet
32
32
import com.shifthackz.aisdv1.presentation.modal.tag.EditTagDialog
33
33
import com.shifthackz.aisdv1.presentation.model.Modal
34
+ import com.shifthackz.aisdv1.presentation.screen.backup.BackupIntent
34
35
import com.shifthackz.aisdv1.presentation.screen.debug.DebugMenuIntent
35
36
import com.shifthackz.aisdv1.presentation.screen.gallery.detail.GalleryDetailIntent
36
37
import com.shifthackz.aisdv1.presentation.screen.gallery.list.GalleryIntent
@@ -63,6 +64,7 @@ fun ModalRenderer(
63
64
processIntent(InPaintIntent .ScreenModal .Dismiss )
64
65
processIntent(DebugMenuIntent .DismissModal )
65
66
processIntent(ReportIntent .DismissError )
67
+ processIntent(BackupIntent .DismissModal )
66
68
}
67
69
val context = LocalContext .current
68
70
when (screenModal) {
Original file line number Diff line number Diff line change 1
1
package com.shifthackz.aisdv1.presentation.navigation.graph
2
2
3
3
import androidx.compose.material.icons.Icons
4
+ import androidx.compose.material.icons.filled.Backup
4
5
import androidx.compose.material.icons.filled.DeveloperMode
5
6
import androidx.compose.material.icons.filled.SettingsEthernet
6
7
import androidx.compose.material.icons.filled.Web
@@ -24,6 +25,7 @@ fun mainDrawerNavItems(settings: Settings? = null): List<NavItem> = buildList {
24
25
}
25
26
add(settingsTab())
26
27
add(configuration())
28
+ add(backup())
27
29
settings?.developerMode?.takeIf { it }?.let {
28
30
add(developerMode())
29
31
}
@@ -50,10 +52,18 @@ private fun configuration() = NavItem(
50
52
),
51
53
)
52
54
55
+ private fun backup () = NavItem (
56
+ name = LocalizationR .string.title_backup.asUiText(),
57
+ navRoute = NavigationRoute .Backup ,
58
+ icon = NavItem .Icon .Vector (
59
+ vector = Icons .Default .Backup ,
60
+ ),
61
+ )
62
+
53
63
private fun developerMode () = NavItem (
54
64
name = LocalizationR .string.title_debug_menu.asUiText(),
55
65
navRoute = NavigationRoute .Debug ,
56
66
icon = NavItem .Icon .Vector (
57
67
vector = Icons .Default .DeveloperMode ,
58
- )
68
+ ),
59
69
)
Original file line number Diff line number Diff line change 1
1
package com.shifthackz.aisdv1.presentation.navigation.graph
2
2
3
+ import androidx.compose.animation.core.tween
4
+ import androidx.compose.animation.slideInVertically
5
+ import androidx.compose.animation.slideOutVertically
3
6
import androidx.navigation.NavGraphBuilder
4
7
import androidx.navigation.NavType
5
8
import androidx.navigation.compose.composable
@@ -57,7 +60,20 @@ fun NavGraphBuilder.mainNavGraph() {
57
60
GalleryDetailScreen (itemId = itemId)
58
61
}
59
62
60
- composable<NavigationRoute .ReportImage > { entry ->
63
+ composable<NavigationRoute .ReportImage >(
64
+ enterTransition = {
65
+ slideInVertically(
66
+ initialOffsetY = { it },
67
+ animationSpec = tween(500 ),
68
+ )
69
+ },
70
+ exitTransition = {
71
+ slideOutVertically(
72
+ targetOffsetY = { it },
73
+ animationSpec = tween(500 ),
74
+ )
75
+ },
76
+ ) { entry ->
61
77
val itemId = entry.toRoute<NavigationRoute .ReportImage >().itemId
62
78
ReportScreen (
63
79
viewModel = koinViewModel<ReportViewModel >(
Original file line number Diff line number Diff line change @@ -5,14 +5,24 @@ import com.shifthackz.android.core.mvi.MviIntent
5
5
6
6
interface BackupIntent : MviIntent {
7
7
8
+ data object DismissModal : BackupIntent
9
+
8
10
data object NavigateBack : BackupIntent
9
11
10
12
data object MainButtonClick : BackupIntent
11
13
12
14
data class SelectOperation (val value : String ) : BackupIntent
13
15
16
+ @Suppress(" ArrayInDataClass" )
17
+ data class SelectRestore (
18
+ val path : String ,
19
+ val bytes : ByteArray ,
20
+ ): BackupIntent
21
+
14
22
data class ToggleBackupEntry (
15
23
val entry : BackupEntryToken ,
16
24
val checked : Boolean ,
17
25
) : BackupIntent
26
+
27
+ enum class OnResult : BackupIntent { Success , Fail }
18
28
}
You can’t perform that action at this time.
0 commit comments