|
@@ -202,6 +202,9 @@ public class FloatingButton: UIView {
|
|
|
banner.show()
|
|
|
return
|
|
|
}
|
|
|
+ if groupView.subviews.count == 0 {
|
|
|
+ getDefaultButton()
|
|
|
+ }
|
|
|
DispatchQueue.global().async { [self] in
|
|
|
if !Utils.getCustomButtons().isEmpty && Utils.getConfigModeFB() != MODE_HORIZONTAL_SIDE_TAB && Utils.getConfigModeFB() != MODE_HORIZONTAL_ANIMATION {
|
|
|
DispatchQueue.main.async { [self] in
|
|
@@ -229,10 +232,6 @@ public class FloatingButton: UIView {
|
|
|
newButton.accessibilityIdentifier = app_id
|
|
|
newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
|
|
|
}
|
|
|
- let countSubviewsAfter = groupView.subviews.count
|
|
|
- if countSubviewsAfter <= 4 {
|
|
|
- scrollView.isScrollEnabled = false
|
|
|
- }
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -278,6 +277,8 @@ public class FloatingButton: UIView {
|
|
|
}
|
|
|
if indexTap == Nexilis.IDX_CHAT {
|
|
|
newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_chat" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_chat" : "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_CONVERSATION {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_conversation" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_conversation" : "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
} else if indexTap == Nexilis.IDX_CALL {
|
|
|
newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_call" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_call" : "pb_button_call", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
} else if indexTap == Nexilis.IDX_CC {
|
|
@@ -311,10 +312,6 @@ public class FloatingButton: UIView {
|
|
|
newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
|
|
|
}
|
|
|
}
|
|
|
- let countSubviewsAfter = groupView.subviews.count
|
|
|
- if countSubviewsAfter <= 4 {
|
|
|
- scrollView.isScrollEnabled = false
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -330,34 +327,47 @@ public class FloatingButton: UIView {
|
|
|
}
|
|
|
|
|
|
func getDefaultButton() {
|
|
|
- button_fb1 = UIButton()
|
|
|
- button_fb1.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).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: defaultWidthHeightMenuFB).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: defaultWidthHeightMenuFB).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: defaultWidthHeightMenuFB).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)
|
|
|
+ let data = [Nexilis.IDX_NOTIF_CENTER, Nexilis.IDX_CC, Nexilis.IDX_CONVERSATION, Nexilis.IDX_CALL, Nexilis.IDX_STREAM]
|
|
|
+ for i in 0..<data.count {
|
|
|
+ let newButton = UIButton()
|
|
|
+ let mode = Utils.getConfigModeFB()
|
|
|
+ if mode == MODE_HORIZONTAL_SIDE_TAB {
|
|
|
+ newButton.widthAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
|
|
|
+ newButton.heightAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
|
|
|
+ } else if mode == MODE_HORIZONTAL_ANIMATION {
|
|
|
+ newButton.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
|
|
|
+ newButton.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
|
|
|
+ } else {
|
|
|
+ newButton.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
|
|
|
+ }
|
|
|
+ newButton.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ let indexTap = data[i]
|
|
|
+ if indexTap == Nexilis.IDX_CHAT {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_chat" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_chat" : "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_CONVERSATION {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_conversation" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_conversation" : "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_CALL {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_call" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_call" : "pb_button_call", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_CC {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_cc" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_cc" : "pb_button_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_STREAM {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_stream" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_stream" : "pb_button_stream", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_SOCIAL_COMMERCE {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_social_commerce" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_commerce" : "pb_button_commerce", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_NEWS {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_news" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_news" : "pb_button_news", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_POST {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_post" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_post" : "pb_button_post", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else if indexTap == Nexilis.IDX_NOTIF_CENTER {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_notif_center" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_notif_center" : "pb_button_notification", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ } else {
|
|
|
+ newButton.setImage(UIImage(named: mode == MODE_HORIZONTAL_SIDE_TAB ? "pb_button_hrz_more" : mode == MODE_HORIZONTAL_ANIMATION ? "pb_button_hrz_anim_more" : "pb_button_others", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
|
|
|
+ }
|
|
|
+ groupView.addArrangedSubview(newButton)
|
|
|
+ newButton.restorationIdentifier = "default_fb\(data[i])"
|
|
|
+ newButton.accessibilityIdentifier = ""
|
|
|
+ newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@objc func draggedView(_ sender:UIPanGestureRecognizer){
|