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

more modern settings pages #2474

Merged
merged 5 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class AccountSetupController: UITableViewController {
self.imapSecurityValue = AccountSetupSecurityValue(initValue: dcContext.getConfigInt("mail_security"))
self.smtpSecurityValue = AccountSetupSecurityValue(initValue: dcContext.getConfigInt("send_security"))

super.init(style: .grouped)
super.init(style: .insetGrouped)
hidesBottomBarWhenPushed = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CertificateCheckController: UITableViewController {
for (index, value) in options.enumerated() where currentValue == value {
selectedIndex = index
}
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = sectionTitle
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SecuritySettingsController: UITableViewController {

init(initValue: Int, title: String) {
selectedIndex = options.firstIndex(of: Int32(initValue)) ?? 0
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = title
}

Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Controller/ContactDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class ContactDetailViewController: UITableViewController {

init(dcContext: DcContext, contactId: Int) {
self.viewModel = ContactDetailViewModel(dcContext: dcContext, contactId: contactId)
super.init(style: .grouped)
super.init(style: .insetGrouped)

NotificationCenter.default.addObserver(self, selector: #selector(ContactDetailViewController.handleContactsChanged(_:)), name: Event.contactsChanged, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(ContactDetailViewController.handleIncomingMessage(_:)), name: Event.incomingMessage, object: nil)
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Controller/EditContactController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EditContactController: UITableViewController {
dcContact = dcContext.getContact(id: contactIdForUpdate)
authNameOrAddr = dcContact.authName.isEmpty ? dcContact.email : dcContact.authName
cells = [nameCell]
super.init(style: .grouped)
super.init(style: .insetGrouped)

nameCell.textFieldDelegate = self
nameCell.textField.text = dcContact.editedName
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Controller/EditGroupViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class EditGroupViewController: UITableViewController, MediaPickerDelegate {
} else {
self.editRows = [.name, .avatar]
}
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.avatarSelectionCell.hintLabel.text = String.localized(useGroupWording ? "group_avatar" : "image")
self.avatarSelectionCell.onAvatarTapped = onAvatarTapped
title = String.localized(useGroupWording ? "menu_edit_group" : "global_menu_edit_desktop")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EphemeralMessagesViewController: UITableViewController {
init(dcContext: DcContext, chatId: Int) {
self.dcContext = dcContext
self.chatId = chatId
super.init(style: .grouped)
super.init(style: .insetGrouped)

// select option close to the timespan (that may no be available as an option eg. in case option have changed)
self.currentIndex = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class GroupChatDetailViewController: UIViewController {
}()

lazy var tableView: UITableView = {
let table = UITableView(frame: .zero, style: .grouped)
let table = UITableView(frame: .zero, style: .insetGrouped)
table.register(ActionCell.self, forCellReuseIdentifier: ActionCell.reuseIdentifier)
table.register(ContactCell.self, forCellReuseIdentifier: ContactCell.reuseIdentifier)
table.delegate = self
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Controller/NewGroupController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class NewGroupController: UITableViewController, MediaPickerDelegate {
templateChat = nil
}
self.groupContactIds = Array(contactIdsForGroup)
super.init(style: .grouped)
super.init(style: .insetGrouped)
}

required init?(coder _: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ internal final class AdvancedViewController: UITableViewController {
init(dcAccounts: DcAccounts) {
self.dcContext = dcAccounts.getSelected()
self.dcAccounts = dcAccounts
super.init(style: .grouped)
super.init(style: .insetGrouped)
hidesBottomBarWhenPushed = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class AutodelOptionsViewController: UITableViewController {
self.dcContext = dcContext
self.fromServer = fromServer
self.currVal = dcContext.getConfigInt(fromServer ? "delete_server_after" : "delete_device_after")
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = String.localized("delete_old_messages")
hidesBottomBarWhenPushed = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AutodelOverviewViewController: UITableViewController {

init(dcContext: DcContext) {
self.dcContext = dcContext
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = String.localized("delete_old_messages")
hidesBottomBarWhenPushed = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ internal final class ChatsAndMediaViewController: UITableViewController {
init(dcAccounts: DcAccounts) {
self.dcContext = dcAccounts.getSelected()
self.dcAccounts = dcAccounts
super.init(style: .grouped)
super.init(style: .insetGrouped)
hidesBottomBarWhenPushed = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DownloadOnDemandViewController: UITableViewController {
init(dcContext: DcContext) {
self.dcContext = dcContext
self.options = [0, 163840, 655360, 5242880, 26214400]
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = String.localized("auto_download_messages")
hidesBottomBarWhenPushed = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EmailOptionsViewController: UITableViewController {
init(dcContext: DcContext) {
self.dcContext = dcContext
self.options = [Int(DC_SHOW_EMAILS_OFF), Int(DC_SHOW_EMAILS_ACCEPTED_CONTACTS), Int(DC_SHOW_EMAILS_ALL)]
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = String.localized("pref_show_emails")
hidesBottomBarWhenPushed = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MediaQualityViewController: UITableViewController {
init(dcContext: DcContext) {
self.dcContext = dcContext
self.options = [Int(DC_MEDIA_QUALITY_BALANCED), Int(DC_MEDIA_QUALITY_WORSE)]
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.title = String.localized("pref_outgoing_media_quality")
hidesBottomBarWhenPushed = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ProxySettingsViewController: UITableViewController {
addProxyCell.actionTitle = String.localized("proxy_add")
toggleProxyCell = SwitchCell(textLabel: String.localized("proxy_use_proxy"), on: dcContext.isProxyEnabled)

super.init(style: .grouped)
super.init(style: .insetGrouped)

tableView.register(SwitchCell.self, forCellReuseIdentifier: SwitchCell.reuseIdentifier)
tableView.register(ActionCell.self, forCellReuseIdentifier: ActionCell.reuseIdentifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SelfProfileViewController: UITableViewController, MediaPickerDelegate {
init(dcAccounts: DcAccounts) {
self.dcAccounts = dcAccounts
self.dcContext = dcAccounts.getSelected()
super.init(style: .grouped)
super.init(style: .insetGrouped)
hidesBottomBarWhenPushed = true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ internal final class SettingsViewController: UITableViewController {
init(dcAccounts: DcAccounts) {
self.dcContext = dcAccounts.getSelected()
self.dcAccounts = dcAccounts
super.init(style: .grouped)
super.init(style: .insetGrouped)

// set connectivity changed observer before we acutally init `connectivityCell.detailTextLabel` in `updateCells()`,
// otherwise, we may miss events and the label is not correct.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class VideoChatInstanceViewController: UITableViewController {

init(dcContext: DcContext) {
self.dcContext = dcContext
super.init(style: .grouped)
super.init(style: .insetGrouped)
self.updateSelected(selectedCustom: false)
self.title = String.localized("videochat_instance")
hidesBottomBarWhenPushed = true
Expand Down
13 changes: 7 additions & 6 deletions deltachat-ios/View/ContactDetailHeader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class ContactDetailHeader: UIView {
}

private func setupSubviews() {
let margin: CGFloat = 10
let lrMargin: CGFloat = 16
let spacing: CGFloat = 10
let horizontalStackView = UIStackView(arrangedSubviews: [searchButton, muteButton])

addSubview(avatar)
Expand All @@ -142,22 +143,22 @@ class ContactDetailHeader: UIView {
addConstraints([
avatar.constraintWidthTo(badgeSize),
avatar.constraintHeightTo(badgeSize),
avatar.constraintAlignLeadingTo(self, paddingLeading: badgeSize / 4),
avatar.constraintAlignLeadingTo(self, paddingLeading: lrMargin),
avatar.constraintCenterYTo(self),
greenCheckmark.constraintHeightTo(titleLabel.font.pointSize * 0.9),
greenCheckmark.widthAnchor.constraint(equalTo: greenCheckmark.heightAnchor),
])

labelsContainer.leadingAnchor.constraint(equalTo: avatar.trailingAnchor, constant: margin).isActive = true
labelsContainer.leadingAnchor.constraint(equalTo: avatar.trailingAnchor, constant: spacing).isActive = true
labelsContainer.centerYAnchor.constraint(equalTo: avatar.centerYAnchor).isActive = true
labelsContainer.trailingAnchor.constraint(equalTo: horizontalStackView.leadingAnchor, constant: -margin).isActive = true
labelsContainer.trailingAnchor.constraint(equalTo: horizontalStackView.leadingAnchor, constant: -spacing).isActive = true

horizontalStackView.axis = .horizontal
horizontalStackView.distribution = .fillEqually
horizontalStackView.alignment = .center
horizontalStackView.constraintAlignTrailingToAnchor(trailingAnchor, paddingTrailing: margin).isActive = true
horizontalStackView.constraintAlignTrailingToAnchor(trailingAnchor, paddingTrailing: lrMargin).isActive = true
horizontalStackView.constraintCenterYTo(self).isActive = true
horizontalStackView.spacing = margin
horizontalStackView.spacing = spacing
}

func updateDetails(title: String?, subtitle: String?) {
Expand Down
Loading