|
@@ -60,13 +60,20 @@ public class FloatingButton: UIView {
|
|
|
nexilis_button = UIImageView()
|
|
|
nexilis_button.translatesAutoresizingMaskIntoConstraints = false
|
|
|
nexilis_button.isUserInteractionEnabled = true
|
|
|
- nexilis_button.image = UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
|
|
|
+ if Utils.getIconDock() != nil {
|
|
|
+ let dataImage = try? Data(contentsOf: URL(string: Utils.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
|
|
|
+ if dataImage != nil {
|
|
|
+ nexilis_button.image = UIImage(data: dataImage!)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ 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
|
|
|
nexilis_button.addGestureRecognizer(qmeraTap)
|
|
|
|
|
|
- let qmeraLongPress = UILongPressGestureRecognizer(target: self, action: #selector(qmeraLongPress))
|
|
|
+ let qmeraLongPress = UILongPressGestureRecognizer(target: self, action: #selector(qmeraLongPress(gestureRecognizer:)))
|
|
|
nexilis_button.addGestureRecognizer(qmeraLongPress)
|
|
|
|
|
|
addSubview(nexilis_button)
|
|
@@ -735,21 +742,23 @@ public class FloatingButton: UIView {
|
|
|
hideButton()
|
|
|
}
|
|
|
|
|
|
- @objc func qmeraLongPress() {
|
|
|
- if mySettingDelegate != nil {
|
|
|
- mySettingDelegate?.settingDelegate()
|
|
|
- } else {
|
|
|
- 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.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ @objc func qmeraLongPress(gestureRecognizer: UILongPressGestureRecognizer) {
|
|
|
+ if gestureRecognizer.state == .began {
|
|
|
+ if mySettingDelegate != nil {
|
|
|
+ mySettingDelegate?.settingDelegate()
|
|
|
+ } else {
|
|
|
+ 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.rootViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
+ }
|
|
|
+ hideButton()
|
|
|
}
|
|
|
- hideButton()
|
|
|
}
|
|
|
|
|
|
@objc func hideButton() {
|