|
@@ -10,7 +10,7 @@ import NotificationBannerSwift
|
|
|
import nuSDKService
|
|
|
import Photos
|
|
|
|
|
|
-public class SettingTableViewController: UITableViewController {
|
|
|
+public class SettingTableViewController: UITableViewController, UIGestureRecognizerDelegate {
|
|
|
|
|
|
var language: [[String: String]] = [["Indonesia": "id"],["English": "en"]]
|
|
|
var alert: UIAlertController?
|
|
@@ -20,12 +20,16 @@ public class SettingTableViewController: UITableViewController {
|
|
|
var switchSaveToGallery = UISwitch()
|
|
|
var switchAutoDownload = UISwitch()
|
|
|
|
|
|
+ var notInTab = false
|
|
|
+
|
|
|
public override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
|
- title = "Settings".localized()
|
|
|
-
|
|
|
- makeMenu()
|
|
|
+ tableView.delegate = self
|
|
|
+ tableView.dataSource = self
|
|
|
+ tableView.layoutMargins = .init(top: 0, left: 5, bottom: 0, right: 5)
|
|
|
+// tableView.separatorColor = .gray
|
|
|
+ tableView.separatorStyle = .none
|
|
|
|
|
|
switchVibrateMode.tintColor = .gray
|
|
|
switchSaveToGallery.tintColor = .gray
|
|
@@ -49,11 +53,12 @@ public class SettingTableViewController: UITableViewController {
|
|
|
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))
|
|
|
+// navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(didTapCancel))
|
|
|
}
|
|
|
|
|
|
- @objc func didTapCancel(sender: AnyObject) {
|
|
|
- navigationController?.dismiss(animated: true, completion: nil)
|
|
|
+ public override func viewDidAppear(_ animated: Bool) {
|
|
|
+ self.navigationController?.navigationBar.topItem?.title = "Settings".localized()
|
|
|
+ self.navigationController?.navigationBar.setNeedsLayout()
|
|
|
}
|
|
|
|
|
|
@objc func vibrateModeSwitch() {
|
|
@@ -80,114 +85,123 @@ public class SettingTableViewController: UITableViewController {
|
|
|
UserDefaults.standard.set(switchAutoDownload.isOn, forKey: "autoDownload")
|
|
|
}
|
|
|
|
|
|
- func makeMenu(imageSignIn: String = "") {
|
|
|
+ func makeMenu(imageSignIn: String = ""){
|
|
|
let isChangeProfile = Utils.getSetProfile()
|
|
|
Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
|
- if !isChangeProfile {
|
|
|
- Item.menus["Personal"] = [
|
|
|
- Item(icon: UIImage(systemName: "person.crop.circle.badge.plus"), title: "Sign-Up (Change profile)".localized()),
|
|
|
- Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Sign-In (Change Device)".localized())
|
|
|
- ]
|
|
|
- } else {
|
|
|
- Item.menus["Personal"] = [
|
|
|
- Item(icon: UIImage(systemName: "person.fill"), title: "User Profile Management".localized()),
|
|
|
-// Item(icon: UIImage(systemName: "mail"), title: "Email".localized()),
|
|
|
- Item(icon: UIImage(systemName: "qrcode.viewfinder"), title: "Sign-In to Nexilis Web".localized()),
|
|
|
- Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Sign-Out".localized())
|
|
|
- ]
|
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
- if let cursorUser = Database.shared.getRecords(fmdb: fmdb, query: "SELECT user_type, image_id 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 cursorUser.string(forColumnIndex: 0) == "23" && position == "1" {
|
|
|
- Item.menus["Personal"]?.insert(Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized()), at: 1)
|
|
|
- } else if cursorUser.string(forColumnIndex: 0) != "23" && cursorUser.string(forColumnIndex: 0) != "24" {
|
|
|
- Item.menus["Personal"]?.insert(Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Sign-In Admin / Internal".localized()), at: 1)
|
|
|
- }
|
|
|
-// Item.menus["Personal"]?.insert(Item(icon: UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), title: "Change Image FB Become Photo Profile".localized()), at: 2)
|
|
|
- let image = cursorUser.string(forColumnIndex: 1)
|
|
|
- if image != nil {
|
|
|
- if !image!.isEmpty {
|
|
|
- do {
|
|
|
- let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
- let file = documentDir.appendingPathComponent(image!)
|
|
|
- if FileManager().fileExists(atPath: file.path) {
|
|
|
- let image = UIImage(contentsOfFile: file.path)
|
|
|
- Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
- if !imageSignIn.isEmpty {
|
|
|
- var dataImage: [AnyHashable : Any] = [:]
|
|
|
- dataImage["name"] = imageSignIn
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
- }
|
|
|
- } else {
|
|
|
- Download().start(forKey: image!) { (name, progress) in
|
|
|
- guard progress == 100 else {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- DispatchQueue.main.async {
|
|
|
- let image = UIImage(contentsOfFile: file.path)
|
|
|
- Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
- self.tableView.reloadData()
|
|
|
- if !imageSignIn.isEmpty {
|
|
|
- var dataImage: [AnyHashable : Any] = [:]
|
|
|
- dataImage["name"] = imageSignIn
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch {}
|
|
|
- }
|
|
|
- }
|
|
|
- cursorUser.close()
|
|
|
+ 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) ?? "") {
|
|
|
+ Item.menus["Personal"] = [
|
|
|
+ Item(icon: UIImage(systemName: "person.fill"), 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: "textformat.abc"), title: "Change Language".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Sign-In to Web".localized()),
|
|
|
+ ]
|
|
|
} else {
|
|
|
- if !imageSignIn.isEmpty {
|
|
|
+ Item.menus["Personal"] = [
|
|
|
+ Item(icon: UIImage(systemName: "person.fill"), 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()),
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ 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: "rectangle.portrait.and.arrow.right"), title: "Sign-Out".localized()))
|
|
|
+ }
|
|
|
+ let image = cursorUser.string(forColumnIndex: 1)
|
|
|
+ if image != nil {
|
|
|
+ if !image!.isEmpty {
|
|
|
do {
|
|
|
let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
- let file = documentDir.appendingPathComponent(imageSignIn)
|
|
|
+ let file = documentDir.appendingPathComponent(image!)
|
|
|
if FileManager().fileExists(atPath: file.path) {
|
|
|
let image = UIImage(contentsOfFile: file.path)
|
|
|
Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
- var dataImage: [AnyHashable : Any] = [:]
|
|
|
- dataImage["name"] = imageSignIn
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ if !imageSignIn.isEmpty {
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
+ dataImage["name"] = imageSignIn
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ }
|
|
|
} else {
|
|
|
- Download().start(forKey: imageSignIn) { (name, progress) in
|
|
|
+ Download().start(forKey: image!) { (name, progress) in
|
|
|
guard progress == 100 else {
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
DispatchQueue.main.async {
|
|
|
let image = UIImage(contentsOfFile: file.path)
|
|
|
Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
self.tableView.reloadData()
|
|
|
- var dataImage: [AnyHashable : Any] = [:]
|
|
|
- dataImage["name"] = imageSignIn
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ if !imageSignIn.isEmpty {
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
+ dataImage["name"] = imageSignIn
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} catch {}
|
|
|
}
|
|
|
}
|
|
|
+ cursorUser.close()
|
|
|
+ } else {
|
|
|
+ Item.menus["Personal"] = [
|
|
|
+ Item(icon: UIImage(systemName: "person.fill"), 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(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Sign-Up/Sign-In".localized())
|
|
|
+ ]
|
|
|
+ if !imageSignIn.isEmpty {
|
|
|
+ do {
|
|
|
+ let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
+ let file = documentDir.appendingPathComponent(imageSignIn)
|
|
|
+ if FileManager().fileExists(atPath: file.path) {
|
|
|
+ let image = UIImage(contentsOfFile: file.path)
|
|
|
+ Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
+ dataImage["name"] = imageSignIn
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ } else {
|
|
|
+ Download().start(forKey: imageSignIn) { (name, progress) in
|
|
|
+ guard progress == 100 else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ let image = UIImage(contentsOfFile: file.path)
|
|
|
+ Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
+ self.tableView.reloadData()
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
+ dataImage["name"] = imageSignIn
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch {}
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-// Item.menus["Language"] = [
|
|
|
-// Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
-// ]
|
|
|
-
|
|
|
Item.menus["Call"] = [
|
|
|
- Item(icon: UIImage(systemName: "message"), title: "Incoming Message(s)".localized()),
|
|
|
- Item(icon: UIImage(systemName: "phone"), title: "Incoming Call(s)".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "message"), title: "Notification Message(s)".localized()),
|
|
|
+ Item(icon: UIImage(systemName: "message"), title: "Notification Message(s) Group".localized()),
|
|
|
Item(icon: UIImage(systemName: "iphone.homebutton.radiowaves.left.and.right"), title: "Vibrate Mode".localized()),
|
|
|
Item(icon: UIImage(systemName: "photo.on.rectangle.angled"), title: "Save to Gallery".localized()),
|
|
|
Item(icon: UIImage(systemName: "arrow.down.square"), title: "Auto Download".localized()),
|
|
@@ -198,12 +212,40 @@ public class SettingTableViewController: UITableViewController {
|
|
|
]
|
|
|
}
|
|
|
|
|
|
+ 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
|
|
|
+ makeMenu()
|
|
|
+ tableView.reloadData()
|
|
|
+ }
|
|
|
+
|
|
|
// MARK: - Table view data source
|
|
|
|
|
|
public override func numberOfSections(in tableView: UITableView) -> Int {
|
|
|
return Item.sections.count
|
|
|
}
|
|
|
|
|
|
+ public override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
|
+ return 1
|
|
|
+ }
|
|
|
+
|
|
|
public override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
|
return Item.menuFor(section: section).count
|
|
|
}
|
|
@@ -211,7 +253,7 @@ public class SettingTableViewController: UITableViewController {
|
|
|
public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
|
|
|
cell.accessoryType = .none
|
|
|
- cell.selectionStyle = .gray
|
|
|
+ cell.indentationLevel = 0
|
|
|
var content = cell.defaultContentConfiguration()
|
|
|
content.textProperties.font = UIFont.systemFont(ofSize: 14)
|
|
|
content.secondaryTextProperties.font = UIFont.systemFont(ofSize: 14)
|
|
@@ -221,33 +263,39 @@ public class SettingTableViewController: UITableViewController {
|
|
|
if let arr = Item.menus[section] {
|
|
|
let menu = arr[indexPath.row]
|
|
|
content.image = menu.icon
|
|
|
- content.imageProperties.tintColor = .mainColor
|
|
|
+ content.imageProperties.tintColor = .black
|
|
|
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 "User Profile Management".localized():
|
|
|
- cell.accessoryType = .disclosureIndicator
|
|
|
- case "Sign-In Admin / Internal".localized():
|
|
|
+ case "Personal Information".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Change Admin / Internal Password".localized():
|
|
|
+ case "Access Admin / Internal Features".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Change Image FB Become Photo Profile".localized():
|
|
|
+ case "Sign-In to Web".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Set Internal / Officer Account".localized():
|
|
|
+ case "Sign-Up/Sign-In".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Pulsa".localized():
|
|
|
+ case "Backup & Restore".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Sign-Up (Change profile)".localized():
|
|
|
+ case "Notification Message(s)".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Sign-In (Change Device)".localized():
|
|
|
+ case "Notification Message(s) Group".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
- case "Sign-In to Nexilis Web".localized():
|
|
|
+// case "Logout".localized():
|
|
|
+ case "Change Admin / Internal Password".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
case "Change Language".localized():
|
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
case "Version".localized():
|
|
|
- content.secondaryText = UIApplication.appVersion
|
|
|
+ let accessoryButton = UIButton(type: .custom)
|
|
|
+ accessoryButton.setTitle(UIApplication.appVersion, for: .normal)
|
|
|
+ accessoryButton.setTitleColor(.black, for: .normal)
|
|
|
+ accessoryButton.contentHorizontalAlignment = .right;
|
|
|
+ accessoryButton.frame = CGRect(x: 0, y: 0, width: 100, height: 40)
|
|
|
+ accessoryButton.contentMode = .scaleAspectFit
|
|
|
+ cell.accessoryView = accessoryButton as UIView
|
|
|
case "Vibrate Mode".localized():
|
|
|
cell.accessoryView = switchVibrateMode
|
|
|
case "Save to Gallery".localized():
|
|
@@ -262,12 +310,45 @@ public class SettingTableViewController: UITableViewController {
|
|
|
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) {
|
|
|
- tableView.deselectRow(at: indexPath, animated: false)
|
|
|
let item = Item.menuFor(section: indexPath.section)[indexPath.row]
|
|
|
- if item.title == "User Profile Management".localized() {
|
|
|
- let isChangeProfile = Utils.getSetProfile()
|
|
|
- if isChangeProfile {
|
|
|
+ if item.title == "Personal Information".localized() {
|
|
|
+ if(checkIsChangePerson()){
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "profileView") as! ProfileViewController
|
|
|
controller.data = UserDefaults.standard.string(forKey: "me")!
|
|
|
controller.flag = .me
|
|
@@ -280,14 +361,35 @@ public class SettingTableViewController: UITableViewController {
|
|
|
}
|
|
|
navigationController?.show(controller, sender: nil)
|
|
|
}
|
|
|
- } else if item.title == "Sign-Up (Change profile)".localized() {
|
|
|
- let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
|
|
|
- controller.fromSetting = true
|
|
|
- controller.isSuccess = {
|
|
|
- self.makeMenu()
|
|
|
- self.tableView.reloadData()
|
|
|
+ } else if item.title == "Access Admin / Internal Features".localized() || item.title == "Change Admin / Internal Password".localized() {
|
|
|
+ if(checkIsChangePerson()){
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
|
+ if(item.title.contains("Change")){
|
|
|
+ if let action = self.actionChangePassword(for: "admin", title: "Change Admin Password".localized()) {
|
|
|
+ alertController.addAction(action)
|
|
|
+ }
|
|
|
+ if let action = self.actionChangePassword(for: "internal", title: "Change Internal Password".localized()) {
|
|
|
+ alertController.addAction(action)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if let action = self.actionLogin(for: "admin", title: "Access Admin Features".localized()) {
|
|
|
+ alertController.addAction(action)
|
|
|
+ }
|
|
|
+ if let action = self.actionLogin(for: "internal", title: "Access Internal Features".localized()) {
|
|
|
+ alertController.addAction(action)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
+ self.present(alertController, animated: true)
|
|
|
}
|
|
|
- navigationController?.show(controller, sender: nil)
|
|
|
} else if item.title == "Change Language".localized() {
|
|
|
let vc = UIViewController()
|
|
|
vc.preferredContentSize = CGSize(width: UIScreen.main.bounds.width - 10, height: 150)
|
|
@@ -313,20 +415,30 @@ public class SettingTableViewController: UITableViewController {
|
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: { (UIAlertAction) in
|
|
|
}))
|
|
|
|
|
|
- alert.addAction(UIAlertAction(title: "Select", style: .default, handler: { (UIAlertAction) in
|
|
|
+ alert.addAction(UIAlertAction(title: "Select".localized(), style: .default, handler: { (UIAlertAction) in
|
|
|
let selectedIndex = pickerView.selectedRow(inComponent: 0)
|
|
|
let lang = self.language[selectedIndex].values.first
|
|
|
UserDefaults.standard.set(lang, forKey: "i18n_language")
|
|
|
- self.viewDidLoad()
|
|
|
+ self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
|
|
|
+ self.navigationController?.navigationBar.setNeedsLayout()
|
|
|
+ self.makeMenu()
|
|
|
+ self.tableView.reloadData()
|
|
|
}))
|
|
|
self.present(alert, animated: true, completion: nil)
|
|
|
- } else if item.title == "Sign-In (Change Device)".localized() {
|
|
|
+ } else if item.title == "Sign-In".localized() {
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeDevice") as! ChangeDeviceViewController
|
|
|
controller.isDismiss = { newThumb in
|
|
|
self.makeMenu(imageSignIn: newThumb)
|
|
|
self.tableView.reloadData()
|
|
|
}
|
|
|
navigationController?.show(controller, sender: nil)
|
|
|
+ } else if item.title == "Sign-Up/Sign-In".localized() {
|
|
|
+ let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "signupsignin") as! SignUpSignIn
|
|
|
+ controller.isDismiss = { newThumb in
|
|
|
+ self.makeMenu(imageSignIn: newThumb)
|
|
|
+ self.tableView.reloadData()
|
|
|
+ }
|
|
|
+ navigationController?.show(controller, sender: nil)
|
|
|
} else if item.title == "Sign-Out".localized() {
|
|
|
let alert = UIAlertController(title: "Sign-Out".localized(), message: "Are you sure want to logout?".localized(), preferredStyle: .alert)
|
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
@@ -338,9 +450,8 @@ public class SettingTableViewController: UITableViewController {
|
|
|
banner.show()
|
|
|
return
|
|
|
}
|
|
|
+ Nexilis.showLoader()
|
|
|
DispatchQueue.global().async {
|
|
|
- self.deleteAllRecordDatabase()
|
|
|
- Nexilis.destroyAll()
|
|
|
let apiKey = Nexilis.sAPIKey
|
|
|
var id = UIDevice.current.identifierForVendor?.uuidString ?? "UNK-DEVICE"
|
|
|
if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getSignUpApi(api: apiKey, p_pin: id), timeout: 30 * 1000) {
|
|
@@ -350,59 +461,47 @@ public class SettingTableViewController: UITableViewController {
|
|
|
UserDefaults.standard.setValue(id, forKey: "me")
|
|
|
Utils.setProfile(value: false)
|
|
|
UserDefaults.standard.synchronize()
|
|
|
- // pos registration
|
|
|
- _ = Nexilis.write(message: CoreMessage_TMessageBank.getPostRegistration(p_pin: id))
|
|
|
+ if Utils.getForceAnonymous() {
|
|
|
+ self.deleteAllRecordDatabase()
|
|
|
+ UserDefaults.standard.removeObject(forKey: "device_id")
|
|
|
+ Nexilis.destroyAll()
|
|
|
+ _ = Nexilis.write(message: CoreMessage_TMessageBank.getPostRegistration(p_pin: id))
|
|
|
+ }
|
|
|
DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully Sign-Out".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
+ dataImage["name"] = ""
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
+ self.makeMenu()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Nexilis.hideLoader(completion: {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully Sign-Out".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ 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()
|
|
|
- var dataImage: [AnyHashable : Any] = [:]
|
|
|
- dataImage["name"] = ""
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
- self.makeMenu()
|
|
|
- self.tableView.reloadData()
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
} else {
|
|
|
DispatchQueue.main.async {
|
|
|
- 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()
|
|
|
+ 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)
|
|
|
- } else if item.title == "Sign-In Admin / Internal".localized() || item.title == "Change Admin / Internal Password".localized() {
|
|
|
- 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
|
|
|
- }
|
|
|
- let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
|
- if(item.title.contains("Change")){
|
|
|
- if let action = self.actionChangePassword(for: "admin", title: "Change Admin Password".localized()) {
|
|
|
- alertController.addAction(action)
|
|
|
- }
|
|
|
- if let action = self.actionChangePassword(for: "internal", title: "Change Internal Password".localized()) {
|
|
|
- alertController.addAction(action)
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if let action = self.actionLogin(for: "admin", title: "Sign-In as Admin".localized()) {
|
|
|
- alertController.addAction(action)
|
|
|
- }
|
|
|
- if let action = self.actionLogin(for: "internal", title: "Sign-In as Internal Team".localized()) {
|
|
|
- alertController.addAction(action)
|
|
|
- }
|
|
|
- }
|
|
|
- alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
- self.present(alertController, animated: true)
|
|
|
- } else if item.title == "Sign-In to Nexilis Web".localized() {
|
|
|
+ } else if item.title == "Sign-In to Web".localized() {
|
|
|
var permissionCheck = -1
|
|
|
if AVCaptureDevice.authorizationStatus(for: .video) == .authorized {
|
|
|
permissionCheck = 1
|
|
@@ -441,229 +540,44 @@ public class SettingTableViewController: UITableViewController {
|
|
|
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
|
|
|
+ navigationController.navigationBar.overrideUserInterfaceStyle = .dark
|
|
|
+ navigationController.navigationBar.barStyle = .black
|
|
|
navigationController.modalPresentationStyle = .custom
|
|
|
self.present(navigationController, animated: true)
|
|
|
- } else if item.title == "Pulsa".localized() {
|
|
|
- self.alert = UIAlertController(title: "Data warning in (IDR)".localized(), message: nil, preferredStyle: .alert)
|
|
|
- self.textFields.removeAll()
|
|
|
- self.alert?.addTextField{ (texfield) in
|
|
|
- texfield.placeholder = "Saldo"
|
|
|
- texfield.keyboardType = .numberPad
|
|
|
- texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
|
+ } else if item.title == "Notification Message(s)".localized() || item.title == "Notification Message(s) Group".localized() {
|
|
|
+ let controller = NotificationSound()
|
|
|
+ if item.title != "Notification Message(s)".localized() {
|
|
|
+ controller.isPersonal = false
|
|
|
}
|
|
|
- let submitAction = UIAlertAction(title: "Submit".localized(), style: .default, handler: { (action) -> Void in
|
|
|
- let textField = self.alert?.textFields![0]
|
|
|
- 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
|
|
|
- }
|
|
|
- DispatchQueue.global().async {
|
|
|
- let _ = Nexilis.writeSync(message: CoreMessage_TMessageBank.isiPulsaBNI(value: textField!.text!), timeout: 30 * 1000)
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- submitAction.isEnabled = false
|
|
|
- self.alert?.addAction(submitAction)
|
|
|
- self.alert?.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
-
|
|
|
- self.present(self.alert!, animated: true, completion: nil)
|
|
|
- } else if item.title == "Set Internal / Officer Account".localized() {
|
|
|
- let controller = QmeraCallContactViewController()
|
|
|
- controller.isDismiss = { user in
|
|
|
- if user.userType != "23" && user.userType != "24" {
|
|
|
- let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
|
- alertController.addAction(UIAlertAction(title: "Set \(user.fullName) as Internal".localized(), style: .default, handler: { _ in
|
|
|
- self.setAsInternalAccount(user: user)
|
|
|
- }))
|
|
|
- alertController.addAction(UIAlertAction(title: "Set \(user.fullName) as Call Center".localized(), style: .default, handler: { _ in
|
|
|
- let viewSetOfficer = SetOfficerBNI()
|
|
|
- viewSetOfficer.f_pin = user.pin
|
|
|
- viewSetOfficer.name = user.fullName
|
|
|
- viewSetOfficer.modalTransitionStyle = .crossDissolve
|
|
|
- viewSetOfficer.modalPresentationStyle = .custom
|
|
|
- self.present(viewSetOfficer, animated: true)
|
|
|
- }))
|
|
|
- alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
- self.present(alertController, animated: true)
|
|
|
- } else if user.userType == "24" {
|
|
|
- self.removeFromCCAccount(user: user)
|
|
|
- } else {
|
|
|
- let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
|
|
- alertController.addAction(UIAlertAction(title: "Remove \(user.fullName) from Internal".localized(), style: .default, handler: { _ in
|
|
|
- self.removeFromInternalAccount(user: user)
|
|
|
- }))
|
|
|
- alertController.addAction(UIAlertAction(title: "Set \(user.fullName) as Call Center".localized(), style: .default, handler: { _ in
|
|
|
- let viewSetOfficer = SetOfficerBNI()
|
|
|
- viewSetOfficer.f_pin = user.pin
|
|
|
- viewSetOfficer.name = user.fullName
|
|
|
- viewSetOfficer.modalTransitionStyle = .crossDissolve
|
|
|
- viewSetOfficer.modalPresentationStyle = .custom
|
|
|
- self.present(viewSetOfficer, animated: true)
|
|
|
- }))
|
|
|
- alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
- self.present(alertController, animated: true)
|
|
|
- }
|
|
|
- }
|
|
|
- present(UINavigationController(rootViewController: controller), animated: true, completion: nil)
|
|
|
- } else if item.title == "Change Image FB Become Photo Profile".localized() {
|
|
|
-
|
|
|
+ let navigationController = UINavigationController(rootViewController: controller)
|
|
|
+ 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
|
|
|
+ self.present(navigationController, animated: true)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private func setAsInternalAccount(user: User) {
|
|
|
- self.alert = UIAlertController(title: "Set Internal Account".localized(), message: "Are you sure want to add \(user.fullName) to Internal Account?", preferredStyle: .alert)
|
|
|
- self.alert?.addAction(UIAlertAction(title: "Yes".localized(), style: .default, handler: { (action) -> Void 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
|
|
|
- }
|
|
|
- if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getManagementContactCenter(user_type: "3", l_pin: user.pin)) {
|
|
|
- if response.isOk() {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully changed".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- }
|
|
|
- DispatchQueue.main.async {
|
|
|
- if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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 if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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 {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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.alert?.addAction(UIAlertAction(title: "No".localized(), style: .cancel, handler: nil))
|
|
|
- self.present(self.alert!, animated: true, completion: nil)
|
|
|
- }
|
|
|
-
|
|
|
- private func removeFromCCAccount(user: User) {
|
|
|
- self.alert = UIAlertController(title: "Remove Officer Account".localized(), message: "Are you sure want to remove \(user.fullName) from Officer Account?", preferredStyle: .alert)
|
|
|
- self.alert?.addAction(UIAlertAction(title: "Yes".localized(), style: .default, handler: { (action) -> Void 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
|
|
|
- }
|
|
|
- if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getManagementContactCenter(user_type: "0", l_pin: user.pin)) {
|
|
|
- if response.isOk() {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully changed".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- }
|
|
|
- DispatchQueue.main.async {
|
|
|
- if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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 if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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 {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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.alert?.addAction(UIAlertAction(title: "No".localized(), style: .cancel, handler: nil))
|
|
|
- self.present(self.alert!, animated: true, completion: nil)
|
|
|
- }
|
|
|
-
|
|
|
- private func removeFromInternalAccount(user: User) {
|
|
|
- self.alert = UIAlertController(title: "Remove Officer Account".localized(), message: "Are you sure want to remove \(user.fullName) from Internal Account?", preferredStyle: .alert)
|
|
|
- self.alert?.addAction(UIAlertAction(title: "Yes".localized(), style: .default, handler: { (action) -> Void 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
|
|
|
- }
|
|
|
- if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getManagementContactCenter(user_type: "2", l_pin: user.pin)) {
|
|
|
- if response.isOk() {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully changed".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- }
|
|
|
- }
|
|
|
- DispatchQueue.main.async {
|
|
|
- if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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 if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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 {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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.alert?.addAction(UIAlertAction(title: "No".localized(), style: .cancel, handler: nil))
|
|
|
- self.present(self.alert!, animated: true, completion: nil)
|
|
|
- }
|
|
|
-
|
|
|
private func actionLogin(for type: String, title: String) -> UIAlertAction? {
|
|
|
return UIAlertAction(title: title, style: .default) { _ in
|
|
|
- self.alert = UIAlertController(title: "Sign-In as Admin".localized(), message: nil, preferredStyle: .alert)
|
|
|
+ self.alert = UIAlertController(title:"Access Admin Features".localized(), message: nil, preferredStyle: .alert)
|
|
|
if type == "internal" {
|
|
|
- self.alert = UIAlertController(title: "Sign-In as Internal Team".localized(), message: nil, preferredStyle: .alert)
|
|
|
+ self.alert = UIAlertController(title: "Access Internal Features".localized(), message: nil, preferredStyle: .alert)
|
|
|
}
|
|
|
self.textFields.removeAll()
|
|
|
self.alert?.addTextField{ (texfield) in
|
|
|
- texfield.placeholder = "Password"
|
|
|
+ texfield.placeholder = "Password".localized()
|
|
|
texfield.isSecureTextEntry = true
|
|
|
texfield.addPadding(.right(40))
|
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
@@ -685,17 +599,23 @@ public class SettingTableViewController: UITableViewController {
|
|
|
banner.show()
|
|
|
return
|
|
|
}
|
|
|
+ Nexilis.showLoader()
|
|
|
if type == "admin" {
|
|
|
self.signInAdmin(password: textField!.text!, completion: { result in
|
|
|
if result {
|
|
|
DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully Sign-In Admin".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- let itemCP = Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized())
|
|
|
- Item.menus["Personal"]?[1] = itemCP
|
|
|
- self.tableView.reloadData()
|
|
|
+ Nexilis.hideLoader {
|
|
|
+ self.makeMenu()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully Sign-In Admin".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ Nexilis.hideLoader {}
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -703,12 +623,18 @@ public class SettingTableViewController: UITableViewController {
|
|
|
self.signInInternal(password: textField!.text!, completion: { result in
|
|
|
if result {
|
|
|
DispatchQueue.main.async {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Successfully Sign-In Internal Team".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- Item.menus["Personal"]?.remove(at: 1)
|
|
|
- self.tableView.reloadData()
|
|
|
+ Nexilis.hideLoader {
|
|
|
+ self.makeMenu()
|
|
|
+ self.tableView.reloadData()
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully Sign-In Internal Team".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ Nexilis.hideLoader {}
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -815,6 +741,8 @@ public class SettingTableViewController: UITableViewController {
|
|
|
|
|
|
@objc func alertTextFieldDidChange(_ sender: UITextField) {
|
|
|
if(!textFields.isEmpty){
|
|
|
+ print("text count 0: \(textFields[0].text!.count)")
|
|
|
+ print("text count 1: \(textFields[1].text!.count)")
|
|
|
alert?.actions[0].isEnabled = textFields[0].text!.count > 0 && textFields[1].text!.count > 0
|
|
|
}
|
|
|
else {
|
|
@@ -836,12 +764,12 @@ public class SettingTableViewController: UITableViewController {
|
|
|
if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Username or password does not match".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: .top)
|
|
|
banner.show()
|
|
|
} else if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Invalid password".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -849,7 +777,7 @@ public class SettingTableViewController: UITableViewController {
|
|
|
DispatchQueue.main.async {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -871,12 +799,12 @@ public class SettingTableViewController: UITableViewController {
|
|
|
if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Username or password does not match".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: .top)
|
|
|
banner.show()
|
|
|
} else if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Invalid password".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -884,7 +812,7 @@ public class SettingTableViewController: UITableViewController {
|
|
|
DispatchQueue.main.async {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -908,12 +836,12 @@ public class SettingTableViewController: UITableViewController {
|
|
|
if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Username or password does not match".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: .top)
|
|
|
banner.show()
|
|
|
} else if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Invalid password".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -921,7 +849,7 @@ public class SettingTableViewController: UITableViewController {
|
|
|
DispatchQueue.main.async {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -945,12 +873,12 @@ public class SettingTableViewController: UITableViewController {
|
|
|
if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "11" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Username or password does not match".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Username or password does not match".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: .top)
|
|
|
banner.show()
|
|
|
} else if response.getBody(key: CoreMessage_TMessageKey.ERRCOD, default_value: "99") == "20" {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Invalid password".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Invalid password".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|
|
@@ -958,7 +886,7 @@ public class SettingTableViewController: UITableViewController {
|
|
|
DispatchQueue.main.async {
|
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Unable to access servers".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)
|
|
|
+ let banner = FloatingNotificationBanner(title: "Unable to access servers".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: .top)
|
|
|
banner.show()
|
|
|
}
|
|
|
}
|