Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for chatmail accounts, hide some not useful settings #2166

Merged
merged 6 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 32 additions & 20 deletions deltachat-ios/Controller/Settings/AdvancedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
return cell
}()

private lazy var sendAutocryptMessageCell: ActionCell = {
let cell = ActionCell()
private lazy var sendAutocryptMessageCell: UITableViewCell = {
let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
zeitschlag marked this conversation as resolved.
Show resolved Hide resolved
cell.tag = CellTags.sendAutocryptMessage.rawValue
cell.actionTitle = String.localized("autocrypt_send_asm_title")
cell.textLabel?.text = String.localized("autocrypt_send_asm_title")
return cell
}()

private lazy var manageKeysCell: ActionCell = {
let cell = ActionCell()
private lazy var manageKeysCell: UITableViewCell = {
let cell = UITableViewCell(style: .value1, reuseIdentifier: nil)
cell.tag = CellTags.manageKeys.rawValue
cell.actionTitle = String.localized("pref_manage_keys")
cell.textLabel?.text = String.localized("pref_manage_keys")
return cell
}()

Expand Down Expand Up @@ -219,20 +219,32 @@ internal final class AdvancedViewController: UITableViewController, ProgressAler
headerTitle: String.localized("pref_experimental_features"),
footerTitle: nil,
cells: [videoChatInstanceCell, broadcastListsCell, locationStreamingCell])
let appAccessSection = SectionConfigs(
headerTitle: String.localized("pref_app_access"),
footerTitle: String.localized("pref_show_system_contacts_explain"),
cells: [showSystemContactsCell])
let autocryptSection = SectionConfigs(
headerTitle: String.localized("pref_encryption"),
footerTitle: nil,
cells: [autocryptPreferencesCell, manageKeysCell, sendAutocryptMessageCell]
)
let serverSection = SectionConfigs(
headerTitle: String.localized("pref_server"),
footerTitle: String.localized("pref_only_fetch_mvbox_explain"),
cells: [accountSettingsCell, sentboxWatchCell, sendCopyToSelfCell, mvboxMoveCell, onlyFetchMvboxCell])
return [viewLogSection, experimentalSection, appAccessSection, autocryptSection, serverSection]

if dcContext.isChatmail {
let encryptionSection = SectionConfigs(
headerTitle: String.localized("pref_encryption"),
footerTitle: nil,
zeitschlag marked this conversation as resolved.
Show resolved Hide resolved
cells: [manageKeysCell, sendAutocryptMessageCell])
let serverSection = SectionConfigs(
headerTitle: String.localized("pref_server"),
footerTitle: nil,
cells: [accountSettingsCell])
return [viewLogSection, experimentalSection, encryptionSection, serverSection]
} else {
let appAccessSection = SectionConfigs(
headerTitle: String.localized("pref_app_access"),
footerTitle: String.localized("pref_show_system_contacts_explain"),
cells: [showSystemContactsCell])
let encryptionSection = SectionConfigs(
headerTitle: String.localized("pref_encryption"),
footerTitle: nil,
cells: [autocryptPreferencesCell, manageKeysCell, sendAutocryptMessageCell])
let serverSection = SectionConfigs(
headerTitle: String.localized("pref_server"),
footerTitle: String.localized("pref_only_fetch_mvbox_explain"),
cells: [accountSettingsCell, sentboxWatchCell, sendCopyToSelfCell, mvboxMoveCell, onlyFetchMvboxCell])
return [viewLogSection, experimentalSection, appAccessSection, encryptionSection, serverSection]
}
}()

init(dcAccounts: DcAccounts) {
Expand Down
4 changes: 4 additions & 0 deletions deltachat-ios/DC/DcContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -682,4 +682,8 @@ public class DcContext {
get { return getConfigInt("show_emails") }
set { setConfigInt("show_emails", newValue) }
}

public var isChatmail: Bool {
return getConfigInt("is_chatmail") == 1
}
}
2 changes: 1 addition & 1 deletion deltachat-ios/Handler/DeviceContactsHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DeviceContactsHandler {
}

public func importDeviceContacts() {
if dcContext.getConfigBool("ui.ios.show_system_contacts") && CNContactStore.authorizationStatus(for: .contacts) == .authorized {
if dcContext.getConfigBool("ui.ios.show_system_contacts") && !dcContext.isChatmail && CNContactStore.authorizationStatus(for: .contacts) == .authorized {
addContactsToCore()
}
}
Expand Down
Loading