|
|
@ -159,7 +159,11 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
}
|
|
|
|
}
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: {
|
|
|
|
onTap: {
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = currentSelection
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = {
|
|
|
|
|
|
|
|
if (config.isEnabled == true && config.type == .disappearAfterRead) {
|
|
|
|
|
|
|
|
return config
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return currentSelection
|
|
|
|
.with(
|
|
|
|
.with(
|
|
|
|
isEnabled: true,
|
|
|
|
isEnabled: true,
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
@ -169,6 +173,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
type: .disappearAfterRead, // Default for 1-1
|
|
|
|
type: .disappearAfterRead, // Default for 1-1
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
}()
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -197,7 +202,11 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
label: "Disappear after read option"
|
|
|
|
label: "Disappear after read option"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: {
|
|
|
|
onTap: {
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = currentSelection
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = {
|
|
|
|
|
|
|
|
if (config.isEnabled == true && config.type == .disappearAfterRead) {
|
|
|
|
|
|
|
|
return config
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return currentSelection
|
|
|
|
.with(
|
|
|
|
.with(
|
|
|
|
isEnabled: true,
|
|
|
|
isEnabled: true,
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
@ -207,6 +216,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
type: .disappearAfterRead,
|
|
|
|
type: .disappearAfterRead,
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
}()
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -234,7 +244,11 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
label: "Disappear after send option"
|
|
|
|
label: "Disappear after send option"
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: {
|
|
|
|
onTap: {
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = currentSelection
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = {
|
|
|
|
|
|
|
|
if (config.isEnabled == true && config.type == .disappearAfterSend) {
|
|
|
|
|
|
|
|
return config
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return currentSelection
|
|
|
|
.with(
|
|
|
|
.with(
|
|
|
|
isEnabled: true,
|
|
|
|
isEnabled: true,
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
@ -244,6 +258,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
type: .disappearAfterSend,
|
|
|
|
type: .disappearAfterSend,
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
}()
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -335,16 +350,21 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
currentUserIsClosedGroupMember == true
|
|
|
|
currentUserIsClosedGroupMember == true
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: {
|
|
|
|
onTap: {
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = currentSelection
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = {
|
|
|
|
|
|
|
|
if (config.isEnabled == true && config.type == .disappearAfterSend) {
|
|
|
|
|
|
|
|
return config
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return currentSelection
|
|
|
|
.with(
|
|
|
|
.with(
|
|
|
|
isEnabled: true,
|
|
|
|
isEnabled: true,
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
|
.DisappearingMessageType
|
|
|
|
.DisappearingMessageType
|
|
|
|
.disappearAfterSend
|
|
|
|
.disappearAfterSend
|
|
|
|
.defaultDuration,
|
|
|
|
.defaultDuration,
|
|
|
|
type: DisappearingMessagesConfiguration.DisappearingMessageType.disappearAfterSend, // Default for closed group & note to self
|
|
|
|
type: .disappearAfterSend, // Default for closed group & note to self
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
}()
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -353,39 +373,9 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
id: Item(title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized()),
|
|
|
|
id: Item(title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized()),
|
|
|
|
title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized(),
|
|
|
|
title: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_TITLE".localized(),
|
|
|
|
subtitle: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_DESCRIPTION".localized(),
|
|
|
|
subtitle: "DISAPPERING_MESSAGES_TYPE_AFTER_SEND_DESCRIPTION".localized(),
|
|
|
|
rightAccessory: .radio(
|
|
|
|
rightAccessory: .radio(isSelected: { false }),
|
|
|
|
isSelected: {
|
|
|
|
styling: SessionCell.StyleInfo(tintColor: .disabled),
|
|
|
|
(self?.currentSelection.value.isEnabled == true) &&
|
|
|
|
isEnabled: false
|
|
|
|
(self?.currentSelection.value.type == .disappearAfterSend) &&
|
|
|
|
|
|
|
|
Features.useNewDisappearingMessagesConfig
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
styling: SessionCell.StyleInfo(
|
|
|
|
|
|
|
|
tintColor: (Features.useNewDisappearingMessagesConfig ?
|
|
|
|
|
|
|
|
.textPrimary :
|
|
|
|
|
|
|
|
.disabled
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
isEnabled: (
|
|
|
|
|
|
|
|
Features.useNewDisappearingMessagesConfig && (
|
|
|
|
|
|
|
|
isNoteToSelf ||
|
|
|
|
|
|
|
|
currentUserIsClosedGroupMember == true
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: {
|
|
|
|
|
|
|
|
let updatedConfig: DisappearingMessagesConfiguration = currentSelection
|
|
|
|
|
|
|
|
.with(
|
|
|
|
|
|
|
|
isEnabled: true,
|
|
|
|
|
|
|
|
durationSeconds: DisappearingMessagesConfiguration
|
|
|
|
|
|
|
|
.DisappearingMessageType
|
|
|
|
|
|
|
|
.disappearAfterSend
|
|
|
|
|
|
|
|
.defaultDuration,
|
|
|
|
|
|
|
|
type: .disappearAfterSend,
|
|
|
|
|
|
|
|
lastChangeTimestampMs: SnodeAPI.currentOffsetTimestampMs()
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
self?.shouldShowConfirmButton.send(updatedConfig != config)
|
|
|
|
|
|
|
|
self?.currentSelection.send(updatedConfig)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -434,7 +424,7 @@ class ThreadDisappearingMessagesSettingsViewModel: SessionTableViewModel<ThreadD
|
|
|
|
.compactMap { $0 }
|
|
|
|
.compactMap { $0 }
|
|
|
|
.appending(
|
|
|
|
.appending(
|
|
|
|
contentsOf: DisappearingMessagesConfiguration
|
|
|
|
contentsOf: DisappearingMessagesConfiguration
|
|
|
|
.validDurationsSeconds(currentSelection.type ?? .disappearAfterSend)
|
|
|
|
.validDurationsSeconds(.disappearAfterSend)
|
|
|
|
.map { duration in
|
|
|
|
.map { duration in
|
|
|
|
let title: String = duration.formatted(format: .long)
|
|
|
|
let title: String = duration.formatted(format: .long)
|
|
|
|
|
|
|
|
|
|
|
|