mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-18 23:48:29 +02:00
Use footers for app and discovery information.
Remove Invite Friends button from settings. Reorganise Advanced and Other settings. Rename Other to About.
This commit is contained in:
@@ -23,7 +23,6 @@ import Foundation
|
||||
}
|
||||
|
||||
private enum DiscoverySectionRows {
|
||||
case info(text: String)
|
||||
case button(title: String, action: () -> Void)
|
||||
case threePid(threePid: MX3PID)
|
||||
}
|
||||
@@ -41,10 +40,7 @@ private enum DiscoverySectionRows {
|
||||
@objc weak var delegate: SettingsDiscoveryTableViewSectionDelegate?
|
||||
|
||||
@objc var attributedFooterTitle: NSAttributedString?
|
||||
|
||||
@objc var footerShouldScrollToUserSettings: Bool {
|
||||
attributedFooterTitle != nil
|
||||
}
|
||||
@objc var footerShouldScrollToUserSettings = false
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -94,13 +90,6 @@ private enum DiscoverySectionRows {
|
||||
}
|
||||
|
||||
switch discoveryRow {
|
||||
case .info(let infoText):
|
||||
if let infoCell: MXKTableViewCell = self.cellType(at: row) {
|
||||
infoCell.textLabel?.numberOfLines = 0
|
||||
infoCell.textLabel?.text = infoText
|
||||
infoCell.selectionStyle = .none
|
||||
cell = infoCell
|
||||
}
|
||||
case .button(title: let title, action: let action):
|
||||
if let buttonCell: MXKTableViewCellWithButton = self.cellType(at: row) {
|
||||
buttonCell.mxkButton.setTitle(title, for: .normal)
|
||||
@@ -172,7 +161,10 @@ private enum DiscoverySectionRows {
|
||||
|
||||
private func updateRows() {
|
||||
|
||||
attributedFooterTitle = nil;
|
||||
// reset the footer
|
||||
attributedFooterTitle = nil
|
||||
footerShouldScrollToUserSettings = false
|
||||
|
||||
let discoveryRows: [DiscoverySectionRows]
|
||||
|
||||
switch self.viewState {
|
||||
@@ -181,19 +173,21 @@ private enum DiscoverySectionRows {
|
||||
case .loaded(let displayMode):
|
||||
switch displayMode {
|
||||
case .noIdentityServer:
|
||||
discoveryRows = [
|
||||
.info(text: VectorL10n.settingsDiscoveryNoIdentityServer)
|
||||
]
|
||||
discoveryRows = []
|
||||
attributedFooterTitle = NSAttributedString(string: VectorL10n.settingsDiscoveryNoIdentityServer)
|
||||
case .termsNotSigned(let host):
|
||||
discoveryRows = [
|
||||
.info(text: VectorL10n.settingsDiscoveryTermsNotSigned(host)),
|
||||
.button(title: VectorL10n.accept, action: { [weak self] in
|
||||
.button(title: VectorL10n.settingsDiscoveryAcceptTerms, action: { [weak self] in
|
||||
self?.viewModel.process(viewAction: .acceptTerms)
|
||||
})
|
||||
]
|
||||
|
||||
attributedFooterTitle = NSAttributedString(string: VectorL10n.settingsDiscoveryTermsNotSigned(host))
|
||||
case .noThreePidsAdded:
|
||||
discoveryRows = []
|
||||
attributedFooterTitle = self.threePidsManagementInfoAttributedString()
|
||||
|
||||
attributedFooterTitle = threePidsManagementInfoAttributedString()
|
||||
footerShouldScrollToUserSettings = true
|
||||
case .threePidsAdded(let emails, let phoneNumbers):
|
||||
|
||||
let emailThreePids = emails.map { (email) -> DiscoverySectionRows in
|
||||
@@ -204,20 +198,18 @@ private enum DiscoverySectionRows {
|
||||
return .threePid(threePid: phoneNumber)
|
||||
}
|
||||
|
||||
var threePidsRows: [DiscoverySectionRows] = []
|
||||
threePidsRows.append(contentsOf: emailThreePids)
|
||||
threePidsRows.append(contentsOf: phoneNumbersThreePids)
|
||||
attributedFooterTitle = self.threePidsManagementInfoAttributedString()
|
||||
discoveryRows = emailThreePids + phoneNumbersThreePids
|
||||
|
||||
discoveryRows = threePidsRows
|
||||
attributedFooterTitle = threePidsManagementInfoAttributedString()
|
||||
footerShouldScrollToUserSettings = true
|
||||
}
|
||||
case .error:
|
||||
discoveryRows = [
|
||||
.info(text: VectorL10n.settingsDiscoveryErrorMessage),
|
||||
.button(title: VectorL10n.retry, action: { [weak self] in
|
||||
self?.viewModel.process(viewAction: .load)
|
||||
})
|
||||
]
|
||||
attributedFooterTitle = NSAttributedString(string: VectorL10n.settingsDiscoveryErrorMessage)
|
||||
}
|
||||
|
||||
self.discoveryRows = discoveryRows
|
||||
|
||||
Reference in New Issue
Block a user