ios: reports fixes - don't create in main chat, show notice "view in chat with admins" (#5911)

This commit is contained in:
spaced4ndy
2025-05-15 13:59:12 +00:00
committed by GitHub
parent 775f6f14bf
commit b32c052f13
2 changed files with 26 additions and 4 deletions
@@ -1035,9 +1035,9 @@ struct ComposeView: View {
reportReason: reportReason,
reportText: msgText
) {
await MainActor.run {
for chatItem in chatItems {
chatModel.addChatItem(chat.chatInfo, chatItem)
if showReportsInSupportChatAlertDefault.get() {
await MainActor.run {
showReportsInSupportChatAlert()
}
}
return chatItems.first
@@ -1045,7 +1045,27 @@ struct ComposeView: View {
return nil
}
func showReportsInSupportChatAlert() {
showAlert(
NSLocalizedString("Report sent to moderators", comment: "alert title"),
message: NSLocalizedString("You can view your reports in Chat with admins.", comment: "alert message"),
actions: {[
UIAlertAction(
title: NSLocalizedString("Don't show again", comment: "alert action"),
style: .default,
handler: { _ in
showReportsInSupportChatAlertDefault.set(false)
}
),
UIAlertAction(
title: NSLocalizedString("Ok", comment: "alert action"),
style: .default
)
]}
)
}
func send(_ mc: MsgContent, quoted: Int64?, file: CryptoFile? = nil, live: Bool = false, ttl: Int?, mentions: [String: Int64]) async -> ChatItem? {
await send(
[ComposedMessage(fileSource: file, quotedItemId: quoted, msgContent: mc, mentions: mentions)],
@@ -198,6 +198,8 @@ let customDisappearingMessageTimeDefault = IntDefault(defaults: UserDefaults.sta
let showDeleteConversationNoticeDefault = BoolDefault(defaults: UserDefaults.standard, forKey: DEFAULT_SHOW_DELETE_CONVERSATION_NOTICE)
let showDeleteContactNoticeDefault = BoolDefault(defaults: UserDefaults.standard, forKey: DEFAULT_SHOW_DELETE_CONTACT_NOTICE)
let showReportsInSupportChatAlertDefault = BoolDefault(defaults: UserDefaults.standard, forKey: DEFAULT_SHOW_REPORTS_IN_SUPPORT_CHAT_ALERT)
/// after importing new database, this flag will be set and unset only after importing app settings in `initializeChat` */
let shouldImportAppSettingsDefault = BoolDefault(defaults: UserDefaults.standard, forKey: DEFAULT_SHOULD_IMPORT_APP_SETTINGS)
let currentThemeDefault = StringDefault(defaults: UserDefaults.standard, forKey: DEFAULT_CURRENT_THEME, withDefault: DefaultTheme.SYSTEM_THEME_NAME)