From 2957f09376e65298b65b631554903c3934572adc Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Wed, 30 Oct 2024 17:01:22 +0100 Subject: [PATCH] the realtime option is only needed if there actually are webxdc; one can still disable it before the option is activated --- deltachat-ios/Chat/ChatViewController.swift | 2 +- .../Settings/AdvancedViewController.swift | 16 ++++++++++++---- deltachat-ios/DC/DcContext.swift | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/deltachat-ios/Chat/ChatViewController.swift b/deltachat-ios/Chat/ChatViewController.swift index 7bdef6a3d..f2423611f 100644 --- a/deltachat-ios/Chat/ChatViewController.swift +++ b/deltachat-ios/Chat/ChatViewController.swift @@ -1233,7 +1233,7 @@ class ChatViewController: UITableViewController, UITableViewDropDelegate { alert.addAction(galleryAction) alert.addAction(documentAction) - if dcContext.hasWebxdc(chatId: 0) { + if dcContext.hasWebxdc() { let webxdcAction = UIAlertAction(title: String.localized("webxdc_apps"), style: .default, handler: webxdcButtonPressed(_:)) alert.addAction(webxdcAction) } diff --git a/deltachat-ios/Controller/Settings/AdvancedViewController.swift b/deltachat-ios/Controller/Settings/AdvancedViewController.swift index 21e28ab58..1553f1c74 100644 --- a/deltachat-ios/Controller/Settings/AdvancedViewController.swift +++ b/deltachat-ios/Controller/Settings/AdvancedViewController.swift @@ -217,10 +217,18 @@ internal final class AdvancedViewController: UITableViewController { }() private lazy var sections: [SectionConfigs] = { - let viewLogSection = SectionConfigs( - headerTitle: nil, - footerTitle: String.localized("enable_realtime_explain"), - cells: [viewLogCell, showEmailsCell, realtimeChannelsCell]) + let viewLogSection: SectionConfigs + if dcContext.hasWebxdc() { + viewLogSection = SectionConfigs( + headerTitle: nil, + footerTitle: String.localized("enable_realtime_explain"), + cells: [viewLogCell, showEmailsCell, realtimeChannelsCell]) + } else { + viewLogSection = SectionConfigs( + headerTitle: nil, + footerTitle: nil, + cells: [viewLogCell, showEmailsCell]) + } let experimentalSection = SectionConfigs( headerTitle: String.localized("pref_experimental_features"), footerTitle: nil, diff --git a/deltachat-ios/DC/DcContext.swift b/deltachat-ios/DC/DcContext.swift index 8f69a4351..7efe6548d 100644 --- a/deltachat-ios/DC/DcContext.swift +++ b/deltachat-ios/DC/DcContext.swift @@ -203,9 +203,9 @@ public class DcContext { return messageIds } - public func hasWebxdc(chatId: Int) -> Bool { + public func hasWebxdc() -> Bool { if !anyWebxdcSeen { - anyWebxdcSeen = !getChatMedia(chatId: chatId, messageType: DC_MSG_WEBXDC, messageType2: 0, messageType3: 0).isEmpty + anyWebxdcSeen = !getChatMedia(chatId: 0, messageType: DC_MSG_WEBXDC, messageType2: 0, messageType3: 0).isEmpty } return anyWebxdcSeen }