|
@@ -9,29 +9,55 @@ import UIKit
|
|
import NotificationBannerSwift
|
|
import NotificationBannerSwift
|
|
import nuSDKService
|
|
import nuSDKService
|
|
import NexilisLite
|
|
import NexilisLite
|
|
|
|
+import Photos
|
|
|
|
|
|
public class FourthTabViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate {
|
|
public class FourthTabViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate {
|
|
|
|
|
|
- var language: [[String: String]] = [["English": "en"],["Indonesia": "id"]]
|
|
|
|
|
|
+ var language: [[String: String]] = [["Indonesia": "id"],["English": "en"]]
|
|
var alert: UIAlertController?
|
|
var alert: UIAlertController?
|
|
var textFields = [UITextField]()
|
|
var textFields = [UITextField]()
|
|
|
|
|
|
|
|
+ var switchVibrateMode = UISwitch()
|
|
|
|
+ var switchSaveToGallery = UISwitch()
|
|
|
|
+ var switchAutoDownload = UISwitch()
|
|
|
|
+
|
|
@IBOutlet weak var tableView: UITableView!
|
|
@IBOutlet weak var tableView: UITableView!
|
|
@IBOutlet weak var backgroundImage: UIImageView!
|
|
@IBOutlet weak var backgroundImage: UIImageView!
|
|
|
|
|
|
public override func viewDidLoad() {
|
|
public override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
super.viewDidLoad()
|
|
|
|
|
|
- var isNCNil = navigationController == nil
|
|
|
|
- print("isNCNil: \(isNCNil)")
|
|
|
|
-
|
|
|
|
tableView.delegate = self
|
|
tableView.delegate = self
|
|
tableView.dataSource = self
|
|
tableView.dataSource = self
|
|
|
|
+ tableView.layoutMargins = .init(top: 0, left: 5, bottom: 0, right: 5)
|
|
|
|
+ tableView.separatorStyle = .none
|
|
|
|
|
|
self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
|
|
self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
|
|
|
|
|
|
makeMenu()
|
|
makeMenu()
|
|
|
|
|
|
|
|
+ switchVibrateMode.tintColor = .gray
|
|
|
|
+ switchSaveToGallery.tintColor = .gray
|
|
|
|
+ switchAutoDownload.tintColor = .gray
|
|
|
|
+ switchVibrateMode.onTintColor = .mainColor
|
|
|
|
+ switchSaveToGallery.onTintColor = .mainColor
|
|
|
|
+ switchAutoDownload.onTintColor = .mainColor
|
|
|
|
+ let vibrateMode = UserDefaults.standard.bool(forKey: "vibrateMode")
|
|
|
|
+ let saveGallery = UserDefaults.standard.bool(forKey: "saveToGallery")
|
|
|
|
+ let autoDownload = UserDefaults.standard.bool(forKey: "autoDownload")
|
|
|
|
+ if vibrateMode {
|
|
|
|
+ switchVibrateMode.setOn(true, animated: false)
|
|
|
|
+ }
|
|
|
|
+ if saveGallery {
|
|
|
|
+ switchSaveToGallery.setOn(true, animated: false)
|
|
|
|
+ }
|
|
|
|
+ if autoDownload {
|
|
|
|
+ switchAutoDownload.setOn(true, animated: false)
|
|
|
|
+ }
|
|
|
|
+ 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))
|
|
// navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(didTapCancel))
|
|
}
|
|
}
|
|
|
|
|
|
@@ -41,7 +67,31 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- func makeMenu(){
|
|
|
|
|
|
+ @objc func vibrateModeSwitch() {
|
|
|
|
+ UserDefaults.standard.set(switchVibrateMode.isOn, forKey: "vibrateMode")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func saveToGallerySwitch() {
|
|
|
|
+ if switchSaveToGallery.isOn {
|
|
|
|
+ PHPhotoLibrary.requestAuthorization({status in
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ if status == .authorized {
|
|
|
|
+ UserDefaults.standard.set(self.switchSaveToGallery.isOn, forKey: "saveToGallery")
|
|
|
|
+ } else {
|
|
|
|
+ self.switchSaveToGallery.setOn(false, animated: true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ UserDefaults.standard.set(self.switchSaveToGallery.isOn, forKey: "saveToGallery")
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func autoDownloadSwitch() {
|
|
|
|
+ UserDefaults.standard.set(switchAutoDownload.isOn, forKey: "autoDownload")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func makeMenu(imageSignIn: String = ""){
|
|
let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
Database.shared.database?.inTransaction({ fmdb, rollback in
|
|
let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
@@ -59,51 +109,100 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
if cursorUser.string(forColumnIndex: 0) == "23" && position == "1" {
|
|
if cursorUser.string(forColumnIndex: 0) == "23" && position == "1" {
|
|
Item.menus["Personal"] = [
|
|
Item.menus["Personal"] = [
|
|
Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
- Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized()),
|
|
|
|
- Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
|
|
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".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: "Login to Nexilis Web".localized()),
|
|
]
|
|
]
|
|
} else if cursorUser.string(forColumnIndex: 0) == "23" || cursorUser.string(forColumnIndex: 0) == "24" {
|
|
} else if cursorUser.string(forColumnIndex: 0) == "23" || cursorUser.string(forColumnIndex: 0) == "24" {
|
|
Item.menus["Personal"] = [
|
|
Item.menus["Personal"] = [
|
|
Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
- Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
|
|
|
|
- Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
|
|
|
+ Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
|
+// Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
|
|
]
|
|
]
|
|
} else {
|
|
} else {
|
|
Item.menus["Personal"] = [
|
|
Item.menus["Personal"] = [
|
|
Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
- Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Sign In Admin / Internal".localized()),
|
|
|
|
- Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
|
|
|
|
|
|
+// Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
|
+ Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Login as Admin / Internal".localized()),
|
|
]
|
|
]
|
|
}
|
|
}
|
|
- let image = cursorUser.string(forColumnIndex: 1) ?? ""
|
|
|
|
- if !image.isEmpty {
|
|
|
|
|
|
+ if !isChangeProfile {
|
|
|
|
+ Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Change Device".localized()))
|
|
|
|
+ } else if isChangeProfile {
|
|
|
|
+ Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Logout".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(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()
|
|
|
|
+ } else {
|
|
|
|
+ Item.menus["Personal"] = [
|
|
|
|
+ Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
|
|
|
|
+// Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
|
|
|
|
+ Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
|
|
|
|
+ Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Login as Admin / Internal".localized()),
|
|
|
|
+ Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Change Device".localized())
|
|
|
|
+ ]
|
|
|
|
+ if !imageSignIn.isEmpty {
|
|
do {
|
|
do {
|
|
let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
- let file = documentDir.appendingPathComponent(image)
|
|
|
|
|
|
+ let file = documentDir.appendingPathComponent(imageSignIn)
|
|
if FileManager().fileExists(atPath: file.path) {
|
|
if FileManager().fileExists(atPath: file.path) {
|
|
let image = UIImage(contentsOfFile: file.path)
|
|
let image = UIImage(contentsOfFile: file.path)
|
|
Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
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 {
|
|
} else {
|
|
- Download().start(forKey: image) { (name, progress) in
|
|
|
|
|
|
+ Download().start(forKey: imageSignIn) { (name, progress) in
|
|
guard progress == 100 else {
|
|
guard progress == 100 else {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let image = UIImage(contentsOfFile: file.path)
|
|
let image = UIImage(contentsOfFile: file.path)
|
|
Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
self.tableView.reloadData()
|
|
self.tableView.reloadData()
|
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
|
+ dataImage["name"] = imageSignIn
|
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} catch {}
|
|
} catch {}
|
|
}
|
|
}
|
|
- cursorUser.close()
|
|
|
|
- }
|
|
|
|
- if !isChangeProfile {
|
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Change Device".localized()))
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -111,29 +210,19 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
Item(icon: UIImage(systemName: "message"), title: "Incoming Message(s)".localized()),
|
|
Item(icon: UIImage(systemName: "message"), title: "Incoming Message(s)".localized()),
|
|
Item(icon: UIImage(systemName: "phone"), title: "Incoming Call(s)".localized()),
|
|
Item(icon: UIImage(systemName: "phone"), title: "Incoming Call(s)".localized()),
|
|
Item(icon: UIImage(systemName: "iphone.homebutton.radiowaves.left.and.right"), title: "Vibrate Mode".localized()),
|
|
Item(icon: UIImage(systemName: "iphone.homebutton.radiowaves.left.and.right"), title: "Vibrate Mode".localized()),
|
|
- ]
|
|
|
|
- Item.menus["Etc"] = [
|
|
|
|
Item(icon: UIImage(systemName: "photo.on.rectangle.angled"), title: "Save to Gallery".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()),
|
|
Item(icon: UIImage(systemName: "arrow.down.square"), title: "Auto Download".localized()),
|
|
-// Item(icon: UIImage(systemName: "mail"), title: "Email".localized()),
|
|
|
|
]
|
|
]
|
|
Item.menus["Version"] = [
|
|
Item.menus["Version"] = [
|
|
Item(icon: UIImage(systemName: "gear"), title: "Version".localized()),
|
|
Item(icon: UIImage(systemName: "gear"), title: "Version".localized()),
|
|
- ]
|
|
|
|
- if isChangeProfile {
|
|
|
|
- Item.menus["Version"]?.append(Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Logout".localized()))
|
|
|
|
- }
|
|
|
|
- Item.menus["Powered"] = [
|
|
|
|
- Item(icon: UIImage(named: "pb_powered_button"), title: "Powered by Nexilis".localized()),
|
|
|
|
|
|
+ Item(icon: UIImage(named: "pb_powered_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), title: "Powered by Nexilis".localized()),
|
|
]
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
override public func viewWillAppear(_ animated: Bool) {
|
|
override public func viewWillAppear(_ animated: Bool) {
|
|
- let randomInt = Int.random(in: 1..<2)
|
|
|
|
|
|
+ let randomInt = Int.random(in: 1..<10)
|
|
backgroundImage.image = UIImage(named: "pb_lbackground_\(randomInt)")
|
|
backgroundImage.image = UIImage(named: "pb_lbackground_\(randomInt)")
|
|
self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
|
|
self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
|
|
- let cpaasMode = PrefsUtil.getCpaasMode()
|
|
|
|
- let isBurger = cpaasMode == PrefsUtil.CPAAS_MODE_BURGER
|
|
|
|
navigationController?.setNavigationBarHidden(false, animated: false)
|
|
navigationController?.setNavigationBarHidden(false, animated: false)
|
|
navigationController?.navigationBar.backgroundColor = .clear
|
|
navigationController?.navigationBar.backgroundColor = .clear
|
|
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
|
|
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
|
|
@@ -141,10 +230,6 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
navigationController?.navigationBar.isTranslucent = true
|
|
navigationController?.navigationBar.isTranslucent = true
|
|
}
|
|
}
|
|
|
|
|
|
-// @objc func didTapCancel(sender: AnyObject) {
|
|
|
|
-// navigationController?.dismiss(animated: true, completion: nil)
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
// MARK: - Table view data source
|
|
// MARK: - Table view data source
|
|
|
|
|
|
public func numberOfSections(in tableView: UITableView) -> Int {
|
|
public func numberOfSections(in tableView: UITableView) -> Int {
|
|
@@ -152,8 +237,8 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
}
|
|
}
|
|
|
|
|
|
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
public func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
|
- return 1
|
|
|
|
- }
|
|
|
|
|
|
+ return 1
|
|
|
|
+ }
|
|
|
|
|
|
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
return Item.menuFor(section: section).count
|
|
return Item.menuFor(section: section).count
|
|
@@ -162,7 +247,6 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
|
|
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
|
|
cell.accessoryType = .none
|
|
cell.accessoryType = .none
|
|
- cell.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
|
|
|
|
cell.indentationLevel = 0
|
|
cell.indentationLevel = 0
|
|
var content = cell.defaultContentConfiguration()
|
|
var content = cell.defaultContentConfiguration()
|
|
content.textProperties.font = UIFont.systemFont(ofSize: 14)
|
|
content.textProperties.font = UIFont.systemFont(ofSize: 14)
|
|
@@ -176,21 +260,29 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
content.imageProperties.tintColor = .mainColor
|
|
content.imageProperties.tintColor = .mainColor
|
|
content.imageProperties.maximumSize = CGSize(width: 24, height: 24)
|
|
content.imageProperties.maximumSize = CGSize(width: 24, height: 24)
|
|
content.text = menu.title
|
|
content.text = menu.title
|
|
|
|
+ cell.accessoryView = nil
|
|
switch menu.title {
|
|
switch menu.title {
|
|
case "Personal Information".localized():
|
|
case "Personal Information".localized():
|
|
cell.accessoryType = .disclosureIndicator
|
|
cell.accessoryType = .disclosureIndicator
|
|
- case "Sign In Admin / Internal".localized():
|
|
|
|
|
|
+ case "Login as Admin / Internal".localized():
|
|
cell.accessoryType = .disclosureIndicator
|
|
cell.accessoryType = .disclosureIndicator
|
|
case "Login to Nexilis Web".localized():
|
|
case "Login to Nexilis Web".localized():
|
|
cell.accessoryType = .disclosureIndicator
|
|
cell.accessoryType = .disclosureIndicator
|
|
case "Change Device".localized():
|
|
case "Change Device".localized():
|
|
cell.accessoryType = .disclosureIndicator
|
|
cell.accessoryType = .disclosureIndicator
|
|
|
|
+// case "Logout".localized():
|
|
case "Change Admin / Internal Password".localized():
|
|
case "Change Admin / Internal Password".localized():
|
|
cell.accessoryType = .disclosureIndicator
|
|
cell.accessoryType = .disclosureIndicator
|
|
case "Change Language".localized():
|
|
case "Change Language".localized():
|
|
cell.accessoryType = .disclosureIndicator
|
|
cell.accessoryType = .disclosureIndicator
|
|
case "Version".localized():
|
|
case "Version".localized():
|
|
content.secondaryText = UIApplication.appVersion
|
|
content.secondaryText = UIApplication.appVersion
|
|
|
|
+ case "Vibrate Mode".localized():
|
|
|
|
+ cell.accessoryView = switchVibrateMode
|
|
|
|
+ case "Save to Gallery".localized():
|
|
|
|
+ cell.accessoryView = switchSaveToGallery
|
|
|
|
+ case "Auto Download".localized():
|
|
|
|
+ cell.accessoryView = switchAutoDownload
|
|
default:
|
|
default:
|
|
content.secondaryText = nil
|
|
content.secondaryText = nil
|
|
}
|
|
}
|
|
@@ -207,58 +299,43 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
controller.data = UserDefaults.standard.string(forKey: "me")!
|
|
controller.data = UserDefaults.standard.string(forKey: "me")!
|
|
controller.flag = .me
|
|
controller.flag = .me
|
|
controller.dismissImage = { image, imageName in
|
|
controller.dismissImage = { image, imageName in
|
|
- if !imageName.isEmpty {
|
|
|
|
- Item.menus["Personal"]?[0].icon = image.circleMasked
|
|
|
|
- } else {
|
|
|
|
- Item.menus["Personal"]?[0].icon = UIImage(systemName: "person.fill")
|
|
|
|
- }
|
|
|
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
|
+ dataImage["name"] = imageName
|
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
|
+ self.makeMenu()
|
|
self.tableView.reloadData()
|
|
self.tableView.reloadData()
|
|
}
|
|
}
|
|
navigationController?.show(controller, sender: nil)
|
|
navigationController?.show(controller, sender: nil)
|
|
}
|
|
}
|
|
- } else if item.title == "Sign In Admin / Internal".localized() || item.title == "Change Admin / Internal Password".localized() {
|
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
|
- if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT first_name, last_name FROM BUDDY where f_pin = '\(UserDefaults.standard.string(forKey: "me")!)'"), cursorData.next() {
|
|
|
|
- if (cursorData.string(forColumnIndex: 0)! + " " + cursorData.string(forColumnIndex: 1)!).trimmingCharacters(in: .whitespaces) == "USR\(UserDefaults.standard.string(forKey: "me")!)" {
|
|
|
|
- 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: "profileView") as! ProfileViewController
|
|
|
|
- controller.data = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
- controller.flag = .me
|
|
|
|
- self.navigationController?.show(controller, sender: nil)
|
|
|
|
- }))
|
|
|
|
- self.present(alert, animated: true, completion: nil)
|
|
|
|
- }
|
|
|
|
- cursorData.close()
|
|
|
|
|
|
+ } else if item.title == "Login as Admin / Internal".localized() || item.title == "Change Admin / Internal Password".localized() {
|
|
|
|
+ if(ViewController.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
|
|
return
|
|
}
|
|
}
|
|
- })
|
|
|
|
- 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: .top)
|
|
|
|
- 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: "Login as Admin".localized()) {
|
|
|
|
- alertController.addAction(action)
|
|
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if let action = self.actionLogin(for: "internal", title: "Login as Internal Team".localized()) {
|
|
|
|
- alertController.addAction(action)
|
|
|
|
|
|
+ else {
|
|
|
|
+ if let action = self.actionLogin(for: "admin", title: "Login as Admin".localized()) {
|
|
|
|
+ alertController.addAction(action)
|
|
|
|
+ }
|
|
|
|
+ if let action = self.actionLogin(for: "internal", title: "Login as Internal Team".localized()) {
|
|
|
|
+ alertController.addAction(action)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
|
+ self.present(alertController, animated: true)
|
|
}
|
|
}
|
|
- alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: nil))
|
|
|
|
- self.present(alertController, animated: true)
|
|
|
|
} else if item.title == "Change Language".localized() {
|
|
} else if item.title == "Change Language".localized() {
|
|
let vc = UIViewController()
|
|
let vc = UIViewController()
|
|
vc.preferredContentSize = CGSize(width: UIScreen.main.bounds.width - 10, height: 150)
|
|
vc.preferredContentSize = CGSize(width: UIScreen.main.bounds.width - 10, height: 150)
|
|
@@ -267,9 +344,9 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
pickerView.delegate = self
|
|
pickerView.delegate = self
|
|
|
|
|
|
let lang = UserDefaults.standard.string(forKey: "i18n_language")
|
|
let lang = UserDefaults.standard.string(forKey: "i18n_language")
|
|
- var index = 0
|
|
|
|
|
|
+ var index = 1
|
|
if lang == "id" {
|
|
if lang == "id" {
|
|
- index = 1
|
|
|
|
|
|
+ index = 0
|
|
}
|
|
}
|
|
pickerView.selectRow(index, inComponent: 0, animated: false)
|
|
pickerView.selectRow(index, inComponent: 0, animated: false)
|
|
|
|
|
|
@@ -281,7 +358,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
let alert = UIAlertController(title: "Select Language".localized(), message: "", preferredStyle: .actionSheet)
|
|
let alert = UIAlertController(title: "Select Language".localized(), message: "", preferredStyle: .actionSheet)
|
|
|
|
|
|
alert.setValue(vc, forKey: "contentViewController")
|
|
alert.setValue(vc, forKey: "contentViewController")
|
|
- alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { (UIAlertAction) in
|
|
|
|
|
|
+ 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", style: .default, handler: { (UIAlertAction) in
|
|
@@ -289,79 +366,30 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
let lang = self.language[selectedIndex].values.first
|
|
let lang = self.language[selectedIndex].values.first
|
|
UserDefaults.standard.set(lang, forKey: "i18n_language")
|
|
UserDefaults.standard.set(lang, forKey: "i18n_language")
|
|
self.viewDidLoad()
|
|
self.viewDidLoad()
|
|
- self.tableView.reloadData()
|
|
|
|
}))
|
|
}))
|
|
self.present(alert, animated: true, completion: nil)
|
|
self.present(alert, animated: true, completion: nil)
|
|
} else if item.title == "Change Device".localized() {
|
|
} else if item.title == "Change Device".localized() {
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeDevice") as! ChangeDeviceViewController
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeDevice") as! ChangeDeviceViewController
|
|
controller.isDismiss = { newThumb in
|
|
controller.isDismiss = { newThumb in
|
|
- if Item.menus["Personal"]?[2].title == "Login to Nexilis Web".localized() {
|
|
|
|
- Item.menus["Personal"]?.remove(at: 3)
|
|
|
|
- } else {
|
|
|
|
- Item.menus["Personal"]?.remove(at: 2)
|
|
|
|
- }
|
|
|
|
- if !newThumb.isEmpty {
|
|
|
|
- do {
|
|
|
|
- let documentDir = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
|
|
|
|
- let file = documentDir.appendingPathComponent(newThumb)
|
|
|
|
- if FileManager().fileExists(atPath: file.path) {
|
|
|
|
- let image = UIImage(contentsOfFile: file.path)
|
|
|
|
- Item.menus["Personal"]?[0].icon = image?.circleMasked
|
|
|
|
- } else {
|
|
|
|
- Download().start(forKey: newThumb) { (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()
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } catch {}
|
|
|
|
- }
|
|
|
|
- Item.menus["Version"]?.append(Item(icon: UIImage(systemName: "rectangle.portrait.and.arrow.right"), title: "Logout".localized()))
|
|
|
|
- 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 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" {
|
|
|
|
- let itemCP = Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized())
|
|
|
|
- Item.menus["Personal"]?[1] = itemCP
|
|
|
|
- } else if cursorUser.string(forColumnIndex: 0) == "23" || cursorUser.string(forColumnIndex: 0) == "24" {
|
|
|
|
- Item.menus["Personal"]?.remove(at: 1)
|
|
|
|
- }
|
|
|
|
- cursorUser.close()
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ self.makeMenu(imageSignIn: newThumb)
|
|
self.tableView.reloadData()
|
|
self.tableView.reloadData()
|
|
}
|
|
}
|
|
navigationController?.show(controller, sender: nil)
|
|
navigationController?.show(controller, sender: nil)
|
|
} else if item.title == "Logout".localized() {
|
|
} else if item.title == "Logout".localized() {
|
|
- let alert = UIAlertController(title: "Logout", message: "Are you sure want to logout?".localized(), preferredStyle: .alert)
|
|
|
|
|
|
+ let alert = UIAlertController(title: "Logout".localized(), message: "Are you sure want to logout?".localized(), preferredStyle: .alert)
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: UIAlertAction.Style.default, handler: nil))
|
|
alert.addAction(UIAlertAction(title: "Yes".localized(), style: .destructive, handler: {(_) in
|
|
alert.addAction(UIAlertAction(title: "Yes".localized(), style: .destructive, handler: {(_) in
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
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: .top)
|
|
|
|
|
|
+ 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()
|
|
banner.show()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
DispatchQueue.global().async {
|
|
DispatchQueue.global().async {
|
|
self.deleteAllRecordDatabase()
|
|
self.deleteAllRecordDatabase()
|
|
- let apiKey = UserDefaults.standard.string(forKey: "apiKey")!
|
|
|
|
|
|
+ Nexilis.destroyAll()
|
|
|
|
+ let apiKey = Nexilis.sAPIKey
|
|
var id = UIDevice.current.identifierForVendor?.uuidString ?? "UNK-DEVICE"
|
|
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) {
|
|
if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getSignUpApi(api: apiKey, p_pin: id), timeout: 30 * 1000) {
|
|
id = response.getBody(key: CoreMessage_TMessageKey.F_PIN, default_value: "")
|
|
id = response.getBody(key: CoreMessage_TMessageKey.F_PIN, default_value: "")
|
|
@@ -376,18 +404,12 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
imageView.tintColor = .white
|
|
- let banner = FloatingNotificationBanner(title: "Successfully Logout".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: .top)
|
|
|
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully Logout".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()
|
|
banner.show()
|
|
- Item.menus["Personal"]?[0].icon = UIImage(systemName: "person.fill")
|
|
|
|
- Item.menus["Personal"]?.append(Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Change Device".localized()))
|
|
|
|
- Item.menus["Version"]?.remove(at: 1)
|
|
|
|
- if Item.menus["Personal"]?[1].title != "Sign In Admin / Internal".localized() {
|
|
|
|
- if Item.menus["Personal"]?[1].title == "Change Admin / Internal Password".localized() {
|
|
|
|
- Item.menus["Personal"]?[1] = Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Sign In Admin / Internal".localized())
|
|
|
|
- } else {
|
|
|
|
- Item.menus["Personal"]?.insert(Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Sign In Admin / Internal".localized()), at: 1)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ var dataImage: [AnyHashable : Any] = [:]
|
|
|
|
+ dataImage["name"] = ""
|
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
|
|
|
|
+ self.makeMenu()
|
|
self.tableView.reloadData()
|
|
self.tableView.reloadData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -395,7 +417,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
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: .top)
|
|
|
|
|
|
+ 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()
|
|
banner.show()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -415,14 +437,23 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
self.alert?.addTextField{ (texfield) in
|
|
self.alert?.addTextField{ (texfield) in
|
|
texfield.placeholder = "Password"
|
|
texfield.placeholder = "Password"
|
|
texfield.isSecureTextEntry = true
|
|
texfield.isSecureTextEntry = true
|
|
|
|
+ texfield.addPadding(.right(40))
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
|
|
+
|
|
|
|
+ let buttonHideUnhide = UIButton()
|
|
|
|
+ buttonHideUnhide.tag = 0
|
|
|
|
+ texfield.addSubview(buttonHideUnhide)
|
|
|
|
+ buttonHideUnhide.anchor(top: texfield.topAnchor, right: texfield.rightAnchor, paddingTop: -7, width: 30, height: 30)
|
|
|
|
+ buttonHideUnhide.setImage(UIImage(systemName: "eye.slash.fill"), for: .normal)
|
|
|
|
+ buttonHideUnhide.tintColor = .black
|
|
|
|
+ buttonHideUnhide.addTarget(self, action: #selector(self.showPassword), for: .touchUpInside)
|
|
}
|
|
}
|
|
let submitAction = UIAlertAction(title: "Sign In".localized(), style: .default, handler: { (action) -> Void in
|
|
let submitAction = UIAlertAction(title: "Sign In".localized(), style: .default, handler: { (action) -> Void in
|
|
let textField = self.alert?.textFields![0]
|
|
let textField = self.alert?.textFields![0]
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
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: .top)
|
|
|
|
|
|
+ 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()
|
|
banner.show()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -432,7 +463,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
imageView.tintColor = .white
|
|
- let banner = FloatingNotificationBanner(title: "Successfully login 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: .top)
|
|
|
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully login 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()
|
|
banner.show()
|
|
let itemCP = Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized())
|
|
let itemCP = Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized())
|
|
Item.menus["Personal"]?[1] = itemCP
|
|
Item.menus["Personal"]?[1] = itemCP
|
|
@@ -446,7 +477,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
imageView.tintColor = .white
|
|
- let banner = FloatingNotificationBanner(title: "Successfully login 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: .top)
|
|
|
|
|
|
+ let banner = FloatingNotificationBanner(title: "Successfully login 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()
|
|
banner.show()
|
|
Item.menus["Personal"]?.remove(at: 1)
|
|
Item.menus["Personal"]?.remove(at: 1)
|
|
self.tableView.reloadData()
|
|
self.tableView.reloadData()
|
|
@@ -473,14 +504,32 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
self.alert?.addTextField{ (texfield) in
|
|
self.alert?.addTextField{ (texfield) in
|
|
texfield.placeholder = "Old Password"
|
|
texfield.placeholder = "Old Password"
|
|
texfield.isSecureTextEntry = true
|
|
texfield.isSecureTextEntry = true
|
|
|
|
+ texfield.addPadding(.right(40))
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
self.textFields.append(texfield)
|
|
self.textFields.append(texfield)
|
|
|
|
+
|
|
|
|
+ let buttonHideUnhide = UIButton()
|
|
|
|
+ buttonHideUnhide.tag = 0
|
|
|
|
+ texfield.addSubview(buttonHideUnhide)
|
|
|
|
+ buttonHideUnhide.anchor(top: texfield.topAnchor, right: texfield.rightAnchor, paddingTop: -7, width: 30, height: 30)
|
|
|
|
+ buttonHideUnhide.setImage(UIImage(systemName: "eye.slash.fill"), for: .normal)
|
|
|
|
+ buttonHideUnhide.tintColor = .black
|
|
|
|
+ buttonHideUnhide.addTarget(self, action: #selector(self.showPassword), for: .touchUpInside)
|
|
}
|
|
}
|
|
self.alert?.addTextField{ (texfield) in
|
|
self.alert?.addTextField{ (texfield) in
|
|
texfield.placeholder = "New Password"
|
|
texfield.placeholder = "New Password"
|
|
texfield.isSecureTextEntry = true
|
|
texfield.isSecureTextEntry = true
|
|
|
|
+ texfield.addPadding(.right(40))
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
texfield.addTarget(self, action: #selector(self.alertTextFieldDidChange(_:)), for: UIControl.Event.editingChanged)
|
|
self.textFields.append(texfield)
|
|
self.textFields.append(texfield)
|
|
|
|
+
|
|
|
|
+ let buttonHideUnhide = UIButton()
|
|
|
|
+ buttonHideUnhide.tag = 1
|
|
|
|
+ texfield.addSubview(buttonHideUnhide)
|
|
|
|
+ buttonHideUnhide.anchor(top: texfield.topAnchor, right: texfield.rightAnchor, paddingTop: -7, width: 30, height: 30)
|
|
|
|
+ buttonHideUnhide.setImage(UIImage(systemName: "eye.slash.fill"), for: .normal)
|
|
|
|
+ buttonHideUnhide.tintColor = .black
|
|
|
|
+ buttonHideUnhide.addTarget(self, action: #selector(self.showPassword), for: .touchUpInside)
|
|
}
|
|
}
|
|
let submitAction = UIAlertAction(title: "Change Password".localized(), style: .default, handler: { (action) -> Void in
|
|
let submitAction = UIAlertAction(title: "Change Password".localized(), style: .default, handler: { (action) -> Void in
|
|
let textFieldOld = self.alert?.textFields![0]
|
|
let textFieldOld = self.alert?.textFields![0]
|
|
@@ -488,7 +537,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
if !CheckConnection.isConnectedToNetwork() || API.nGetCLXConnState() == 0 {
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
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: .top)
|
|
|
|
|
|
+ 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()
|
|
banner.show()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -498,7 +547,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
imageView.tintColor = .white
|
|
- let banner = FloatingNotificationBanner(title: "Admin password changed successfully".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: .top)
|
|
|
|
|
|
+ let banner = FloatingNotificationBanner(title: "Admin password changed successfully".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()
|
|
banner.show()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -509,7 +558,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
let imageView = UIImageView(image: UIImage(systemName: "checkmark.circle.fill"))
|
|
imageView.tintColor = .white
|
|
imageView.tintColor = .white
|
|
- let banner = FloatingNotificationBanner(title: "Internal password changed successfully".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: .top)
|
|
|
|
|
|
+ let banner = FloatingNotificationBanner(title: "Internal password changed successfully".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()
|
|
banner.show()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -524,6 +573,18 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func showPassword(_ sender:UIButton) {
|
|
|
|
+ if alert!.textFields![sender.tag].isSecureTextEntry {
|
|
|
|
+ alert!.textFields![sender.tag].isSecureTextEntry = false
|
|
|
|
+ let buttonImage = alert!.textFields![sender.tag].subviews[0] as! UIButton
|
|
|
|
+ buttonImage.setImage(UIImage(systemName: "eye.fill"), for: .normal)
|
|
|
|
+ } else {
|
|
|
|
+ alert!.textFields![sender.tag].isSecureTextEntry = true
|
|
|
|
+ let buttonImage = alert!.textFields![sender.tag].subviews[0] as! UIButton
|
|
|
|
+ buttonImage.setImage(UIImage(systemName: "eye.slash.fill"), for: .normal)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func alertTextFieldDidChange(_ sender: UITextField) {
|
|
@objc func alertTextFieldDidChange(_ sender: UITextField) {
|
|
if(!textFields.isEmpty){
|
|
if(!textFields.isEmpty){
|
|
print("text count 0: \(textFields[0].text!.count)")
|
|
print("text count 0: \(textFields[0].text!.count)")
|
|
@@ -692,7 +753,7 @@ struct Item: Hashable {
|
|
var title = ""
|
|
var title = ""
|
|
|
|
|
|
static var sections: [String] {
|
|
static var sections: [String] {
|
|
- return ["Personal", "Call", "Etc", "Version", "Powered"]
|
|
|
|
|
|
+ return ["Personal", "Call", "Version"]
|
|
}
|
|
}
|
|
|
|
|
|
static var menus: [String: [Item]] = [:]
|
|
static var menus: [String: [Item]] = [:]
|