diff --git a/Session/Conversations/Settings/ThreadDisappearingMessagesViewModel.swift b/Session/Conversations/Settings/ThreadDisappearingMessagesViewModel.swift index de1af9d6c..d6a309966 100644 --- a/Session/Conversations/Settings/ThreadDisappearingMessagesViewModel.swift +++ b/Session/Conversations/Settings/ThreadDisappearingMessagesViewModel.swift @@ -16,13 +16,24 @@ class ThreadDisappearingMessagesViewModel: SessionTableViewModel [SectionModel] in return [ SectionModel( - model: .content, + model: .type, elements: [ SessionCell.Info( - id: Item(title: "DISAPPEARING_MESSAGES_OFF".localized()), + id: .off, title: "DISAPPEARING_MESSAGES_OFF".localized(), rightAccessory: .radio( isSelected: { (self?.currentSelection.value == 0) } ), onTap: { self?.currentSelection.send(0) } + ), + SessionCell.Info( + id: .disappearAfterRead, + title: "DISAPPERING_MESSAGES_TYPE_AFTER_READ_TITLE".localized(), + subtitle: "DISAPPERING_MESSAGES_TYPE_AFTER_READ_DESCRIPTION".localized(), + rightAccessory: .radio( + isSelected: { (self?.currentSelection.value != 0) } + ), + onTap: { self?.currentSelection.send(24 * 60 * 60) } + ), + SessionCell.Info( + id: .disappearAfterSend, + title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized(), + subtitle: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_DESCRIPTION".localized(), + rightAccessory: .radio( + isSelected: { (self?.currentSelection.value != 0) } + ), + onTap: { self?.currentSelection.send(24 * 60 * 60) } ) - ].appending( - contentsOf: DisappearingMessagesConfiguration.validDurationsSeconds - .map { duration in - let title: String = duration.formatted(format: .long) - - return SessionCell.Info( - id: Item(title: title), - title: title, - rightAccessory: .radio( - isSelected: { (self?.currentSelection.value == duration) } - ), - onTap: { self?.currentSelection.send(duration) } - ) - } - ) + ] ) - ] + ].appending( + (self?.currentSelection.value == 0) ? nil : + SectionModel( + model: .timer, + elements: [ + SessionCell.Info( + id: .currentSetting, + title: (self?.currentSelection.value.formatted(format: .long) ?? ""), + rightAccessory: .icon( + UIImage(named: "ic_chevron_down")? + .withRenderingMode(.alwaysTemplate) + ), + onTap: { } + ) + ] + ) + ) } .removeDuplicates() .publisher(in: dependencies.storage, scheduling: dependencies.scheduler)