ui: let channel owners turn on "Sign messages", warning that earlier messages will show signature missing

The channel preference was hidden while signing was recipient-only. Owners now see the switch; turning it on asks for confirmation, because subscribers who join later receive the earlier posts unsigned through history and see them as "signature missing". The "Signature missing" explanation now says the message may predate signing or have been forwarded by a relay without its signature, instead of only implying tampering.

Run: 001-channel-signing-moderators, slice 3
This commit is contained in:
spacedandy-agents-simplex committed 2026-10-23 10:40:16 +00:00
1 parent 3eab46aac3
commit ff09510b09
4 files changed
+35 -8

No files matched your search

@@ -50,8 +50,21 @@ struct GroupPreferencesView: View {
featureSection(.history, $preferences.history.enable)
featureSection(.support, $preferences.support.enable, disabled: true)
} else {
// hidden until message signing is user-facing (recipient-only stage)
// featureSection(.signMessages, $preferences.signMessages.enable)
featureSection(.signMessages, $preferences.signMessages.enable)
.onChange(of: preferences.signMessages.enable) { enable in
if enable == .on {
showAlert(
NSLocalizedString("Sign messages?", comment: "alert title"),
message: NSLocalizedString("Messages sent before will show \"signature missing\" to subscribers who join later.", comment: "alert message"),
actions: {[
UIAlertAction(title: NSLocalizedString("Enable", comment: "alert button"), style: .default) { _ in },
UIAlertAction(title: NSLocalizedString("Cancel", comment: "alert button"), style: .cancel) { _ in
preferences.signMessages.enable = .off
}
]}
)
}
}
featureSection(.timedMessages, $preferences.timedMessages.enable)
featureSection(.fullDelete, $preferences.fullDelete.enable)
featureSection(.reactions, $preferences.reactions.enable)
+1 -1
View File
@@ -3158,7 +3158,7 @@ public enum MsgVerified: Decodable, Equatable, Hashable {
switch self {
case .sigMissing: return (
NSLocalizedString("Signature missing", comment: "alert title"),
NSLocalizedString("The channel required this message to be signed, but the signature is missing.", comment: "alert message")
NSLocalizedString("This channel requires signed messages, but this message has no signature. It may have been sent before signing was required, or a relay may have forwarded it without one.", comment: "alert message")
)
default: return nil
}
@@ -178,10 +178,14 @@ private fun GroupPreferencesLayout(
}
}
}
@Composable fun SignMessagesPreference() {
@Composable fun SignMessagesPreference(onEnable: ((() -> Unit) -> Unit)? = null) {
val enableSignMessages = remember(preferences) { mutableStateOf(preferences.signMessages.enable) }
FeatureSection(GroupFeature.SignMessages, enableSignMessages, null, groupInfo, preferences, onTTLUpdated) { enable, _ ->
applyPrefs(preferences.copy(signMessages = GroupPreference(enable = enable)))
if (enable == GroupFeatureEnabled.ON) onEnable?.invoke {
enableSignMessages.value = GroupFeatureEnabled.OFF
applyPrefs(preferences.copy(signMessages = GroupPreference(enable = GroupFeatureEnabled.OFF)))
}
}
}
ColumnWithScrollBar {
@@ -216,9 +220,16 @@ private fun GroupPreferencesLayout(
SectionDividerSpaced()
SupportPreference(disabled = true)
} else {
// hidden until message signing is user-facing (recipient-only stage)
// SignMessagesPreference()
// SectionDividerSpaced()
SignMessagesPreference(onEnable = { revert ->
AlertManager.shared.showAlertDialog(
title = generalGetString(MR.strings.sign_messages_question),
text = generalGetString(MR.strings.sign_messages_alert_desc),
confirmText = generalGetString(MR.strings.sign_messages_enable),
onDismiss = revert,
onDismissRequest = revert,
)
})
SectionDividerSpaced()
TimedMessagesPreference()
SectionDividerSpaced()
FullDeletePreference()
@@ -787,10 +787,13 @@
<string name="do_not_require_message_signatures">Do not require signing messages.</string>
<string name="message_signatures_are_required">Message signing is required.</string>
<string name="message_signatures_are_not_required">Message signing is not required.</string>
<string name="sign_messages_question">Sign messages?</string>
<string name="sign_messages_alert_desc">Messages sent before will show "signature missing" to subscribers who join later.</string>
<string name="sign_messages_enable">Enable</string>
<string name="show_signature">Show signature</string>
<string name="show_encryption">Show encryption</string>
<string name="signature_missing_alert_title">Signature missing</string>
<string name="signature_missing_alert_desc">The channel required this message to be signed, but the signature is missing.</string>
<string name="signature_missing_alert_desc">This channel requires signed messages, but this message has no signature. It may have been sent before signing was required, or a relay may have forwarded it without one.</string>
<string name="live_message">Live message!</string>
<string name="send_live_message_desc">Send a live message - it will update for the recipient(s) as you type it</string>
<string name="send_verb">Send</string>