mobile: disable setting chat item TTL if chat db changed (#1183)

This commit is contained in:
JRoberts
2022-10-07 15:01:17 +04:00
committed by GitHub
parent 88645cb003
commit b66eb5b67f
2 changed files with 5 additions and 1 deletions

View File

@@ -75,6 +75,7 @@ fun DatabaseView(
DatabaseLayout(
progressIndicator.value,
runChat.value,
m.chatDbChanged.value,
useKeychain.value,
m.chatDbEncrypted.value,
m.controller.appPrefs.initialRandomDBPassphrase,
@@ -122,6 +123,7 @@ fun DatabaseView(
fun DatabaseLayout(
progressIndicator: Boolean,
runChat: Boolean,
chatDbChanged: Boolean,
useKeyChain: Boolean,
chatDbEncrypted: Boolean?,
initialRandomDBPassphrase: Preference<Boolean>,
@@ -219,7 +221,7 @@ fun DatabaseLayout(
SectionSpacer()
SectionView(stringResource(R.string.data_section)) {
SectionItemView { TtlOptions(chatItemTTL, rememberUpdatedState(!progressIndicator), onChatItemTTLSelected) }
SectionItemView { TtlOptions(chatItemTTL, enabled = rememberUpdatedState(!progressIndicator && !chatDbChanged), onChatItemTTLSelected) }
SectionDivider()
val deleteFilesDisabled = operationsDisabled || appFilesCountAndSize.value.first == 0
SectionItemView(
@@ -666,6 +668,7 @@ fun PreviewDatabaseLayout() {
DatabaseLayout(
progressIndicator = false,
runChat = true,
chatDbChanged = false,
useKeyChain = false,
chatDbEncrypted = false,
initialRandomDBPassphrase = Preference({ true }, {}),

View File

@@ -166,6 +166,7 @@ struct DatabaseView: View {
}
}
.frame(height: 36)
.disabled(m.chatDbChanged || progressIndicator)
Button("Delete files & media", role: .destructive) {
alert = .deleteFilesAndMedia
}