|
@@ -20,6 +20,12 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
var switchSaveToGallery = UISwitch()
|
|
|
var switchAutoDownload = UISwitch()
|
|
|
|
|
|
+ let separatorLogout = UIView()
|
|
|
+ let separatorNotifPersonal = UIView()
|
|
|
+ let separatorAutoDownload = UIView()
|
|
|
+ let separatorVersion = UIView()
|
|
|
+ let separatorLogin = UIView()
|
|
|
+
|
|
|
var notInTab = false
|
|
|
|
|
|
public override func viewDidLoad() {
|
|
@@ -27,7 +33,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
|
|
|
tableView.delegate = self
|
|
|
tableView.dataSource = self
|
|
|
- tableView.layoutMargins = .init(top: 0, left: 5, bottom: 0, right: 5)
|
|
|
+ tableView.layoutMargins = .init(top: 0, left: 0, bottom: 0, right: 0)
|
|
|
// tableView.separatorColor = .gray
|
|
|
tableView.separatorStyle = .none
|
|
|
|
|
@@ -102,28 +108,28 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
}
|
|
|
if ( User.isInternal(userType: cursorUser.string(forColumnIndex: 0) ?? "") && position == "1") || User.isOfficial(official_account: cursorUser.string(forColumnIndex: 2) ?? "") || User.isOfficial(official_account: cursorUser.string(forColumnIndex: 2) ?? "") {
|
|
|
Item.menus["Personal"] = [
|
|
|
- Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "person"), title: "Personal Information".localized()),
|
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized()),
|
|
|
Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Sign-In to Web".localized()),
|
|
|
]
|
|
|
} else if User.isInternal(userType: cursorUser.string(forColumnIndex: 0) ?? "") || User.isCallCenter(userType: cursorUser.string(forColumnIndex: 0) ?? "") || User.isVerified(official_account: cursorUser.string(forColumnIndex: 2) ?? "") {
|
|
|
Item.menus["Personal"] = [
|
|
|
- Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "person"), title: "Personal Information".localized()),
|
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Sign-In to Web".localized()),
|
|
|
]
|
|
|
} else {
|
|
|
Item.menus["Personal"] = [
|
|
|
- Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "person"), title: "Personal Information".localized()),
|
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
- Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Access Admin / Internal Features".localized()),
|
|
|
+ Item(icon: UIImage(named: "ic_internal", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, title: "Access Admin / Internal Features".localized()),
|
|
|
]
|
|
|
}
|
|
|
if !isChangeProfile {
|
|
|
Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Sign-Up/Sign-In".localized()))
|
|
|
} else if isChangeProfile {
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "arrow.counterclockwise.icloud.fill"), title: "Backup & Restore".localized()))
|
|
|
+ Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "arrow.clockwise.icloud"), title: "Backup & Restore".localized()))
|
|
|
Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Sign-Out".localized()))
|
|
|
}
|
|
|
let image = cursorUser.string(forColumnIndex: 1)
|
|
@@ -164,9 +170,9 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
cursorUser.close()
|
|
|
} else {
|
|
|
Item.menus["Personal"] = [
|
|
|
- Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "person"), title: "Personal Information".localized()),
|
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
- Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Access Admin / Internal Features".localized()),
|
|
|
+ Item(icon: UIImage(named: ""), title: "Access Admin / Internal Features".localized()),
|
|
|
Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Sign-Up/Sign-In".localized())
|
|
|
]
|
|
|
if !imageSignIn.isEmpty {
|
|
@@ -252,6 +258,12 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
|
|
|
public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
|
|
|
+ let isChangeProfile = Utils.getSetProfile()
|
|
|
+ if !isChangeProfile {
|
|
|
+ separatorLogout.removeFromSuperview()
|
|
|
+ } else {
|
|
|
+ separatorLogin.removeFromSuperview()
|
|
|
+ }
|
|
|
cell.accessoryType = .none
|
|
|
cell.indentationLevel = 0
|
|
|
var content = cell.defaultContentConfiguration()
|
|
@@ -267,7 +279,6 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
content.imageProperties.maximumSize = CGSize(width: 24, height: 24)
|
|
|
content.text = menu.title
|
|
|
cell.accessoryView = nil
|
|
|
- cell.separatorInset = UIEdgeInsets(top: .greatestFiniteMagnitude, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
|
|
|
switch menu.title {
|
|
|
case "Personal Information".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
@@ -277,10 +288,14 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
case "Sign-Up/Sign-In".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Backup & Restore".localized():
|
|
|
- cell.accessoryType = .disclosureIndicator
|
|
|
+ separatorLogin.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorLogin)
|
|
|
case "Notification Message(s)".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
+ separatorNotifPersonal.removeFromSuperview()
|
|
|
+ cell.addTopBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorNotifPersonal)
|
|
|
+ case "Backup & Restore".localized():
|
|
|
+ cell.accessoryType = .disclosureIndicator
|
|
|
case "Notification Message(s) Group".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
// case "Logout".localized():
|
|
@@ -296,12 +311,19 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
accessoryButton.frame = CGRect(x: 0, y: 0, width: 100, height: 40)
|
|
|
accessoryButton.contentMode = .scaleAspectFit
|
|
|
cell.accessoryView = accessoryButton as UIView
|
|
|
+ separatorVersion.removeFromSuperview()
|
|
|
+ cell.addTopBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorVersion)
|
|
|
case "Vibrate Mode".localized():
|
|
|
cell.accessoryView = switchVibrateMode
|
|
|
case "Save to Gallery".localized():
|
|
|
cell.accessoryView = switchSaveToGallery
|
|
|
case "Auto Download".localized():
|
|
|
cell.accessoryView = switchAutoDownload
|
|
|
+ separatorAutoDownload.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorAutoDownload)
|
|
|
+ case "Sign-Out".localized():
|
|
|
+ separatorLogout.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorLogout)
|
|
|
default:
|
|
|
content.secondaryText = nil
|
|
|
}
|
|
@@ -310,45 +332,10 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
return cell
|
|
|
}
|
|
|
|
|
|
- private func checkIsChangePerson() -> Bool {
|
|
|
- let isChangeProfile = Utils.getSetProfile()
|
|
|
- if !isChangeProfile {
|
|
|
- let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
|
|
|
- alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
|
|
|
- let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "signupsignin") as! SignUpSignIn
|
|
|
- controller.forceLogin = true
|
|
|
- let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
- navigationController.navigationBar.tintColor = .white
|
|
|
- navigationController.navigationBar.barTintColor = .mainColor
|
|
|
- navigationController.navigationBar.isTranslucent = false
|
|
|
- navigationController.navigationBar.overrideUserInterfaceStyle = .dark
|
|
|
- navigationController.navigationBar.barStyle = .black
|
|
|
- let cancelButtonAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: UIColor.white]
|
|
|
- UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, for: .normal)
|
|
|
- let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
- navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
- navigationController.view.backgroundColor = .mainColor
|
|
|
- if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
|
- UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
|
|
|
- } else {
|
|
|
- UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
- }
|
|
|
- }))
|
|
|
- if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
|
- UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
|
|
|
- } else {
|
|
|
- UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
|
|
|
- }
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
- }
|
|
|
-
|
|
|
public override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
|
|
let item = Item.menuFor(section: indexPath.section)[indexPath.row]
|
|
|
if item.title == "Personal Information".localized() {
|
|
|
- if(checkIsChangePerson()){
|
|
|
+ if(Nexilis.checkIsChangePerson()){
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "profileView") as! ProfileViewController
|
|
|
controller.data = UserDefaults.standard.string(forKey: "me")!
|
|
|
controller.flag = .me
|
|
@@ -362,7 +349,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
navigationController?.show(controller, sender: nil)
|
|
|
}
|
|
|
} else if item.title == "Access Admin / Internal Features".localized() || item.title == "Change Admin / Internal Password".localized() {
|
|
|
- if(checkIsChangePerson()){
|
|
|
+ if(Nexilis.checkIsChangePerson()){
|
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
@@ -566,6 +553,9 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
self.present(navigationController, animated: true)
|
|
|
+ } else if item.title == "Backup & Restore".localized() {
|
|
|
+ let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "backupRestore") as! BackupRestoreView
|
|
|
+ navigationController?.show(controller, sender: nil)
|
|
|
}
|
|
|
}
|
|
|
|