|
@@ -50,8 +50,6 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
let term = "Terms of Service.".localized()
|
|
let term = "Terms of Service.".localized()
|
|
var firstLoad = true
|
|
var firstLoad = true
|
|
|
|
|
|
- var notDoubleCall: Date?
|
|
|
|
-
|
|
|
|
public static var def: ViewController?
|
|
public static var def: ViewController?
|
|
|
|
|
|
override func viewDidLoad() {
|
|
override func viewDidLoad() {
|
|
@@ -176,13 +174,12 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
}
|
|
}
|
|
|
|
|
|
func settingDelegate() {
|
|
func settingDelegate() {
|
|
- if notDoubleCall != nil && Int(Date().timeIntervalSince(notDoubleCall!)) < 1 {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- notDoubleCall = Date()
|
|
|
|
- if let vc = fourthTab == nil ? storyboard?.instantiateViewController(withIdentifier: "fourthTabVC") as? FourthTabViewController : fourthTab {
|
|
|
|
|
|
+ if self.viewControllers?.firstIndex(of: fourthTab!) == nil {
|
|
|
|
+ let vc = fourthTab!
|
|
vc.notInTab = true
|
|
vc.notInTab = true
|
|
self.navigationController?.show(vc, sender: nil)
|
|
self.navigationController?.show(vc, sender: nil)
|
|
|
|
+ } else {
|
|
|
|
+ self.selectedIndex = (self.viewControllers?.firstIndex(of: fourthTab!))!
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -347,6 +344,8 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
ViewController.middleButton.layer.masksToBounds = false
|
|
ViewController.middleButton.layer.masksToBounds = false
|
|
ViewController.middleButton.layer.cornerRadius = 4.0
|
|
ViewController.middleButton.layer.cornerRadius = 4.0
|
|
ViewController.middleButton.addTarget(self, action: #selector(middleBtnTapped), for: .touchUpInside)
|
|
ViewController.middleButton.addTarget(self, action: #selector(middleBtnTapped), for: .touchUpInside)
|
|
|
|
+ let longPressMidButton = UILongPressGestureRecognizer(target: self, action: #selector(longPressMidBtn(gestureRecognizer:)))
|
|
|
|
+ ViewController.middleButton.addGestureRecognizer(longPressMidButton)
|
|
self.view.addSubview(ViewController.chatButton)
|
|
self.view.addSubview(ViewController.chatButton)
|
|
self.view.addSubview(ViewController.callButton)
|
|
self.view.addSubview(ViewController.callButton)
|
|
self.view.addSubview(ViewController.ccButton)
|
|
self.view.addSubview(ViewController.ccButton)
|
|
@@ -357,6 +356,18 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
ViewController.hideDockedButton()
|
|
ViewController.hideDockedButton()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func longPressMidBtn(gestureRecognizer: UILongPressGestureRecognizer) {
|
|
|
|
+ if gestureRecognizer.state == .began {
|
|
|
|
+ if self.viewControllers?.firstIndex(of: fourthTab!) == nil {
|
|
|
|
+ let vc = fourthTab!
|
|
|
|
+ vc.notInTab = true
|
|
|
|
+ self.navigationController?.show(vc, sender: nil)
|
|
|
|
+ } else {
|
|
|
|
+ self.selectedIndex = (self.viewControllers?.firstIndex(of: fourthTab!))!
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
|
|
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
|
|
if(viewController == secondTab){
|
|
if(viewController == secondTab){
|
|
if(!ViewController.checkIsChangePerson()){
|
|
if(!ViewController.checkIsChangePerson()){
|
|
@@ -455,6 +466,9 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
|
|
viewWelcome.backgroundColor = .white
|
|
viewWelcome.backgroundColor = .white
|
|
DispatchQueue.global().async {
|
|
DispatchQueue.global().async {
|
|
if let listBg = PrefsUtil.getBackground() {
|
|
if let listBg = PrefsUtil.getBackground() {
|
|
|
|
+ if listBg.isEmpty {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
var bgChoosen = ""
|
|
var bgChoosen = ""
|
|
let arrayBg = listBg.split(separator: ",")
|
|
let arrayBg = listBg.split(separator: ",")
|
|
bgChoosen = String(arrayBg[Int.random(in: 0..<arrayBg.count)])
|
|
bgChoosen = String(arrayBg[Int.random(in: 0..<arrayBg.count)])
|