Skip to content

Commit

Permalink
the realtime option is only needed if there actually are webxdc; one …
Browse files Browse the repository at this point in the history
…can still disable it before the option is activated
  • Loading branch information
r10s committed Oct 30, 2024
1 parent b20e9f2 commit 2957f09
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion deltachat-ios/Chat/ChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
16 changes: 12 additions & 4 deletions deltachat-ios/Controller/Settings/AdvancedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions deltachat-ios/DC/DcContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 2957f09

Please sign in to comment.