|
@@ -6,20 +6,33 @@
|
|
|
//
|
|
|
|
|
|
import UIKit
|
|
|
+import nuSDKService
|
|
|
+import NotificationBannerSwift
|
|
|
+
|
|
|
|
|
|
public class FloatingButton: UIView {
|
|
|
|
|
|
var groupView: UIStackView!
|
|
|
- var button_cc: UIButton!
|
|
|
- var button_chat: UIButton!
|
|
|
- var button_call: UIButton!
|
|
|
- var button_streaming: UIButton!
|
|
|
- var nexilis_button: UIButton!
|
|
|
+ var scrollView: UIScrollView!
|
|
|
+ var button_fb1: UIButton!
|
|
|
+ var button_fb2: UIButton!
|
|
|
+ var button_fb3: UIButton!
|
|
|
+ var button_fb4: UIButton!
|
|
|
+ var nexilis_button: UIImageView!
|
|
|
+ var nexilis_pin: UIImageView!
|
|
|
+ var leadingConstraintPin: NSLayoutConstraint!
|
|
|
+ var bottomConstraintPin: NSLayoutConstraint!
|
|
|
+ var trailingConstraintPin: NSLayoutConstraint!
|
|
|
+ var topConstraintPin: NSLayoutConstraint!
|
|
|
var lastPosY: CGFloat?
|
|
|
+ var lastImageButton = ""
|
|
|
+ var iconCC = ""
|
|
|
|
|
|
let indicatorCounterFB = UIView()
|
|
|
- let labelCounter = UILabel()
|
|
|
- var topConstraint = NSLayoutConstraint()
|
|
|
+ let labelCounterFB = UILabel()
|
|
|
+ let indicatorCounterFBBig = UIImageView()
|
|
|
+
|
|
|
+ var datePull: Date?
|
|
|
|
|
|
var panGesture: UIPanGestureRecognizer?
|
|
|
|
|
@@ -36,12 +49,16 @@ public class FloatingButton: UIView {
|
|
|
}
|
|
|
|
|
|
private func commonInit() {
|
|
|
+ backgroundColor = .clear
|
|
|
+ frame = CGRect(x: UIScreen.main.bounds.width - 50, y: (UIScreen.main.bounds.height / 2) - 50, width: 50.0, height: 50.0)
|
|
|
+
|
|
|
panGesture = UIPanGestureRecognizer(target: self, action: #selector(draggedView(_:)))
|
|
|
addGestureRecognizer(panGesture!)
|
|
|
|
|
|
- nexilis_button = UIButton()
|
|
|
+ nexilis_button = UIImageView()
|
|
|
nexilis_button.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- nexilis_button.setImage(UIImage(named: "pb_ball", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ nexilis_button.isUserInteractionEnabled = true
|
|
|
+ nexilis_button.image = UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
|
|
|
|
|
|
let qmeraTap = UITapGestureRecognizer(target: self, action: #selector(qmeraTap))
|
|
|
qmeraTap.numberOfTouchesRequired = 1
|
|
@@ -52,56 +69,197 @@ public class FloatingButton: UIView {
|
|
|
|
|
|
addSubview(nexilis_button)
|
|
|
|
|
|
- nexilis_button.widthAnchor.constraint(equalTo: widthAnchor, multiplier: 1).isActive = true
|
|
|
- nexilis_button.heightAnchor.constraint(equalTo: widthAnchor, multiplier: 1).isActive = true
|
|
|
+ nexilis_button.widthAnchor.constraint(equalToConstant: 50.0).isActive = true
|
|
|
+ nexilis_button.heightAnchor.constraint(equalToConstant: 50.0).isActive = true
|
|
|
nexilis_button.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
|
|
nexilis_button.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
|
|
|
|
|
+ scrollView = UIScrollView()
|
|
|
+ scrollView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ scrollView.layer.borderWidth = 1.0
|
|
|
+ scrollView.layer.borderColor = UIColor.white.cgColor
|
|
|
+ scrollView.layer.cornerRadius = 8.0
|
|
|
+ scrollView.layer.masksToBounds = true
|
|
|
+ scrollView.backgroundColor = .black.withAlphaComponent(0.25)
|
|
|
+ addSubview(scrollView)
|
|
|
+
|
|
|
+ scrollView.widthAnchor.constraint(equalTo: widthAnchor).isActive = true
|
|
|
+ scrollView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
|
|
+ scrollView.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
|
|
+ scrollView.bottomAnchor.constraint(equalTo: nexilis_button.topAnchor).isActive = true
|
|
|
+
|
|
|
groupView = UIStackView()
|
|
|
groupView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
groupView.axis = .vertical
|
|
|
groupView.distribution = .fillEqually
|
|
|
+
|
|
|
+ scrollView.addSubview(groupView)
|
|
|
+
|
|
|
+ groupView.widthAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ groupView.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: 5).isActive = true
|
|
|
+ groupView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: -5).isActive = true
|
|
|
+ groupView.leftAnchor.constraint(equalTo: scrollView.leftAnchor, constant: 6).isActive = true
|
|
|
|
|
|
- addSubview(groupView)
|
|
|
-
|
|
|
- groupView.widthAnchor.constraint(equalTo: widthAnchor).isActive = true
|
|
|
- groupView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
|
|
|
- groupView.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
|
|
- groupView.bottomAnchor.constraint(equalTo: nexilis_button.topAnchor).isActive = true
|
|
|
-
|
|
|
- button_cc = UIButton()
|
|
|
- button_cc.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- button_cc.setImage(UIImage(named: "pb_button_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
-
|
|
|
- groupView.addArrangedSubview(button_cc)
|
|
|
-
|
|
|
- button_chat = UIButton()
|
|
|
- button_chat.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- button_chat.setImage(UIImage(named: "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
-
|
|
|
- groupView.addArrangedSubview(button_chat)
|
|
|
-
|
|
|
- button_call = UIButton()
|
|
|
- button_call.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- button_call.setImage(UIImage(named: "pb_button_call", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
-
|
|
|
- groupView.addArrangedSubview(button_call)
|
|
|
-
|
|
|
- button_streaming = UIButton()
|
|
|
- button_streaming.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- button_streaming.setImage(UIImage(named: "pb_button_stream", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
-
|
|
|
- groupView.addArrangedSubview(button_streaming)
|
|
|
-
|
|
|
- button_chat.addTarget(self, action: #selector(chatTap), for: .touchUpInside)
|
|
|
- button_call.addTarget(self, action: #selector(callTap), for: .touchUpInside)
|
|
|
- button_streaming.addTarget(self, action: #selector(streamTap), for: .touchUpInside)
|
|
|
- button_cc.addTarget(self, action: #selector(ccTap), for: .touchUpInside)
|
|
|
+ pullButton()
|
|
|
|
|
|
let center: NotificationCenter = NotificationCenter.default
|
|
|
+ center.addObserver(self, selector: #selector(imageFBUpdate(notification:)), name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil)
|
|
|
center.addObserver(self, selector: #selector(checkCounter), name: NSNotification.Name(rawValue: "onReceiveChat"), object: nil)
|
|
|
center.addObserver(self, selector: #selector(checkCounter), name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil)
|
|
|
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(hideButton))
|
|
|
+ tapGesture.cancelsTouchesInView = false
|
|
|
+ UIApplication.shared.windows.first?.rootViewController?.view.addGestureRecognizer(tapGesture)
|
|
|
+ }
|
|
|
+
|
|
|
+ private func pullButton() {
|
|
|
+ if datePull == nil || Int(Date().timeIntervalSince(datePull!)) >= 60 {
|
|
|
+ datePull = Date()
|
|
|
+ } else if Int(Date().timeIntervalSince(datePull!)) < 60 {
|
|
|
+ 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: .center)
|
|
|
+ banner.show()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ DispatchQueue.global().async { [self] in
|
|
|
+ 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
|
|
|
+ groupView.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
+ if jsonArray.count == 0 {
|
|
|
+ getDefaultButton()
|
|
|
+ } else {
|
|
|
+ for json in jsonArray {
|
|
|
+ if (json["package_id"] as! String).contains("_fb1") {
|
|
|
+ button_fb1 = UIButton()
|
|
|
+ button_fb1.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb1.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ if data != nil {
|
|
|
+ button_fb1.setImage(UIImage(data: data!), for: .normal)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ groupView.addArrangedSubview(button_fb1)
|
|
|
+ button_fb1.addTarget(self, action: #selector(fb1Tap), for: .touchUpOutside)
|
|
|
+ } else if (json["package_id"] as! String).contains("_fb2") {
|
|
|
+ button_fb2 = UIButton()
|
|
|
+ button_fb2.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb2.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ if data != nil {
|
|
|
+ button_fb2.setImage(UIImage(data: data!), for: .normal)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ groupView.addArrangedSubview(button_fb2)
|
|
|
+ button_fb2.addTarget(self, action: #selector(fb2Tap), for: .touchUpOutside)
|
|
|
+ checkCounter()
|
|
|
+ } else if (json["package_id"] as! String).contains("_fb3") {
|
|
|
+ button_fb3 = UIButton()
|
|
|
+ button_fb3.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb3.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ if data != nil {
|
|
|
+ button_fb3.setImage(UIImage(data: data!), for: .normal)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ groupView.addArrangedSubview(button_fb3)
|
|
|
+ button_fb3.addTarget(self, action: #selector(fb3Tap), for: .touchUpOutside)
|
|
|
+ } else if (json["package_id"] as! String).contains("_fb4") {
|
|
|
+ button_fb4 = UIButton()
|
|
|
+ button_fb4.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb4.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ iconCC = json["icon"] as! String
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(self.iconCC)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ if data != nil {
|
|
|
+ button_fb4.setImage(UIImage(data: data!), for: .normal)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ groupView.addArrangedSubview(button_fb4)
|
|
|
+ button_fb4.addTarget(self, action: #selector(fb4Tap), for: .touchUpOutside)
|
|
|
+ } else {
|
|
|
+ let newButton = UIButton()
|
|
|
+ newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ newButton.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ DispatchQueue.global().async {
|
|
|
+ let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
+ DispatchQueue.main.async {
|
|
|
+ if data != nil {
|
|
|
+ newButton.setImage(UIImage(data: data!), for: .normal)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ groupView.addArrangedSubview(newButton)
|
|
|
+ newButton.restorationIdentifier = json["app_id"] as? String
|
|
|
+ newButton.addTarget(self, action: #selector(tapMoreApp(_:)), for: .touchUpOutside)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let countSubviewsAfter = groupView.subviews.count
|
|
|
+ if countSubviewsAfter <= 4 {
|
|
|
+ scrollView.isScrollEnabled = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ groupView.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
+ getDefaultButton()
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ groupView.subviews.forEach({ $0.removeFromSuperview() })
|
|
|
+ getDefaultButton()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ func getDefaultButton() {
|
|
|
+ button_fb1 = UIButton()
|
|
|
+ button_fb1.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb1.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ button_fb1.setImage(UIImage(named: "pb_button_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ groupView.addArrangedSubview(button_fb1)
|
|
|
+ button_fb1.addTarget(self, action: #selector(fb1Tap), for: .touchUpOutside)
|
|
|
+
|
|
|
+ button_fb2 = UIButton()
|
|
|
+ button_fb2.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb2.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ button_fb2.setImage(UIImage(named: "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ groupView.addArrangedSubview(button_fb2)
|
|
|
+ button_fb2.addTarget(self, action: #selector(fb2Tap), for: .touchUpOutside)
|
|
|
checkCounter()
|
|
|
+
|
|
|
+ button_fb3 = UIButton()
|
|
|
+ button_fb3.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb3.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ button_fb3.setImage(UIImage(named: "pb_button_call", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ groupView.addArrangedSubview(button_fb3)
|
|
|
+ button_fb3.addTarget(self, action: #selector(fb3Tap), for: .touchUpOutside)
|
|
|
+
|
|
|
+ button_fb4 = UIButton()
|
|
|
+ button_fb4.heightAnchor.constraint(equalToConstant: 40).isActive = true
|
|
|
+ button_fb4.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ button_fb4.setImage(UIImage(named: "pb_button_stream", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ groupView.addArrangedSubview(button_fb4)
|
|
|
+ button_fb4.addTarget(self, action: #selector(fb4Tap), for: .touchUpOutside)
|
|
|
}
|
|
|
|
|
|
@objc func draggedView(_ sender:UIPanGestureRecognizer){
|
|
@@ -121,8 +279,8 @@ public class FloatingButton: UIView {
|
|
|
xPos = maximumx
|
|
|
}
|
|
|
if(isShow) {
|
|
|
- let minimumy = (heightScreen / 5)
|
|
|
- let maximumy = heightScreen - 120
|
|
|
+ let minimumy = CGFloat(120.5) //30
|
|
|
+ let maximumy = heightScreen - 100
|
|
|
if(yPos < minimumy) {
|
|
|
yPos = minimumy
|
|
|
}
|
|
@@ -148,20 +306,41 @@ public class FloatingButton: UIView {
|
|
|
UserDefaults.standard.set(center.y, forKey: "ylastPosFB")
|
|
|
}
|
|
|
|
|
|
+ @objc func imageFBUpdate(notification: NSNotification) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
@objc func checkCounter() {
|
|
|
- DispatchQueue.main.async {
|
|
|
- let counter = self.queryCountCounter()
|
|
|
- if counter != 0 && !self.indicatorCounterFB.isDescendant(of: self) {
|
|
|
- self.addIndicatorCounterFB(counter: counter)
|
|
|
- UIApplication.shared.applicationIconBadgeNumber = Int(counter)
|
|
|
- } else if counter != 0 && self.indicatorCounterFB.isDescendant(of: self) {
|
|
|
- self.indicatorCounterFB.removeConstraints(self.indicatorCounterFB.constraints)
|
|
|
- self.indicatorCounterFB.removeFromSuperview()
|
|
|
- self.addIndicatorCounterFB(counter: counter)
|
|
|
- UIApplication.shared.applicationIconBadgeNumber = Int(counter)
|
|
|
- } else if counter == 0 && self.indicatorCounterFB.isDescendant(of: self) {
|
|
|
- self.indicatorCounterFB.removeFromSuperview()
|
|
|
- UIApplication.shared.applicationIconBadgeNumber = 0
|
|
|
+ let counter = queryCountCounter()
|
|
|
+ if counter > 0 {
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ if !indicatorCounterFB.isDescendant(of: button_fb2) {
|
|
|
+ button_fb2.addSubview(indicatorCounterFB)
|
|
|
+ indicatorCounterFB.layer.cornerRadius = 7.5
|
|
|
+ indicatorCounterFB.layer.masksToBounds = true
|
|
|
+ indicatorCounterFB.backgroundColor = .systemRed
|
|
|
+ indicatorCounterFB.anchor(top: button_fb2.topAnchor, left: button_fb2.leftAnchor, height: 15, minWidth: 15, maxWidth: 20)
|
|
|
+ indicatorCounterFB.addSubview(labelCounterFB)
|
|
|
+ labelCounterFB.anchor(left: indicatorCounterFB.leftAnchor, right: indicatorCounterFB.rightAnchor, paddingLeft: 5, paddingRight: 5, centerX: indicatorCounterFB.centerXAnchor, centerY: indicatorCounterFB.centerYAnchor)
|
|
|
+ labelCounterFB.font = .systemFont(ofSize: 10)
|
|
|
+ labelCounterFB.textColor = .white
|
|
|
+ }
|
|
|
+ if !indicatorCounterFBBig.isDescendant(of: nexilis_button){
|
|
|
+ nexilis_button.addSubview(indicatorCounterFBBig)
|
|
|
+ indicatorCounterFBBig.tintColor = .systemRed
|
|
|
+ indicatorCounterFBBig.image = UIImage(systemName: "staroflife.circle.fill")
|
|
|
+ indicatorCounterFBBig.anchor(top: nexilis_button.topAnchor, left: nexilis_button.leftAnchor, paddingTop: 5, paddingLeft: 5, width: 15, height: 15)
|
|
|
+ }
|
|
|
+ labelCounterFB.text = "\(counter)"
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ DispatchQueue.main.async { [self] in
|
|
|
+ if indicatorCounterFB.isDescendant(of: button_fb2) {
|
|
|
+ indicatorCounterFB.removeFromSuperview()
|
|
|
+ }
|
|
|
+ if indicatorCounterFBBig.isDescendant(of: nexilis_button) {
|
|
|
+ indicatorCounterFBBig.removeFromSuperview()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -176,148 +355,132 @@ public class FloatingButton: UIView {
|
|
|
})
|
|
|
return counter ?? 0
|
|
|
}
|
|
|
-
|
|
|
- private func setTopConstraint(constant: CGFloat) {
|
|
|
- topConstraint.constant = constant
|
|
|
- }
|
|
|
-
|
|
|
- private func addIndicatorCounterFB(counter: Int32) {
|
|
|
- self.addSubview(indicatorCounterFB)
|
|
|
- indicatorCounterFB.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- indicatorCounterFB.backgroundColor = .systemRed
|
|
|
- indicatorCounterFB.layer.cornerRadius = 7.5
|
|
|
- indicatorCounterFB.clipsToBounds = true
|
|
|
- indicatorCounterFB.layer.borderWidth = 0.5
|
|
|
- indicatorCounterFB.layer.borderColor = UIColor.secondaryColor.cgColor
|
|
|
- if self.isShow {
|
|
|
- self.topConstraint = indicatorCounterFB.topAnchor.constraint(equalTo: self.topAnchor, constant: 60)
|
|
|
- } else {
|
|
|
- self.topConstraint = indicatorCounterFB.topAnchor.constraint(equalTo: self.topAnchor, constant: 10)
|
|
|
- }
|
|
|
- NSLayoutConstraint.activate([
|
|
|
- self.topConstraint,
|
|
|
- indicatorCounterFB.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 3),
|
|
|
- indicatorCounterFB.widthAnchor.constraint(greaterThanOrEqualToConstant: 15),
|
|
|
- indicatorCounterFB.heightAnchor.constraint(equalToConstant: 15)
|
|
|
- ])
|
|
|
-
|
|
|
- indicatorCounterFB.addSubview(labelCounter)
|
|
|
- labelCounter.translatesAutoresizingMaskIntoConstraints = false
|
|
|
- NSLayoutConstraint.activate([
|
|
|
- labelCounter.leadingAnchor.constraint(equalTo: indicatorCounterFB.leadingAnchor, constant: 2),
|
|
|
- labelCounter.trailingAnchor.constraint(equalTo: indicatorCounterFB.trailingAnchor, constant: -2),
|
|
|
- labelCounter.centerXAnchor.constraint(equalTo: indicatorCounterFB.centerXAnchor),
|
|
|
- ])
|
|
|
- labelCounter.font = UIFont.systemFont(ofSize: 11)
|
|
|
- if counter > 99 {
|
|
|
- labelCounter.text = "99+"
|
|
|
- } else {
|
|
|
- labelCounter.text = "\(counter)"
|
|
|
- }
|
|
|
- labelCounter.textColor = .secondaryColor
|
|
|
- labelCounter.textAlignment = .center
|
|
|
- }
|
|
|
|
|
|
@objc func qmeraTap() {
|
|
|
show(isShow: !isShow)
|
|
|
}
|
|
|
|
|
|
- @objc func qmeraLongPress() {
|
|
|
- let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "settingNav") as! UINavigationController
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
- navigationController.navigationBar.tintColor = .white
|
|
|
- navigationController.navigationBar.barTintColor = .mainColor
|
|
|
- navigationController.navigationBar.isTranslucent = false
|
|
|
- let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
- navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
- navigationController.view.backgroundColor = .mainColor
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
- }
|
|
|
-
|
|
|
- @objc func ccTap() {
|
|
|
+ @objc func tapMoreApp(_ sender: UIButton) {
|
|
|
+ let id = sender.restorationIdentifier
|
|
|
let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
|
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: "Cancel".localized(), style: .destructive, handler: {_ in
|
|
|
-
|
|
|
- }))
|
|
|
alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
|
|
|
let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
|
navigationController.navigationBar.isTranslucent = false
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- self.show(isShow: false)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.dismiss(animated: true, completion: nil)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
}))
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(alert, 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
return
|
|
|
}
|
|
|
- var isOfficer = false
|
|
|
- Database.shared.database?.inTransaction({ (fmdb, rollback) in
|
|
|
- let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
- if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT user_type, image_id FROM BUDDY where f_pin='\(idMe!)'"), cursorData.next() {
|
|
|
- if cursorData.string(forColumnIndex: 0) == "24" {
|
|
|
- isOfficer = true
|
|
|
+ if id == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if let url = URL(string: "itms-apps://apple.com/app/\(id!)") {
|
|
|
+ UIApplication.shared.open(url)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func fb1Tap() {
|
|
|
+ let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
|
+ 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: "changeNS") as! ChangeNamePassswordViewController
|
|
|
+ let navigationController = UINavigationController(rootViewController: controller)
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
+ navigationController.navigationBar.tintColor = .white
|
|
|
+ navigationController.navigationBar.barTintColor = .mainColor
|
|
|
+ navigationController.navigationBar.isTranslucent = false
|
|
|
+ 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)
|
|
|
}
|
|
|
- cursorData.close()
|
|
|
- return
|
|
|
+ }))
|
|
|
+ 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)
|
|
|
}
|
|
|
- })
|
|
|
- show(isShow: false)
|
|
|
- if isOfficer {
|
|
|
- let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
|
|
|
- controller.isOfficer = true
|
|
|
- let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.navigationBar.tintColor = .white
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
- navigationController.navigationBar.barTintColor = .mainColor
|
|
|
- navigationController.navigationBar.isTranslucent = false
|
|
|
- let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
- navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
- navigationController.view.backgroundColor = .mainColor
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ hideButton()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
|
|
|
+ if isWaitingRequestCC {
|
|
|
+ let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
|
|
|
+ imageView.tintColor = .white
|
|
|
+ let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
|
|
|
+ banner.show()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
|
|
|
+ controller.isContactCenter = true
|
|
|
+ let navigationController = UINavigationController(rootViewController: controller)
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
+ navigationController.navigationBar.tintColor = .white
|
|
|
+ navigationController.navigationBar.barTintColor = .mainColor
|
|
|
+ navigationController.navigationBar.isTranslucent = false
|
|
|
+ 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 {
|
|
|
- let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
|
|
|
- controller.isContactCenter = true
|
|
|
- let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
}
|
|
|
-
|
|
|
+ hideButton()
|
|
|
}
|
|
|
|
|
|
- @objc func streamTap() {
|
|
|
+ @objc func fb2Tap() {
|
|
|
let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
|
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: "Cancel".localized(), style: .destructive, handler: {_ in
|
|
|
-
|
|
|
- }))
|
|
|
alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
|
|
|
let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
|
navigationController.navigationBar.isTranslucent = false
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- self.show(isShow: false)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.dismiss(animated: true, completion: nil)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
}))
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(alert, 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
return
|
|
|
}
|
|
|
- show(isShow: false)
|
|
|
- let navigationController = UINavigationController(rootViewController: QmeraCreateStreamingViewController())
|
|
|
+ let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
|
|
|
navigationController.modalPresentationStyle = .fullScreen
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
@@ -325,34 +488,42 @@ public class FloatingButton: UIView {
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
}
|
|
|
|
|
|
- @objc func callTap() {
|
|
|
+ @objc func fb3Tap() {
|
|
|
let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
|
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: "Cancel".localized(), style: .destructive, handler: {_ in
|
|
|
-
|
|
|
- }))
|
|
|
alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
|
|
|
let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
|
navigationController.navigationBar.isTranslucent = false
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- self.show(isShow: false)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.dismiss(animated: true, completion: nil)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
}))
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(alert, 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
return
|
|
|
}
|
|
|
- show(isShow: false)
|
|
|
let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID")
|
|
|
let navigationController = UINavigationController(rootViewController: callContact)
|
|
|
navigationController.modalPresentationStyle = .fullScreen
|
|
@@ -362,64 +533,110 @@ public class FloatingButton: UIView {
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
}
|
|
|
|
|
|
- @objc func chatTap() {
|
|
|
+ @objc func fb4Tap() {
|
|
|
let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
|
|
|
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: "Cancel".localized(), style: .destructive, handler: {_ in
|
|
|
-
|
|
|
- }))
|
|
|
alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
|
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
|
|
|
let navigationController = UINavigationController(rootViewController: controller)
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
|
navigationController.navigationBar.isTranslucent = false
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- self.show(isShow: false)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.dismiss(animated: true, completion: nil)
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
}))
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(alert, 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
return
|
|
|
}
|
|
|
- show(isShow: false)
|
|
|
- let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
|
|
|
- navigationController.modalPresentationStyle = .fullScreen
|
|
|
+ let navigationController = UINavigationController(rootViewController: QmeraCreateStreamingViewController())
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
navigationController.navigationBar.tintColor = .white
|
|
|
navigationController.navigationBar.barTintColor = .mainColor
|
|
|
navigationController.navigationBar.isTranslucent = false
|
|
|
let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
navigationController.view.backgroundColor = .mainColor
|
|
|
- UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
}
|
|
|
|
|
|
- public func show(isShow: Bool) {
|
|
|
- self.isShow = isShow
|
|
|
- if self.isShow {
|
|
|
- self.setTopConstraint(constant: 60)
|
|
|
+ @objc func qmeraLongPress() {
|
|
|
+ let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "settingNav") as! UINavigationController
|
|
|
+ navigationController.modalPresentationStyle = .custom
|
|
|
+ navigationController.navigationBar.tintColor = .white
|
|
|
+ navigationController.navigationBar.barTintColor = .mainColor
|
|
|
+ navigationController.navigationBar.isTranslucent = false
|
|
|
+ let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
+ navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
+ navigationController.view.backgroundColor = .mainColor
|
|
|
+ UIApplication.shared.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ hideButton()
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func hideButton() {
|
|
|
+ if isShow {
|
|
|
+ show(isShow: false)
|
|
|
+ }
|
|
|
+ if self.frame.origin.x < UIScreen.main.bounds.width / 2 - 30 {
|
|
|
+ self.frame.origin.x = 0
|
|
|
} else {
|
|
|
- self.setTopConstraint(constant: 10)
|
|
|
+ self.frame.origin.x = UIScreen.main.bounds.width - 50
|
|
|
}
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "updateShowButton"), object: nil, userInfo: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ public func show(isShow: Bool) {
|
|
|
+ self.isShow = isShow
|
|
|
if isShow {
|
|
|
- let height = frame.width * 5
|
|
|
- var yPosition = frame.origin.y - height + frame.width
|
|
|
- if center.y < (UIScreen.main.bounds.height / 5) + 100 {
|
|
|
+ pullButton()
|
|
|
+ if indicatorCounterFBBig.isDescendant(of: nexilis_button) {
|
|
|
+ indicatorCounterFBBig.isHidden = true
|
|
|
+ }
|
|
|
+ let height = CGFloat(217) //40
|
|
|
+ var yPosition = frame.origin.y - height + 50
|
|
|
+ if yPosition <= 25 {
|
|
|
lastPosY = frame.origin.y
|
|
|
- yPosition = UIScreen.main.bounds.height / 5 - 120
|
|
|
+ yPosition = 25
|
|
|
}
|
|
|
frame = CGRect(x: frame.origin.x, y: yPosition, width: frame.width, height: height)
|
|
|
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { [self] in
|
|
|
+ if isShow {
|
|
|
+ let countSubviewsAfter = groupView.subviews.count
|
|
|
+ if countSubviewsAfter > 5 {
|
|
|
+ scrollView.flashScrollIndicators()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
} else {
|
|
|
- let height = frame.width * 5
|
|
|
- var yPosition = frame.origin.y + height - frame.width
|
|
|
+ if indicatorCounterFBBig.isDescendant(of: nexilis_button) {
|
|
|
+ indicatorCounterFBBig.isHidden = false
|
|
|
+ }
|
|
|
+ let height = CGFloat(217) //40
|
|
|
+ var yPosition = frame.origin.y + height - 50
|
|
|
if lastPosY != nil {
|
|
|
yPosition = lastPosY!
|
|
|
}
|