fix disappearing messages strings

pull/1023/head
Ryan ZHAO 7 months ago
parent 630e20fc69
commit a98c213b78

@ -453,10 +453,10 @@ class ThreadSettingsViewModel: SessionTableViewModel, NavigationItemSource, Navi
return "off".localized()
}
return "disappearingMessagesDisappear"
.put(key: "disappearing_messages_type", value: (current.disappearingMessagesConfig.type?.localizedName ?? ""))
.put(key: "time", value: current.disappearingMessagesConfig.durationString)
.localized()
return (current.disappearingMessagesConfig.type ?? .unknown)
.localizedState(
durationString: current.disappearingMessagesConfig.durationString
)
}(),
accessibility: Accessibility(
identifier: "Disappearing messages",

@ -233,10 +233,10 @@ final class ConversationTitleView: UIView {
attributedText: NSAttributedString(attachment: imageAttachment)
.appending(string: " ")
.appending(
string: "disappearingMessagesDisappear"
.put(key: "disappearing_messages_type", value: (config.type?.localizedName ?? ""))
.put(key: "time", value: floor(config.durationSeconds).formatted(format: .short))
.localized()
string: (config.type ?? .unknown)
.localizedState(
durationString: floor(config.durationSeconds).formatted(format: .short)
)
),
accessibility: Accessibility(
identifier: "Disappearing messages type and time",

@ -83,6 +83,21 @@ public struct DisappearingMessagesConfiguration: Codable, Identifiable, Equatabl
case .disappearAfterSend: return CONVO_EXPIRATION_AFTER_SEND
}
}
public func localizedState(durationString: String) -> String {
switch self {
case .unknown:
return ""
case .disappearAfterRead:
return "disappearingMessagesDisappearAfterReadState"
.put(key: "time", value: durationString)
.localized()
case .disappearAfterSend:
return "disappearingMessagesDisappearAfterSendState"
.put(key: "time", value: durationString)
.localized()
}
}
}
public var id: String { threadId } // Identifiable

Loading…
Cancel
Save