|
@@ -20,17 +20,25 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
var switchSaveToGallery = UISwitch()
|
|
|
var switchAutoDownload = UISwitch()
|
|
|
|
|
|
- let separatorLogout = UIView()
|
|
|
+ let separatorBackupRestore = UIView()
|
|
|
let separatorNotifPersonal = UIView()
|
|
|
let separatorAutoDownload = UIView()
|
|
|
let separatorVersion = UIView()
|
|
|
let separatorLogin = UIView()
|
|
|
+ let separatorCFBTop = UIView()
|
|
|
+ let separatorCFBBot = UIView()
|
|
|
+ let separatorCYATop = UIView()
|
|
|
+ let separatorCYABot = UIView()
|
|
|
+ let separatorBCABot = UIView()
|
|
|
|
|
|
var notInTab = false
|
|
|
|
|
|
public override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
|
+ self.view.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .black : .white
|
|
|
+ self.navigationController?.navigationBar.topItem?.backButtonTitle = ""
|
|
|
+
|
|
|
tableView.delegate = self
|
|
|
tableView.dataSource = self
|
|
|
tableView.layoutMargins = .init(top: 0, left: 0, bottom: 0, right: 0)
|
|
@@ -58,8 +66,19 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
switchVibrateMode.addTarget(self, action: #selector(vibrateModeSwitch), for: .valueChanged)
|
|
|
switchSaveToGallery.addTarget(self, action: #selector(saveToGallerySwitch), for: .valueChanged)
|
|
|
switchAutoDownload.addTarget(self, action: #selector(autoDownloadSwitch), for: .valueChanged)
|
|
|
-
|
|
|
-// navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(didTapCancel))
|
|
|
+ }
|
|
|
+
|
|
|
+ public override func viewWillDisappear(_ animated: Bool) {
|
|
|
+ separatorBackupRestore.removeFromSuperview()
|
|
|
+ separatorNotifPersonal.removeFromSuperview()
|
|
|
+ separatorAutoDownload.removeFromSuperview()
|
|
|
+ separatorVersion.removeFromSuperview()
|
|
|
+ separatorLogin.removeFromSuperview()
|
|
|
+ separatorCFBTop.removeFromSuperview()
|
|
|
+ separatorCFBBot.removeFromSuperview()
|
|
|
+ separatorCYATop.removeFromSuperview()
|
|
|
+ separatorCYABot.removeFromSuperview()
|
|
|
+ separatorBCABot.removeFromSuperview()
|
|
|
}
|
|
|
|
|
|
public override func viewDidAppear(_ animated: Bool) {
|
|
@@ -96,17 +115,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
|
let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
if let cursorUser = Database.shared.getRecords(fmdb: fmdb, query: "SELECT user_type, image_id, official_account FROM BUDDY where f_pin='\(idMe!)'"), cursorUser.next() {
|
|
|
- var groupId = ""
|
|
|
- if let cursorGroup = Database.shared.getRecords(fmdb: fmdb, query: "SELECT group_id FROM GROUPZ where group_type = 1 AND official = 1"), cursorGroup.next() {
|
|
|
- groupId = cursorGroup.string(forColumnIndex: 0) ?? ""
|
|
|
- cursorGroup.close()
|
|
|
- }
|
|
|
- var position = ""
|
|
|
- if let cursorIsAdmin = Database.shared.getRecords(fmdb: fmdb, query: "SELECT position FROM GROUPZ_MEMBER where group_id = '\(groupId)' AND f_pin = '\(idMe!)'"), cursorIsAdmin.next() {
|
|
|
- position = cursorIsAdmin.string(forColumnIndex: 0) ?? ""
|
|
|
- cursorIsAdmin.close()
|
|
|
- }
|
|
|
- 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) ?? "") {
|
|
|
+ if (User.isInternal(userType: cursorUser.string(forColumnIndex: 0) ?? "") && User.isAdmin(fmdb: fmdb)) || User.isOfficial(official_account: cursorUser.string(forColumnIndex: 2) ?? "") || User.isOfficial(official_account: cursorUser.string(forColumnIndex: 2) ?? "") {
|
|
|
Item.menus["Personal"] = [
|
|
|
Item(icon: UIImage(systemName: "person"), title: "Personal Information".localized()),
|
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
@@ -128,18 +137,11 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
Item(icon: UIImage(systemName: "person.badge.key"), title: "Access Admin / Internal Features".localized()),
|
|
|
]
|
|
|
}
|
|
|
- if Nexilis.showButtonFB {
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "gearshape.circle"), title: "Configure Floating Button".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.clockwise.icloud"), title: "Backup & Restore".localized()))
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "lessthan.circle"), title: "Validation Transaction Limit".localized()))
|
|
|
- if Utils.getEnableMobileBuilder() == "1" {
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "iphone"), title: "Create Your Own App".localized()))
|
|
|
- }
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Sign-Out".localized()))
|
|
|
+ Item.menus["Personal"]?.insert(Item(icon: UIImage(systemName: "lessthan.circle"), title: "Validation Transaction Limit".localized()), at: 1)
|
|
|
}
|
|
|
let image = cursorUser.string(forColumnIndex: 1)
|
|
|
if image != nil {
|
|
@@ -156,7 +158,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
}
|
|
|
} else {
|
|
|
- Download().startHTTP(forKey: image!) { (name, progress) in
|
|
|
+ Download().start(forKey: image!) { (name, progress) in
|
|
|
guard progress == 100 else {
|
|
|
return
|
|
|
}
|
|
@@ -198,7 +200,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
dataImage["name"] = imageSignIn
|
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
} else {
|
|
|
- Download().startHTTP(forKey: imageSignIn) { (name, progress) in
|
|
|
+ Download().start(forKey: imageSignIn) { (name, progress) in
|
|
|
guard progress == 100 else {
|
|
|
return
|
|
|
}
|
|
@@ -217,6 +219,28 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ Item.menus["Config"] = [
|
|
|
+ Item(icon: UIImage(systemName: "iphone"), title: "Create Your Own App".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "gearshape.circle"), title: "Configure Floating Button".localized())
|
|
|
+ ]
|
|
|
+ if !isChangeProfile || Utils.getEnableMobileBuilder() != "1" {
|
|
|
+ if Item.menus["Config"]!.count > 1 {
|
|
|
+ Item.menus["Config"]!.remove(at: 0)
|
|
|
+ } else {
|
|
|
+ Item.menus["Config"]!.removeAll()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !Nexilis.showButtonFB {
|
|
|
+ if Item.menus["Config"]!.count > 1 {
|
|
|
+ Item.menus["Config"]!.remove(at: 1)
|
|
|
+ } else {
|
|
|
+ Item.menus["Config"]!.removeAll()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if Utils.getIsLoadThemeFromOther() {
|
|
|
+ Item.menus["Config"]?.insert(Item(icon: UIImage(systemName: "iphone"), title: "Back to Company App".localized()), at: 1)
|
|
|
+ }
|
|
|
+
|
|
|
Item.menus["Call"] = [
|
|
|
Item(icon: UIImage(systemName: "message"), title: "Notification Message(s)".localized()),
|
|
|
Item(icon: UIImage(systemName: "message"), title: "Notification Message(s) Group".localized()),
|
|
@@ -228,44 +252,37 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
Item(icon: UIImage(systemName: "gear"), title: "Version".localized()),
|
|
|
Item(icon: UIImage(named: "pb_powered_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), title: "Powered by Nexilis".localized()),
|
|
|
]
|
|
|
+ if isChangeProfile {
|
|
|
+ Item.menus["Version"]?.insert(Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Sign-Out".localized()), at: 0)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override public func viewWillAppear(_ animated: Bool) {
|
|
|
// self.navigationController?.navigationBar.topItem?.title = ""
|
|
|
-// self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black]
|
|
|
-// let navBarAppearance = UINavigationBarAppearance()
|
|
|
-// navBarAppearance.configureWithTransparentBackground()
|
|
|
-// navigationController?.navigationBar.standardAppearance = navBarAppearance
|
|
|
-// navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
|
|
|
-// let cancelButtonAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: UIColor.black]
|
|
|
-// UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, for: .normal)
|
|
|
-// navigationController?.navigationBar.backgroundColor = .clear
|
|
|
-// navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
|
|
|
-// navigationController?.navigationBar.shadowImage = UIImage()
|
|
|
-// navigationController?.navigationBar.isTranslucent = true
|
|
|
-// navigationController?.setNavigationBarHidden(false, animated: false)
|
|
|
-// navigationController?.navigationBar.overrideUserInterfaceStyle = .light
|
|
|
-// navigationController?.navigationBar.barStyle = .default
|
|
|
-// navigationController?.navigationBar.tintColor = .black
|
|
|
-// tabBarController?.navigationItem.leftBarButtonItem = nil
|
|
|
-// tabBarController?.navigationItem.searchController = nil
|
|
|
-// tabBarController?.navigationItem.rightBarButtonItem = nil
|
|
|
- let imageButton = UIImageView(frame: CGRect(x: -16, y: 0, width: 20, height: 44))
|
|
|
- imageButton.image = UIImage(systemName: "chevron.backward", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .regular, scale: .default))?.withTintColor(.white)
|
|
|
- imageButton.contentMode = .left
|
|
|
- let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(didTapExit))
|
|
|
- imageButton.isUserInteractionEnabled = true
|
|
|
- imageButton.addGestureRecognizer(tapGestureRecognizer)
|
|
|
- let leftItem = UIBarButtonItem(customView: imageButton)
|
|
|
- self.navigationItem.leftBarButtonItem = leftItem
|
|
|
+ self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: self.traitCollection.userInterfaceStyle == .dark ? .white : UIColor.black]
|
|
|
+ let attributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: self.traitCollection.userInterfaceStyle == .dark ? .white : UIColor.black, NSAttributedString.Key.font : UIFont.boldSystemFont(ofSize: 16)]
|
|
|
+ let navBarAppearance = UINavigationBarAppearance()
|
|
|
+ navBarAppearance.configureWithTransparentBackground()
|
|
|
+ navBarAppearance.titleTextAttributes = attributes
|
|
|
+ navigationController?.navigationBar.standardAppearance = navBarAppearance
|
|
|
+ navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
|
|
|
+ let cancelButtonAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: self.traitCollection.userInterfaceStyle == .dark ? .white : UIColor.black, NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16)]
|
|
|
+ UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, for: .normal)
|
|
|
+ navigationController?.navigationBar.backgroundColor = .clear
|
|
|
+ navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
|
|
|
+ navigationController?.navigationBar.shadowImage = UIImage()
|
|
|
+ navigationController?.navigationBar.isTranslucent = true
|
|
|
+ navigationController?.setNavigationBarHidden(false, animated: false)
|
|
|
+ navigationController?.navigationBar.overrideUserInterfaceStyle = self.traitCollection.userInterfaceStyle == .dark ? .dark : .light
|
|
|
+ navigationController?.navigationBar.barStyle = .default
|
|
|
+ navigationController?.navigationBar.tintColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
+ tabBarController?.navigationItem.leftBarButtonItem = nil
|
|
|
+ tabBarController?.navigationItem.searchController = nil
|
|
|
+ tabBarController?.navigationItem.rightBarButtonItem = nil
|
|
|
makeMenu()
|
|
|
tableView.reloadData()
|
|
|
}
|
|
|
|
|
|
- @objc func didTapExit() {
|
|
|
- self.dismiss(animated: true, completion: nil)
|
|
|
- }
|
|
|
-
|
|
|
// MARK: - Table view data source
|
|
|
|
|
|
public override func numberOfSections(in tableView: UITableView) -> Int {
|
|
@@ -283,11 +300,6 @@ 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()
|
|
@@ -299,7 +311,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
if let arr = Item.menus[section] {
|
|
|
let menu = arr[indexPath.row]
|
|
|
content.image = menu.icon
|
|
|
- content.imageProperties.tintColor = .black
|
|
|
+ content.imageProperties.tintColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
|
|
|
content.imageProperties.maximumSize = CGSize(width: 24, height: 24)
|
|
|
content.text = menu.title
|
|
|
cell.accessoryView = nil
|
|
@@ -316,21 +328,40 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorLogin)
|
|
|
case "Configure Floating Button".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
+ if !isChangeProfile || Utils.getEnableMobileBuilder() != "1" {
|
|
|
+ separatorCFBTop.removeFromSuperview()
|
|
|
+ cell.addTopBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorCFBTop)
|
|
|
+ }
|
|
|
+ separatorCFBBot.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorCFBBot)
|
|
|
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
|
|
|
+ separatorBackupRestore.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorBackupRestore)
|
|
|
+ case "Validation Transaction Limit".localized():
|
|
|
+ cell.accessoryType = .disclosureIndicator
|
|
|
+ case "Create Your Own App".localized():
|
|
|
+ cell.accessoryType = .disclosureIndicator
|
|
|
+ separatorCYATop.removeFromSuperview()
|
|
|
+ cell.addTopBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorCYATop)
|
|
|
+ if !Nexilis.showButtonFB {
|
|
|
+ separatorCYABot.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorCYABot)
|
|
|
+ }
|
|
|
+ case "Back to Company App".localized():
|
|
|
+ if !Nexilis.showButtonFB {
|
|
|
+ separatorBCABot.removeFromSuperview()
|
|
|
+ cell.addBottomBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorBCABot)
|
|
|
+ }
|
|
|
case "Notification Message(s) Group".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
// case "Logout".localized():
|
|
|
case "Change Admin / Internal Password".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Validation Transaction Limit".localized():
|
|
|
- cell.accessoryType = .disclosureIndicator
|
|
|
- case "Create Your Own App".localized():
|
|
|
- cell.accessoryType = .disclosureIndicator
|
|
|
case "Change Language".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
case "Set Internal Account".localized():
|
|
@@ -340,13 +371,16 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
case "Version".localized():
|
|
|
let accessoryButton = UIButton(type: .custom)
|
|
|
accessoryButton.setTitle(UIApplication.appVersion, for: .normal)
|
|
|
- accessoryButton.setTitleColor(.black, for: .normal)
|
|
|
- accessoryButton.contentHorizontalAlignment = .right;
|
|
|
+ accessoryButton.setTitleColor(self.traitCollection.userInterfaceStyle == .dark ? .white : .black, for: .normal)
|
|
|
+ accessoryButton.titleLabel?.font = .systemFont(ofSize: 18)
|
|
|
+ accessoryButton.contentHorizontalAlignment = .right
|
|
|
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)
|
|
|
+ if !isChangeProfile {
|
|
|
+ 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():
|
|
@@ -356,8 +390,8 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
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)
|
|
|
+ separatorVersion.removeFromSuperview()
|
|
|
+ cell.addTopBorder(with: .lightGray.withAlphaComponent(0.5), andWidth: 1, view: separatorVersion)
|
|
|
default:
|
|
|
content.secondaryText = nil
|
|
|
}
|
|
@@ -513,12 +547,14 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
})
|
|
|
}
|
|
|
} else {
|
|
|
- Nexilis.hideLoader(completion: {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers. Try again later".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- })
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers. Try again later".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
DispatchQueue.main.async {
|
|
@@ -614,10 +650,72 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
|
|
|
} else if item.title == "Validation Transaction Limit".localized() {
|
|
|
let controller = ValidationTransactionLimit()
|
|
|
navigationController?.show(controller, sender: nil)
|
|
|
- } else if item.title == "Create Your Own App".localized() {
|
|
|
+ } else if item.title == "Create Your Own App".localized() {
|
|
|
let controller = BNIBookingWebView()
|
|
|
controller.customUrl = Utils.getURLBase() + "mobile_MAB?f_pin="
|
|
|
self.present(controller, animated: true)
|
|
|
+ } else if item.title == "Back to Company App".localized() {
|
|
|
+ let alert = LibAlertController(title: "", message: "Are you sure want to back to company app?".localized(), preferredStyle: .alert)
|
|
|
+ alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
|
+ alert.addAction(UIAlertAction(title: "Yes".localized(), style: .destructive, handler: {(_) in
|
|
|
+ if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Check your connection".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ Nexilis.showLoader()
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.backToSuperApp(), timeout: 30 * 1000) {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ if response.isOk() {
|
|
|
+ Utils.setMyTheme(value: "")
|
|
|
+ Utils.setIsLoadThemeFromOther(value: false)
|
|
|
+ Utils.resetValueSuperApp()
|
|
|
+ Utils.setValueInitialApp(data: Utils.getPrefTheme())
|
|
|
+ Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "GROUPZ", _where: "")
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "GROUPZ_MEMBER", _where: "")
|
|
|
+ _ = Database.shared.deleteRecord(fmdb: fmdb, table: "DISCUSSION_FORUM", _where: "")
|
|
|
+ _ = Nexilis.write(message: CoreMessage_TMessageBank.getPostRegistration(p_pin: User.getMyPin() ?? ""))
|
|
|
+ })
|
|
|
+ Nexilis.hideLoader {
|
|
|
+ let alert = LibAlertController(title: "Successfully changed".localized(), message: "Please open the app again to see the changes".localized(), preferredStyle: .alert)
|
|
|
+ alert.addAction(UIAlertAction(title: "OK".localized(), style: .default, handler: {(_) in
|
|
|
+ exit(0)
|
|
|
+ }))
|
|
|
+ self.present(alert, animated: true, completion: nil)
|
|
|
+ }
|
|
|
+ } else if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "10" {
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Failed to back to Company App".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers. Try again later".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers. Try again later".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ self.present(alert, animated: true, completion: nil)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -959,7 +1057,7 @@ struct Item: Hashable {
|
|
|
var title = ""
|
|
|
|
|
|
static var sections: [String] {
|
|
|
- return ["Personal", "Call", "Version"]
|
|
|
+ return ["Personal", "Config", "Call", "Version"]
|
|
|
}
|
|
|
|
|
|
static var menus: [String: [Item]] = [:]
|