Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #4336: Put 'Set as default' setting on top of settings screen. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
iccub authored Oct 30, 2021
1 parent daba2e7 commit 242fffd
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions Client/Frontend/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class SettingsViewController: TableViewController {

private var sections: [Static.Section] {
var list = [
defaultBrowserSection,
featuresSection,
generalSection,
displaySection,
Expand Down Expand Up @@ -172,6 +173,21 @@ class SettingsViewController: TableViewController {
return Static.Section(header: .view(header))
}()

private lazy var defaultBrowserSection: Static.Section = {
var section = Static.Section(
rows: [
.init(text: Strings.setDefaultBrowserSettingsCell, selection: { [unowned self] in
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
UIApplication.shared.open(settingsUrl)
}, cellClass: MultilineButtonCell.self)
]
)

return section
}()

private lazy var featuresSection: Static.Section = {
var section = Static.Section(
header: .title(Strings.features),
Expand Down Expand Up @@ -273,15 +289,6 @@ class SettingsViewController: TableViewController {
option: Preferences.General.mediaAutoBackgrounding,
image: #imageLiteral(resourceName: "background_play_settings_icon").template)
])

if AppConstants.iOSVersionGreaterThanOrEqual(to: 14) && AppConstants.buildChannel == .release {
general.rows.append(.init(text: Strings.setDefaultBrowserSettingsCell, selection: { [unowned self] in
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
return
}
UIApplication.shared.open(settingsUrl)
}, cellClass: MultilineButtonCell.self))
}

return general
}()
Expand Down

0 comments on commit 242fffd

Please sign in to comment.