fix an issue by the refactor

pull/731/head
Ryan Zhao 8 months ago
parent 99d5620536
commit b605193e61

@ -55,14 +55,16 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
public enum Section: SessionTableSection { public enum Section: SessionTableSection {
case type case type
case timer case timerLegacy
case timerDisappearAfterSend
case timerDisappearAfterRead
case noteToSelf case noteToSelf
case group case group
var title: String? { var title: String? {
switch self { switch self {
case .type: return "DISAPPERING_MESSAGES_TYPE_TITLE".localized() case .type: return "DISAPPERING_MESSAGES_TYPE_TITLE".localized()
case .timer: return "DISAPPERING_MESSAGES_TIMER_TITLE".localized() case .timerLegacy, .timerDisappearAfterSend, .timerDisappearAfterRead: return "DISAPPERING_MESSAGES_TIMER_TITLE".localized()
case .noteToSelf: return nil case .noteToSelf: return nil
case .group: return nil case .group: return nil
} }
@ -256,7 +258,12 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
), ),
(currentSelection.isEnabled == false ? nil : (currentSelection.isEnabled == false ? nil :
SectionModel( SectionModel(
model: .timer, model: {
guard Features.useNewDisappearingMessagesConfig else { return .timerLegacy }
return currentSelection.type == .disappearAfterSend ?
.timerDisappearAfterSend :
.timerDisappearAfterRead
}(),
elements: DisappearingMessagesConfiguration elements: DisappearingMessagesConfiguration
.validDurationsSeconds({ .validDurationsSeconds({
guard Features.useNewDisappearingMessagesConfig else { return .disappearAfterSend } guard Features.useNewDisappearingMessagesConfig else { return .disappearAfterSend }
@ -369,7 +376,12 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel, Naviga
(!Features.useNewDisappearingMessagesConfig && currentSelection.isEnabled == false ? nil : (!Features.useNewDisappearingMessagesConfig && currentSelection.isEnabled == false ? nil :
SectionModel( SectionModel(
model: { model: {
guard Features.useNewDisappearingMessagesConfig else { return .timer } guard Features.useNewDisappearingMessagesConfig else {
return (currentSelection.type == .disappearAfterSend ?
.timerDisappearAfterSend :
.timerDisappearAfterRead
)
}
return (isNoteToSelf ? .noteToSelf : .group) return (isNoteToSelf ? .noteToSelf : .group)
}(), }(),

Loading…
Cancel
Save