Skip to content

Commit

Permalink
add mentions toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Dec 9, 2024
1 parent 723cf3d commit 67e0941
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,20 @@ internal final class NotificationsViewController: UITableViewController {
})
}()

private lazy var mentionsCell: SwitchCell = {
return SwitchCell(
textLabel: String.localized("pref_mention_notifications"),
on: dcContext.isMentionsEnabled(),
action: { [weak self] cell in
self?.dcContext.setMentionsEnabled(cell.isOn)
})
}()

private lazy var sections: [SectionConfigs] = {
let preferencesSection = SectionConfigs(
headerTitle: nil,
footerTitle: nil,
cells: [notificationsCell]
footerTitle: String.localized("pref_mention_notifications_explain"),
cells: [notificationsCell, mentionsCell]
)
return [preferencesSection]
}()
Expand Down
8 changes: 8 additions & 0 deletions deltachat-ios/DC/DcContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,14 @@ public class DcContext {
setConfigBool("is_muted", muted)
}

public func isMentionsEnabled() -> Bool {
return !getConfigBool("ui.mute_mentions_if_muted")
}

public func setMentionsEnabled(_ enabled: Bool) {
setConfigBool("ui.mute_mentions_if_muted", !enabled)
}

public func getUnreadMessages(chatId: Int) -> Int {
return Int(dc_get_fresh_msg_cnt(contextPointer, UInt32(chatId)))
}
Expand Down

0 comments on commit 67e0941

Please sign in to comment.