ios: disappearing messages (#1614)

* ios: disappearing messages

* show ttl in meta if different

* mark messages as disappearing when read

* previews
This commit is contained in:
Evgeny Poberezkin 2022-12-21 12:59:45 +00:00 committed by GitHub
parent 36eba01ef4
commit e1740a8be4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 388 additions and 150 deletions

View file

@ -18,6 +18,7 @@ struct PreferencesView: View {
var body: some View {
VStack {
List {
timedMessagesFeatureSection($preferences.timedMessages.allow)
featureSection(.fullDelete, $preferences.fullDelete.allow)
featureSection(.voice, $preferences.voice.allow)
@ -40,10 +41,27 @@ struct PreferencesView: View {
}
.frame(height: 36)
}
} footer: {
Text(feature.allowDescription(allowFeature.wrappedValue))
.frame(height: 36, alignment: .topLeading)
}
footer: { featureFooter(feature, allowFeature) }
}
private func timedMessagesFeatureSection(_ allowFeature: Binding<FeatureAllowed>) -> some View {
Section {
let allow = Binding(
get: { allowFeature.wrappedValue == .always || allowFeature.wrappedValue == .yes },
set: { yes, _ in allowFeature.wrappedValue = yes ? .yes : .no }
)
settingsRow(ChatFeature.timedMessages.icon) {
Toggle(ChatFeature.timedMessages.text, isOn: allow)
}
}
footer: { featureFooter(.timedMessages, allowFeature) }
}
private func featureFooter(_ feature: ChatFeature, _ allowFeature: Binding<FeatureAllowed>) -> some View {
Text(ChatFeature.timedMessages.allowDescription(allowFeature.wrappedValue))
.frame(height: 36, alignment: .topLeading)
}
private func savePreferences() {