|
@@ -40,6 +40,8 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
public static var isTab4 = false
|
|
|
public static var isExpandButton = false
|
|
|
public static var alwaysHideButton = false
|
|
|
+ static var listPullFB: [String] = []
|
|
|
+ static var datePullFB: Date?
|
|
|
|
|
|
public static var def: ViewController?
|
|
|
|
|
@@ -160,14 +162,12 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized().localized(), preferredStyle: .alert)
|
|
|
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: .destructive, handler: {_ in
|
|
|
ViewController.def?.thirdTab?.webView?.evaluateJavaScript("if(resumeAll){resumeAll();}")
|
|
|
-
|
|
|
-
|
|
|
}))
|
|
|
alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
|
|
|
ViewController.resetTabSelected()
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
|
|
|
let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .custom
|
|
|
+ navigationController.modalPresentationStyle = .fullScreen
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
|
navigationController.navigationBar.isTranslucent = false
|
|
@@ -175,6 +175,8 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
ViewController.def?.show(b: false)
|
|
|
+ ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
}))
|
|
|
UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(alert, animated: true, completion: nil)
|
|
@@ -368,7 +370,37 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
print("ccTap")
|
|
|
if(ViewController.checkIsChangePerson()){
|
|
|
show(b: false)
|
|
|
- Nexilis.buttonClicked(index: 1)
|
|
|
+ ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ if ViewController.listPullFB.count != 0 {
|
|
|
+ let package_id = ViewController.listPullFB[2].split(separator: "|")[0]
|
|
|
+ var app_id = ""
|
|
|
+ if ViewController.listPullFB[2].split(separator: "|").count > 1 {
|
|
|
+ app_id = String(ViewController.listPullFB[2].split(separator: "|")[1])
|
|
|
+ }
|
|
|
+ if package_id.contains("_fb") {
|
|
|
+ let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
|
|
|
+ if indexTap! < 5 {
|
|
|
+ Nexilis.buttonClicked(index: 1)
|
|
|
+ } else {
|
|
|
+ if indexTap == 5 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openQMS")
|
|
|
+ } else if indexTap == 6 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if !app_id.isEmpty {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: app_id)
|
|
|
+ } else {
|
|
|
+ if let url = URL(string: String(package_id)) {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Nexilis.buttonClicked(index: 1)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -376,8 +408,34 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
print("streamTap")
|
|
|
if(ViewController.checkIsChangePerson()){
|
|
|
show(b: false)
|
|
|
- if Bundle.main.displayName == "DigiNetS" {
|
|
|
- Nexilis.buttonClicked(index: 0, id: "id1471093490")
|
|
|
+ ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ if ViewController.listPullFB.count != 0 {
|
|
|
+ let package_id = ViewController.listPullFB[4].split(separator: "|")[0]
|
|
|
+ var app_id = ""
|
|
|
+ if ViewController.listPullFB[4].split(separator: "|").count > 1 {
|
|
|
+ app_id = String(ViewController.listPullFB[4].split(separator: "|")[1])
|
|
|
+ }
|
|
|
+ if package_id.contains("_fb") {
|
|
|
+ let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
|
|
|
+ if indexTap! < 5 {
|
|
|
+ Nexilis.buttonClicked(index: 1)
|
|
|
+ } else {
|
|
|
+ if indexTap == 5 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openQMS")
|
|
|
+ } else if indexTap == 6 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if !app_id.isEmpty {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: app_id)
|
|
|
+ } else {
|
|
|
+ if let url = URL(string: String(package_id)) {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
Nexilis.buttonClicked(index: 4)
|
|
|
}
|
|
@@ -388,9 +446,34 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
print("callTap")
|
|
|
if(ViewController.checkIsChangePerson()){
|
|
|
show(b: false)
|
|
|
- if Bundle.main.displayName == "DigiNetS" {
|
|
|
- //open QMS
|
|
|
- Nexilis.buttonClicked(index: 0, id: "openQMS")
|
|
|
+ ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ if ViewController.listPullFB.count != 0 {
|
|
|
+ let package_id = ViewController.listPullFB[1].split(separator: "|")[0]
|
|
|
+ var app_id = ""
|
|
|
+ if ViewController.listPullFB[1].split(separator: "|").count > 1 {
|
|
|
+ app_id = String(ViewController.listPullFB[1].split(separator: "|")[1])
|
|
|
+ }
|
|
|
+ if package_id.contains("_fb") {
|
|
|
+ let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
|
|
|
+ if indexTap! < 5 {
|
|
|
+ Nexilis.buttonClicked(index: 1)
|
|
|
+ } else {
|
|
|
+ if indexTap == 5 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openQMS")
|
|
|
+ } else if indexTap == 6 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if !app_id.isEmpty {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: app_id)
|
|
|
+ } else {
|
|
|
+ if let url = URL(string: String(package_id)) {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
Nexilis.buttonClicked(index: 3)
|
|
|
}
|
|
@@ -401,8 +484,34 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
print("chatTap")
|
|
|
if(ViewController.checkIsChangePerson()){
|
|
|
show(b: false)
|
|
|
- if Bundle.main.displayName == "DigiNetS" {
|
|
|
- Nexilis.buttonClicked(index: 0, id: "id967205539")
|
|
|
+ ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ if ViewController.listPullFB.count != 0 {
|
|
|
+ let package_id = ViewController.listPullFB[0].split(separator: "|")[0]
|
|
|
+ var app_id = ""
|
|
|
+ if ViewController.listPullFB[0].split(separator: "|").count > 1 {
|
|
|
+ app_id = String(ViewController.listPullFB[0].split(separator: "|")[1])
|
|
|
+ }
|
|
|
+ if package_id.contains("_fb") {
|
|
|
+ let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
|
|
|
+ if indexTap! < 5 {
|
|
|
+ Nexilis.buttonClicked(index: 1)
|
|
|
+ } else {
|
|
|
+ if indexTap == 5 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openQMS")
|
|
|
+ } else if indexTap == 6 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if !app_id.isEmpty {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: app_id)
|
|
|
+ } else {
|
|
|
+ if let url = URL(string: String(package_id)) {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
Nexilis.buttonClicked(index: 2)
|
|
|
}
|
|
@@ -412,9 +521,34 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
@objc func postTap() {
|
|
|
if(ViewController.checkIsChangePerson()){
|
|
|
show(b: false)
|
|
|
- if Bundle.main.displayName == "DigiNetS" {
|
|
|
- //open history cc
|
|
|
- Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
|
|
|
+ ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
|
|
|
+ if ViewController.listPullFB.count != 0 {
|
|
|
+ let package_id = ViewController.listPullFB[3].split(separator: "|")[0]
|
|
|
+ var app_id = ""
|
|
|
+ if ViewController.listPullFB[3].split(separator: "|").count > 1 {
|
|
|
+ app_id = String(ViewController.listPullFB[3].split(separator: "|")[1])
|
|
|
+ }
|
|
|
+ if package_id.contains("_fb") {
|
|
|
+ let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
|
|
|
+ if indexTap! < 5 {
|
|
|
+ Nexilis.buttonClicked(index: 1)
|
|
|
+ } else {
|
|
|
+ if indexTap == 5 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openQMS")
|
|
|
+ } else if indexTap == 6 {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if !app_id.isEmpty {
|
|
|
+ Nexilis.buttonClicked(index: 0, id: app_id)
|
|
|
+ } else {
|
|
|
+ if let url = URL(string: String(package_id)) {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
let customTab = PrefsUtil.getCustomTab().split(separator: ",")
|
|
|
let cpaasMode = PrefsUtil.getCpaasMode()
|
|
@@ -448,6 +582,33 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ static func pullActionButton() {
|
|
|
+ if datePullFB == nil || Int(Date().timeIntervalSince(datePullFB!)) >= 60 {
|
|
|
+ datePullFB = Date()
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.pullFloatingButton(), timeout: 30 * 1000) {
|
|
|
+ if response.isOk() {
|
|
|
+ let data = response.getBody(key: CoreMessage_TMessageKey.DATA, default_value: "")
|
|
|
+ if !data.isEmpty {
|
|
|
+ if let jsonArray = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: JSONSerialization.ReadingOptions()) as? [AnyObject] {
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ listPullFB.removeAll()
|
|
|
+ if jsonArray.count != 0 {
|
|
|
+ for json in jsonArray {
|
|
|
+ let package_id = json["package_id"] as! String
|
|
|
+ let app_id = (json["app_id"] as? String) ?? ""
|
|
|
+ listPullFB.append("\(package_id)|\(app_id)")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public static func showDockedButton() {
|
|
|
ViewController.chatButton.isHidden = false
|
|
@@ -505,6 +666,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
|
|
|
}
|
|
|
})
|
|
|
} else {
|
|
|
+ ViewController.pullActionButton()
|
|
|
ViewController.isExpandButton = true
|
|
|
ViewController.showDockedButton()
|
|
|
let xChatPosition = ViewController.chatButton.frame.origin.x - 120
|