-
Notifications
You must be signed in to change notification settings - Fork 419
/
SettingsViewController.swift
681 lines (570 loc) · 24.6 KB
/
SettingsViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
//
// SettingsViewController.swift
// DuckDuckGo
//
// Copyright © 2017 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import UIKit
import Core
import BrowserServicesKit
import Persistence
import SwiftUI
import Common
import DDGSync
import Combine
#if APP_TRACKING_PROTECTION
import NetworkExtension
#endif
#if NETWORK_PROTECTION
import NetworkProtection
#endif
// swiftlint:disable file_length type_body_length
class SettingsViewController: UITableViewController {
@IBOutlet weak var defaultBrowserCell: UITableViewCell!
@IBOutlet weak var themeAccessoryText: UILabel!
@IBOutlet weak var fireButtonAnimationAccessoryText: UILabel!
@IBOutlet weak var appIconCell: UITableViewCell!
@IBOutlet weak var appIconImageView: UIImageView!
@IBOutlet weak var autocompleteToggle: UISwitch!
@IBOutlet weak var authenticationToggle: UISwitch!
@IBOutlet weak var autoClearAccessoryText: UILabel!
@IBOutlet weak var versionText: UILabel!
@IBOutlet weak var openUniversalLinksToggle: UISwitch!
@IBOutlet weak var longPressPreviewsToggle: UISwitch!
@IBOutlet weak var rememberLoginsCell: UITableViewCell!
@IBOutlet weak var rememberLoginsAccessoryText: UILabel!
@IBOutlet weak var doNotSellCell: UITableViewCell!
@IBOutlet weak var doNotSellAccessoryText: UILabel!
@IBOutlet weak var autoconsentCell: UITableViewCell!
@IBOutlet weak var autoconsentAccessoryText: UILabel!
@IBOutlet weak var emailProtectionCell: UITableViewCell!
@IBOutlet weak var emailProtectionAccessoryText: UILabel!
@IBOutlet weak var macBrowserWaitlistCell: UITableViewCell!
@IBOutlet weak var macBrowserWaitlistAccessoryText: UILabel!
@IBOutlet weak var windowsBrowserWaitlistCell: UITableViewCell!
@IBOutlet weak var windowsBrowserWaitlistAccessoryText: UILabel!
@IBOutlet weak var netPCell: UITableViewCell!
@IBOutlet weak var longPressCell: UITableViewCell!
@IBOutlet weak var versionCell: UITableViewCell!
@IBOutlet weak var textSizeCell: UITableViewCell!
@IBOutlet weak var textSizeAccessoryText: UILabel!
@IBOutlet weak var widgetEducationCell: UITableViewCell!
@IBOutlet weak var syncCell: UITableViewCell!
@IBOutlet weak var autofillCell: UITableViewCell!
@IBOutlet weak var debugCell: UITableViewCell!
@IBOutlet weak var voiceSearchCell: UITableViewCell!
@IBOutlet weak var voiceSearchToggle: UISwitch!
fileprivate var onDidAppearAction: () -> Void = {}
@IBOutlet var labels: [UILabel]!
@IBOutlet var accessoryLabels: [UILabel]!
private let syncSectionIndex = 1
private let autofillSectionIndex = 2
private let appearanceSectionIndex = 3
private let moreFromDDGSectionIndex = 6
private let debugSectionIndex = 8
private let bookmarksDatabase: CoreDataDatabase
private lazy var emailManager = EmailManager()
private lazy var versionProvider: AppVersion = AppVersion.shared
fileprivate lazy var privacyStore = PrivacyUserDefaults()
fileprivate lazy var appSettings = AppDependencyProvider.shared.appSettings
fileprivate lazy var variantManager = AppDependencyProvider.shared.variantManager
fileprivate lazy var featureFlagger = AppDependencyProvider.shared.featureFlagger
fileprivate let syncService: DDGSyncing
fileprivate let syncDataProviders: SyncDataProviders
fileprivate let internalUserDecider: InternalUserDecider
#if NETWORK_PROTECTION
private let connectionObserver = ConnectionStatusObserverThroughSession()
#endif
private var cancellables: Set<AnyCancellable> = []
private var shouldShowDebugCell: Bool {
return featureFlagger.isFeatureOn(.debugMenu) || isDebugBuild
}
private var shouldShowVoiceSearchCell: Bool {
AppDependencyProvider.shared.voiceSearchHelper.isSpeechRecognizerAvailable
}
private var shouldShowAutofillCell: Bool {
return featureFlagger.isFeatureOn(.autofillAccessCredentialManagement)
}
private var shouldShowSyncCell: Bool {
return featureFlagger.isFeatureOn(.sync)
}
private lazy var shouldShowNetPCell: Bool = {
#if NETWORK_PROTECTION
if #available(iOS 15, *) {
return featureFlagger.isFeatureOn(.networkProtection)
} else {
return false
}
#else
return false
#endif
}()
override func viewDidLoad() {
super.viewDidLoad()
configureAutofillCell()
configureSyncCell()
configureThemeCellAccessory()
configureFireButtonAnimationCellAccessory()
configureTextSizeCell()
configureDisableAutocompleteToggle()
configureSecurityToggles()
configureVersionText()
configureUniversalLinksToggle()
configureLinkPreviewsToggle()
configureRememberLogins()
configureDebugCell()
configureVoiceSearchCell()
configureNetPCell()
applyTheme(ThemeManager.shared.currentTheme)
internalUserDecider.isInternalUserPublisher.dropFirst().sink(receiveValue: { [weak self] _ in
self?.configureAutofillCell()
self?.configureSyncCell()
self?.configureDebugCell()
self?.tableView.reloadData()
// Scroll to force-redraw section headers and footers
self?.tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: false)
})
.store(in: &cancellables)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
configureFireButtonAnimationCellAccessory()
configureTextSizeCell()
configureAutoClearCellAccessory()
configureRememberLogins()
configureDoNotSell()
configureAutoconsent()
configureIconViews()
configureEmailProtectionAccessoryText()
configureMacBrowserWaitlistCell()
configureWindowsBrowserWaitlistCell()
// Make sure multiline labels are correctly presented
tableView.setNeedsLayout()
tableView.layoutIfNeeded()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
onDidAppearAction()
onDidAppearAction = {}
}
init?(coder: NSCoder,
bookmarksDatabase: CoreDataDatabase,
syncService: DDGSyncing,
syncDataProviders: SyncDataProviders,
internalUserDecider: InternalUserDecider) {
self.bookmarksDatabase = bookmarksDatabase
self.syncService = syncService
self.syncDataProviders = syncDataProviders
self.internalUserDecider = internalUserDecider
super.init(coder: coder)
}
required init?(coder: NSCoder) {
fatalError("Not implemented")
}
func openLoginsWhenPresented() {
onDidAppearAction = { [weak self] in
self?.showAutofill()
}
}
func openLoginsWhenPresented(accountDetails: SecureVaultModels.WebsiteAccount) {
onDidAppearAction = { [weak self] in
self?.showAutofillAccountDetails(accountDetails)
}
}
func openCookiePopupManagementWhenPresented() {
onDidAppearAction = { [weak self] in
self?.showCookiePopupManagement(animated: true)
}
}
@IBSegueAction func onCreateRootDebugScreen(_ coder: NSCoder, sender: Any?, segueIdentifier: String?) -> RootDebugViewController {
guard let controller = RootDebugViewController(coder: coder,
sync: syncService,
bookmarksDatabase: bookmarksDatabase,
internalUserDecider: AppDependencyProvider.shared.internalUserDecider) else {
fatalError("Failed to create controller")
}
return controller
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.destination is DoNotSellSettingsViewController {
Pixel.fire(pixel: .settingsDoNotSellShown)
return
} else if segue.destination is AutoconsentSettingsViewController {
Pixel.fire(pixel: .settingsAutoconsentShown)
return
} else if let textSizeSettings = segue.destination as? TextSizeSettingsViewController {
Pixel.fire(pixel: .textSizeSettingsShown)
presentationController?.delegate = textSizeSettings
return
}
if let navController = segue.destination as? UINavigationController, navController.topViewController is FeedbackViewController {
if UIDevice.current.userInterfaceIdiom == .pad {
segue.destination.modalPresentationStyle = .formSheet
}
}
}
private func configureAutofillCell() {
autofillCell.isHidden = !shouldShowAutofillCell
}
private func configureSyncCell() {
syncCell.isHidden = !shouldShowSyncCell
}
private func configureVoiceSearchCell() {
voiceSearchCell.isHidden = !shouldShowVoiceSearchCell
voiceSearchToggle.isOn = appSettings.voiceSearchEnabled
}
private func configureThemeCellAccessory() {
switch appSettings.currentThemeName {
case .systemDefault:
themeAccessoryText.text = UserText.themeAccessoryDefault
case .light:
themeAccessoryText.text = UserText.themeAccessoryLight
case .dark:
themeAccessoryText.text = UserText.themeAccessoryDark
}
}
private func configureFireButtonAnimationCellAccessory() {
fireButtonAnimationAccessoryText.text = appSettings.currentFireButtonAnimation.descriptionText
}
private func configureTextSizeCell() {
textSizeCell.isHidden = UIDevice.current.userInterfaceIdiom == .pad
textSizeAccessoryText.text = "\(appSettings.textSize)%"
}
private func configureIconViews() {
if AppIconManager.shared.isAppIconChangeSupported {
appIconImageView.image = AppIconManager.shared.appIcon.smallImage
} else {
appIconCell.isHidden = true
}
}
private func configureDisableAutocompleteToggle() {
autocompleteToggle.isOn = appSettings.autocomplete
}
private func configureSecurityToggles() {
authenticationToggle.isOn = privacyStore.authenticationEnabled
}
private func configureAutoClearCellAccessory() {
if AutoClearSettingsModel(settings: appSettings) != nil {
autoClearAccessoryText.text = UserText.autoClearAccessoryOn
} else {
autoClearAccessoryText.text = UserText.autoClearAccessoryOff
}
}
private func configureDoNotSell() {
doNotSellAccessoryText.text = appSettings.sendDoNotSell ? UserText.doNotSellEnabled : UserText.doNotSellDisabled
}
private func configureAutoconsent() {
autoconsentAccessoryText.text = appSettings.autoconsentEnabled ? UserText.autoconsentEnabled : UserText.autoconsentDisabled
}
private func configureRememberLogins() {
rememberLoginsAccessoryText.text = PreserveLogins.shared.allowedDomains.isEmpty ? "" : "\(PreserveLogins.shared.allowedDomains.count)"
}
private func configureVersionText() {
versionText.text = versionProvider.versionAndBuildNumber
}
private func configureUniversalLinksToggle() {
openUniversalLinksToggle.isOn = appSettings.allowUniversalLinks
}
private func configureLinkPreviewsToggle() {
longPressCell.isHidden = false
longPressPreviewsToggle.isOn = appSettings.longPressPreviews
}
private func configureMacBrowserWaitlistCell() {
macBrowserWaitlistCell.detailTextLabel?.text = MacBrowserWaitlist.shared.settingsSubtitle
}
private func configureWindowsBrowserWaitlistCell() {
windowsBrowserWaitlistCell.isHidden = !WindowsBrowserWaitlist.shared.isAvailable
if WindowsBrowserWaitlist.shared.isAvailable {
windowsBrowserWaitlistCell.detailTextLabel?.text = WindowsBrowserWaitlist.shared.settingsSubtitle
}
}
private func configureNetPCell() {
netPCell.isHidden = !shouldShowNetPCell
#if NETWORK_PROTECTION
connectionObserver.publisher
.receive(on: DispatchQueue.main)
.sink { [weak self] status in
let detailText: String
switch status {
case .connected:
detailText = UserText.netPCellConnected
default:
detailText = UserText.netPCellDisconnected
}
self?.netPCell.detailTextLabel?.text = detailText
}
.store(in: &cancellables)
#endif
}
private func configureDebugCell() {
debugCell.isHidden = !shouldShowDebugCell
}
private func showSync(animated: Bool = true) {
let controller = SyncSettingsViewController()
navigationController?.pushViewController(controller, animated: animated)
}
private func showAutofill(animated: Bool = true) {
let autofillController = AutofillLoginSettingsListViewController(
appSettings: appSettings,
syncService: syncService,
syncDataProviders: syncDataProviders
)
autofillController.delegate = self
Pixel.fire(pixel: .autofillSettingsOpened)
navigationController?.pushViewController(autofillController, animated: animated)
}
func showAutofillAccountDetails(_ account: SecureVaultModels.WebsiteAccount) {
let autofillController = AutofillLoginSettingsListViewController(
appSettings: appSettings,
syncService: syncService,
syncDataProviders: syncDataProviders
)
autofillController.delegate = self
let detailsController = autofillController.makeAccountDetailsScreen(account)
var controllers = navigationController?.viewControllers ?? []
controllers.append(autofillController)
controllers.append(detailsController)
navigationController?.viewControllers = controllers
}
private func configureEmailProtectionAccessoryText() {
if let userEmail = emailManager.userEmail {
emailProtectionAccessoryText.text = userEmail
} else {
emailProtectionAccessoryText.text = UserText.emailSettingsSubtitle
}
}
private func showEmailWebDashboard() {
UIApplication.shared.open(URL.emailProtectionQuickLink, options: [:], completionHandler: nil)
}
private func showMacBrowserWaitlistViewController() {
navigationController?.pushViewController(MacWaitlistViewController(nibName: nil, bundle: nil), animated: true)
}
#if NETWORK_PROTECTION
private func showNetP() {
// This will be tidied up as part of https://app.asana.com/0/0/1205084446087078/f
let rootViewController = NetworkProtectionRootViewController { [weak self] in
self?.navigationController?.popViewController(animated: true)
let newRootViewController = NetworkProtectionRootViewController { }
self?.pushNetP(newRootViewController)
}
pushNetP(rootViewController)
}
private func pushNetP(_ rootViewController: NetworkProtectionRootViewController) {
navigationController?.pushViewController(
rootViewController,
animated: true
)
}
#endif
private func showWindowsBrowserWaitlistViewController() {
navigationController?.pushViewController(WindowsWaitlistViewController(nibName: nil, bundle: nil), animated: true)
}
func showCookiePopupManagement(animated: Bool = true) {
navigationController?.pushViewController(AutoconsentSettingsViewController.loadFromStoryboard(), animated: animated)
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
let cell = tableView.cellForRow(at: indexPath)
switch cell {
case defaultBrowserCell:
Pixel.fire(pixel: .defaultBrowserButtonPressedSettings)
guard let url = URL(string: UIApplication.openSettingsURLString) else { return }
UIApplication.shared.open(url)
case emailProtectionCell:
showEmailWebDashboard()
case macBrowserWaitlistCell:
showMacBrowserWaitlistViewController()
case windowsBrowserWaitlistCell:
showWindowsBrowserWaitlistViewController()
case autofillCell:
showAutofill()
case syncCell:
showSync()
case netPCell:
#if NETWORK_PROTECTION
showNetP()
#else
break
#endif
default: break
}
}
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
let theme = ThemeManager.shared.currentTheme
cell.backgroundColor = theme.tableCellBackgroundColor
cell.setHighlightedStateBackgroundColor(theme.tableCellHighlightedBackgroundColor)
if cell.accessoryType == .disclosureIndicator {
let accesoryImage = UIImageView(image: UIImage(named: "DisclosureIndicator"))
accesoryImage.frame = CGRect(x: 0, y: 0, width: 8, height: 13)
accesoryImage.tintColor = theme.tableCellAccessoryColor
cell.accessoryView = accesoryImage
}
}
override func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection: Int) {
if let view = view as? UITableViewHeaderFooterView {
let theme = ThemeManager.shared.currentTheme
view.textLabel?.textColor = theme.tableHeaderTextColor
}
}
override func tableView(_ tableView: UITableView, willDisplayFooterView view: UIView, forSection: Int) {
if let view = view as? UITableViewHeaderFooterView {
let theme = ThemeManager.shared.currentTheme
view.textLabel?.textColor = theme.tableHeaderTextColor
}
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let cell = super.tableView(tableView, cellForRowAt: indexPath)
return cell.isHidden ? 0 : UITableView.automaticDimension
}
override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
return UITableView.automaticDimension
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if syncSectionIndex == section && !shouldShowSyncCell {
return CGFloat.leastNonzeroMagnitude
} else if autofillSectionIndex == section && !shouldShowAutofillCell {
return CGFloat.leastNonzeroMagnitude
} else if debugSectionIndex == section && !shouldShowDebugCell {
return CGFloat.leastNonzeroMagnitude
} else {
return super.tableView(tableView, heightForHeaderInSection: section)
}
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if syncSectionIndex == section && !shouldShowSyncCell {
return CGFloat.leastNonzeroMagnitude
} else if autofillSectionIndex == section && !shouldShowAutofillCell {
return CGFloat.leastNonzeroMagnitude
} else if debugSectionIndex == section && !shouldShowDebugCell {
return CGFloat.leastNonzeroMagnitude
} else if moreFromDDGSectionIndex == section && !shouldShowNetPCell {
return CGFloat.leastNonzeroMagnitude
} else {
return super.tableView(tableView, heightForFooterInSection: section)
}
}
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
return super.tableView(tableView, titleForFooterInSection: section)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
let rows = super.tableView(tableView, numberOfRowsInSection: section)
if section == appearanceSectionIndex && textSizeCell.isHidden {
return rows - 1
} else if section == moreFromDDGSectionIndex && !shouldShowNetPCell {
return rows - 1
} else {
return rows
}
}
@IBAction func onVoiceSearchToggled(_ sender: UISwitch) {
var enableVoiceSearch = sender.isOn
let isFirstTimeAskingForPermission = SpeechRecognizer.recordPermission == .undetermined
SpeechRecognizer.requestMicAccess { permission in
if !permission {
enableVoiceSearch = false
sender.setOn(false, animated: true)
if !isFirstTimeAskingForPermission {
self.showNoMicrophonePermissionAlert()
}
}
AppDependencyProvider.shared.voiceSearchHelper.enableVoiceSearch(enableVoiceSearch)
}
}
private func showNoMicrophonePermissionAlert() {
let alertController = NoMicPermissionAlert.buildAlert()
present(alertController, animated: true, completion: nil)
}
@IBAction func onAuthenticationToggled(_ sender: UISwitch) {
privacyStore.authenticationEnabled = sender.isOn
}
@IBAction func onDonePressed(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
@IBAction func onAutocompleteToggled(_ sender: UISwitch) {
appSettings.autocomplete = sender.isOn
}
@IBAction func onAllowUniversalLinksToggled(_ sender: UISwitch) {
appSettings.allowUniversalLinks = sender.isOn
}
@IBAction func onLinkPreviewsToggle(_ sender: UISwitch) {
appSettings.longPressPreviews = sender.isOn
}
}
extension SettingsViewController: Themable {
func decorate(with theme: Theme) {
view.backgroundColor = theme.backgroundColor
decorateNavigationBar(with: theme)
configureThemeCellAccessory()
for label in labels {
label.textColor = theme.tableCellTextColor
}
for label in accessoryLabels {
label.textColor = theme.tableCellAccessoryTextColor
}
versionText.textColor = theme.tableCellTextColor
autocompleteToggle.onTintColor = theme.buttonTintColor
authenticationToggle.onTintColor = theme.buttonTintColor
openUniversalLinksToggle.onTintColor = theme.buttonTintColor
longPressPreviewsToggle.onTintColor = theme.buttonTintColor
voiceSearchToggle.onTintColor = theme.buttonTintColor
tableView.backgroundColor = theme.backgroundColor
tableView.separatorColor = theme.tableCellSeparatorColor
UIView.transition(with: view,
duration: 0.2,
options: .transitionCrossDissolve, animations: {
self.tableView.reloadData()
}, completion: nil)
}
}
extension SettingsViewController {
static var fontSizeForHeaderView: CGFloat {
let contentSize = UIApplication.shared.preferredContentSizeCategory
switch contentSize {
case .extraSmall:
return 12
case .small:
return 12
case .medium:
return 12
case .large:
return 13
case .extraLarge:
return 15
case .extraExtraLarge:
return 17
case .extraExtraExtraLarge:
return 19
case .accessibilityMedium:
return 23
case .accessibilityLarge:
return 27
case .accessibilityExtraLarge:
return 33
case .accessibilityExtraExtraLarge:
return 38
case .accessibilityExtraExtraExtraLarge:
return 44
default:
return 13
}
}
}
// MARK: - AutofillLoginSettingsListViewControllerDelegate
extension SettingsViewController: AutofillLoginSettingsListViewControllerDelegate {
func autofillLoginSettingsListViewControllerDidFinish(_ controller: AutofillLoginSettingsListViewController) {
navigationController?.popViewController(animated: true)
}
}
// swiftlint:enable file_length type_body_length