Skip to content

Commit 049f6c2

Browse files
NMC 1984 - privacySettingsViewController file removed to avoid conflicts
1 parent 7547721 commit 049f6c2

File tree

1 file changed

+0
-133
lines changed

1 file changed

+0
-133
lines changed
Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +0,0 @@
1-
//
2-
// PrivacySettingsViewController.swift
3-
// Nextcloud
4-
//
5-
// Created by A200073704 on 25/04/23.
6-
// Copyright © 2023 Marino Faggiana. All rights reserved.
7-
//
8-
9-
import Foundation
10-
import AppTrackingTransparency
11-
import AdSupport
12-
13-
class PrivacySettingsViewController: XLFormViewController{
14-
15-
@objc public var isShowSettingsButton: Bool = false
16-
17-
override func viewDidLoad() {
18-
super.viewDidLoad()
19-
self.title = NSLocalizedString("_privacy_settings_title_", comment: "")
20-
21-
NotificationCenter.default.addObserver(self, selector: #selector(changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
22-
23-
let nib = UINib(nibName: "CustomSectionHeader", bundle: nil)
24-
self.tableView.register(nib, forHeaderFooterViewReuseIdentifier: "customSectionHeader")
25-
isShowSettingsButton = UserDefaults.standard.bool(forKey: "showSettingsButton")
26-
self.navigationController?.navigationBar.tintColor = NCBrandColor.shared.brand
27-
changeTheming()
28-
}
29-
30-
@objc func changeTheming() {
31-
tableView.backgroundColor = .systemGroupedBackground
32-
tableView.separatorColor = .none
33-
tableView.separatorColor = .clear
34-
tableView.reloadData()
35-
initializeForm()
36-
}
37-
38-
//MARK: XLForm
39-
func initializeForm() {
40-
let form : XLFormDescriptor = XLFormDescriptor() as XLFormDescriptor
41-
form.rowNavigationOptions = XLFormRowNavigationOptions.stopDisableRow
42-
43-
var section : XLFormSectionDescriptor
44-
var row : XLFormRowDescriptor
45-
46-
// Section: Destination Folder
47-
48-
section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("", comment: "").uppercased())
49-
section.footerTitle = " "
50-
form.addFormSection(section)
51-
52-
section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("", comment: "").uppercased())
53-
section.footerTitle = NSLocalizedString("_privacy_settings_help_text_", comment: "")
54-
form.addFormSection(section)
55-
56-
//custom cell
57-
section = XLFormSectionDescriptor.formSection(withTitle: "")
58-
section.footerTitle = NSLocalizedString("_required_data_collection_help_text_", comment: "")
59-
form.addFormSection(section)
60-
61-
XLFormViewController.cellClassesForRowDescriptorTypes()["RequiredDataCollectionCustomCellType"] = RequiredDataCollectionSwitch.self
62-
63-
row = XLFormRowDescriptor(tag: "ButtonDestinationFolder", rowType: "RequiredDataCollectionCustomCellType", title: "")
64-
row.cellConfig["requiredDataCollectionSwitchControl.onTintColor"] = NCBrandColor.shared.brand
65-
row.cellConfig["cellLabel.textAlignment"] = NSTextAlignment.left.rawValue
66-
row.cellConfig["cellLabel.font"] = UIFont.systemFont(ofSize: 15.0)
67-
row.cellConfig["cellLabel.textColor"] = UIColor.label //photos
68-
row.cellConfig["cellLabel.text"] = NSLocalizedString("_required_data_collection_", comment: "")
69-
section.addFormRow(row)
70-
71-
section = XLFormSectionDescriptor.formSection(withTitle: NSLocalizedString("", comment: "").uppercased())
72-
section.footerTitle = NSLocalizedString("_analysis_data_acqusition_help_text_", comment: "")
73-
form.addFormSection(section)
74-
75-
XLFormViewController.cellClassesForRowDescriptorTypes()["AnalysisDataCollectionCustomCellType"] = AnalysisDataCollectionSwitch.self
76-
77-
row = XLFormRowDescriptor(tag: "AnalysisDataCollectionSwitch", rowType: "AnalysisDataCollectionCustomCellType", title: "")
78-
row.cellConfig["analysisDataCollectionSwitchControl.onTintColor"] = NCBrandColor.shared.brand
79-
row.cellConfig["cellLabel.textAlignment"] = NSTextAlignment.left.rawValue
80-
row.cellConfig["cellLabel.font"] = UIFont.systemFont(ofSize: 15.0)
81-
row.cellConfig["cellLabel.textColor"] = UIColor.label //photos
82-
row.cellConfig["cellLabel.text"] = NSLocalizedString("_analysis_data_acqusition_", comment: "")
83-
if(UserDefaults.standard.bool(forKey: "isAnalysisDataCollectionSwitchOn")){
84-
row.cellConfigAtConfigure["analysisDataCollectionSwitchControl.on"] = 1
85-
}else {
86-
row.cellConfigAtConfigure["analysisDataCollectionSwitchControl.on"] = 0
87-
}
88-
89-
section.addFormRow(row)
90-
91-
XLFormViewController.cellClassesForRowDescriptorTypes()["SaveSettingsButton"] = SaveSettingsCustomButtonCell.self
92-
93-
section = XLFormSectionDescriptor.formSection(withTitle: "")
94-
form.addFormSection(section)
95-
96-
row = XLFormRowDescriptor(tag: "SaveSettingsButton", rowType: "SaveSettingsButton", title: "")
97-
row.cellConfig["backgroundColor"] = UIColor.clear
98-
99-
if(isShowSettingsButton){
100-
section.addFormRow(row)
101-
}
102-
103-
self.form = form
104-
}
105-
106-
override func formRowDescriptorValueHasChanged(_ formRow: XLFormRowDescriptor!, oldValue: Any!, newValue: Any!) {
107-
super.formRowDescriptorValueHasChanged(formRow, oldValue: oldValue, newValue: newValue)
108-
109-
if formRow.tag == "SaveSettingsButton" {
110-
print("save settings clicked")
111-
//TODO save button state and leave the page
112-
self.navigationController?.popViewController(animated: true)
113-
114-
}
115-
if formRow.tag == "AnalysisDataCollectionSwitch"{
116-
if (formRow.value! as AnyObject).boolValue {
117-
if #available(iOS 14, *) {
118-
ATTrackingManager.requestTrackingAuthorization(completionHandler: { (status) in
119-
if status == .denied {
120-
guard let url = URL(string: UIApplication.openSettingsURLString) else {
121-
return
122-
}
123-
if UIApplication.shared.canOpenURL(url) {
124-
UIApplication.shared.open(url, options: [:])
125-
}
126-
}
127-
})
128-
}
129-
}
130-
UserDefaults.standard.set((formRow.value! as AnyObject).boolValue, forKey: "isAnalysisDataCollectionSwitchOn")
131-
}
132-
}
133-
}

0 commit comments

Comments
 (0)