ソースを参照

update side tab

alqindiirsyam 1 年間 前
コミット
c3ea9a26fd

+ 105 - 62
appbuilder-ios/DigiXLite/DigiXLite/Source/FloatingButton/FloatingButton.swift

@@ -40,6 +40,8 @@ public class FloatingButton: UIView {
     let defaultWidthHeightMenuFB = (UIScreen.main.bounds.height * 0.45) / 7.5
     let widthFBAnim = (UIScreen.main.bounds.height * 1) / 7.5
     let heightFBAnim = (UIScreen.main.bounds.height * 1) / 7.5
+    let heightFBSideTab = (UIScreen.main.bounds.height * 1.05) / 7.5
+    let widthFBSideTab: CGFloat = 18
     
     var countMenuFB: CGFloat = 5 {
         didSet {
@@ -70,7 +72,7 @@ public class FloatingButton: UIView {
         nexilis_button = UIImageView()
         nexilis_button.translatesAutoresizingMaskIntoConstraints = false
         nexilis_button.isUserInteractionEnabled = true
-        if !Utils.getIconDock().isEmpty {
+        if !Utils.getIconDock().isEmpty && Utils.getConfigModeFB() != "1" {
             var dataImage: Data?
             if Utils.getConfigModeFB() == "2" || Utils.getConfigModeFB() == "4" {
                 defaultWidthFB = widthFBAnim
@@ -93,11 +95,15 @@ public class FloatingButton: UIView {
                 }
             }
         } else {
-            nexilis_button.image = UIImage(named: "pb_button", in: Bundle.resourceBundle(for: DigiX.self), with: nil)
+            if Utils.getConfigModeFB() == "1" {
+                defaultWidthFB = widthFBSideTab
+                defaultHeightFB = heightFBSideTab
+            }
+            nexilis_button.image = UIImage(named: Utils.getConfigModeFB() != "1" ? "pb_button" : "pb_side_tab", in: Bundle.resourceBundle(for: DigiX.self), with: nil)
         }
         
         backgroundColor = .clear
-        frame = CGRect(x: UIScreen.main.bounds.width - defaultWidthFB, y: (UIScreen.main.bounds.height / 2) - defaultHeightFB, width: defaultWidthFB, height: defaultHeightFB)
+        frame = CGRect(x: UIScreen.main.bounds.width - defaultWidthFB, y: (UIScreen.main.bounds.height / 2) - defaultHeightFB, width: Utils.getConfigModeFB() == "1" ? UIScreen.main.bounds.width - defaultWidthFB : defaultWidthFB, height: defaultHeightFB)
         
         let qmeraTap = UITapGestureRecognizer(target: self, action: #selector(qmeraTap))
         qmeraTap.numberOfTouchesRequired = 1
@@ -122,28 +128,45 @@ public class FloatingButton: UIView {
 //        scrollView.backgroundColor = .black.withAlphaComponent(0.25)
         addSubview(scrollView)
         
-        scrollView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB + 10).isActive = true
-        scrollView.topAnchor.constraint(equalTo: topAnchor).isActive = true
-        if Utils.getConfigModeFB() == "2" {
-            scrollView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
-            scrollView.leftAnchor.constraint(equalTo: nexilis_button.rightAnchor, constant: -20).isActive = true
-            scrollView.isHidden = true
+        if Utils.getConfigModeFB() != "1" {
+            scrollView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB + 10).isActive = true
+            scrollView.topAnchor.constraint(equalTo: topAnchor).isActive = true
+            if Utils.getConfigModeFB() == "2" {
+                scrollView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
+                scrollView.leftAnchor.constraint(equalTo: nexilis_button.rightAnchor, constant: -20).isActive = true
+                scrollView.isHidden = true
+            } else {
+                scrollView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
+                scrollView.bottomAnchor.constraint(equalTo: nexilis_button.topAnchor).isActive = true
+            }
         } else {
-            scrollView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
-            scrollView.bottomAnchor.constraint(equalTo: nexilis_button.topAnchor).isActive = true
+            scrollView.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width - defaultWidthFB).isActive = true
+            scrollView.heightAnchor.constraint(equalToConstant: defaultHeightFB).isActive = true
+            scrollView.leftAnchor.constraint(equalTo: nexilis_button.rightAnchor).isActive = true
+            scrollView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
+            scrollView.backgroundColor = .black.withAlphaComponent(0.25)
         }
         
         groupView = UIStackView()
         groupView.translatesAutoresizingMaskIntoConstraints = false
-        groupView.axis = .vertical
-        groupView.distribution = .fillEqually
+        groupView.axis = Utils.getConfigModeFB() != "1" ? .vertical : .horizontal
+        if Utils.getConfigModeFB() != "1" {
+            groupView.distribution = .fillEqually
+        }
 
         scrollView.addSubview(groupView)
 
-        groupView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).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
+        if Utils.getConfigModeFB() != "1" {
+            groupView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).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
+        } else {
+            groupView.leftAnchor.constraint(equalTo: scrollView.leftAnchor).isActive = true
+            groupView.rightAnchor.constraint(equalTo: scrollView.rightAnchor).isActive = true
+            groupView.centerYAnchor.constraint(equalTo: scrollView.centerYAnchor).isActive = true
+            groupView.heightAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
+        }
         
         pullButton()
         
@@ -170,7 +193,7 @@ public class FloatingButton: UIView {
             return
         }
         DispatchQueue.global().async { [self] in
-            if !Utils.getCustomButtons().isEmpty {
+            if !Utils.getCustomButtons().isEmpty && Utils.getConfigModeFB() != "1" && Utils.getConfigModeFB() != "4" {
                 DispatchQueue.main.async { [self] in
                     groupView.subviews.forEach({ $0.removeFromSuperview() })
                     let customButtons = Utils.getCustomButtons().components(separatedBy: ",")
@@ -219,34 +242,43 @@ public class FloatingButton: UIView {
                                         let package_id = json["package_id"] as! String
                                         let app_id = (json["app_id"] as? String) ?? ""
                                         let icon = (json["icon"] as? String) ?? ""
+                                        let mode = (json["mode"] as? Int) ?? 1
                                         let newButton = UIButton()
-                                        newButton.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
+                                        if mode != Int(Utils.getConfigModeFB()) {
+                                            continue
+                                        }
+                                        if mode == 1 {
+                                            newButton.widthAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
+                                            newButton.heightAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
+                                        } else {
+                                            newButton.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
+                                        }
                                         newButton.translatesAutoresizingMaskIntoConstraints = false
-                                        if icon.isEmpty {
-                                            var indexTap = 0
-                                            if package_id.contains("_fb"){
-                                                indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
-                                            }
-                                            if indexTap == DigiX.IDX_CHAT {
-                                                newButton.setImage(UIImage(named: "pb_button_chat", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_CALL {
-                                                newButton.setImage(UIImage(named: "pb_button_call", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_CC {
-                                                newButton.setImage(UIImage(named: "pb_button_cc", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_STREAM {
-                                                newButton.setImage(UIImage(named: "pb_button_stream", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_SOCIAL_COMMERCE {
-                                                newButton.setImage(UIImage(named: "pb_button_commerce", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_NEWS {
-                                                newButton.setImage(UIImage(named: "pb_button_news", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_POST {
-                                                newButton.setImage(UIImage(named: "pb_button_post", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else if indexTap == DigiX.IDX_NOTIF_CENTER {
-                                                newButton.setImage(UIImage(named: "pb_button_notification", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            } else {
-                                                newButton.setImage(UIImage(named: "pb_button_others", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
-                                            }
+                                        var indexTap = 0
+                                        if package_id.contains("_fb"){
+                                            indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                                        }
+                                        if indexTap == DigiX.IDX_CHAT {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_chat" : "pb_button_chat", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_CALL {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_call" : "pb_button_call", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_CC {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_cc" : "pb_button_cc", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_STREAM {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_stream" : "pb_button_stream", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_SOCIAL_COMMERCE {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_social_commerce" : "pb_button_commerce", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_NEWS {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_news" : "pb_button_news", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_POST {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_post" : "pb_button_post", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        } else if indexTap == DigiX.IDX_NOTIF_CENTER {
+                                            print("MASUK SINI \(indexTap) <> \(mode == 1)")
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_notif_center" : "pb_button_notification", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
                                         } else {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_more" : "pb_button_others", in: Bundle.resourceBundle(for: DigiX.self), with: nil), for: .normal)
+                                        }
+                                        if !icon.isEmpty {
                                             DispatchQueue.global().async {
                                                 let data = try? Data(contentsOf: URL(string: "https://newuniverse.io/get_file?account=\(DigiX.sAPIKey)&image=\(icon)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
                                                 DispatchQueue.main.async {
@@ -315,27 +347,26 @@ public class FloatingButton: UIView {
         let size = UIScreen.main.bounds
         let widthScreen = size.width
         let heightScreen = size.height
-        let minimumx = (widthScreen + 30) - widthScreen
-        var maximumx = widthScreen - 30
+        let minimumx: CGFloat = Utils.getConfigModeFB() == "2" && isShow ? 60 : 40
+        let maximumx = Utils.getConfigModeFB() == "2" && isShow ? widthScreen - 10 - defaultWidthHeightMenuFB : widthScreen - 40
+        let maxMinXSideTab = isShow ? center.x : widthScreen + (center.x - widthScreen)
         let translation = sender.translation(in: self)
         var xPos = center.x + translation.x
         var yPos = center.y + translation.y
         bringSubviewToFront(self)
-        if (xPos < minimumx) {
-            xPos = minimumx
-        }
-        if (xPos > maximumx) {
-            xPos = maximumx
+        if Utils.getConfigModeFB() != "1" {
+            if (xPos < minimumx) {
+                xPos = minimumx
+            }
+            if (xPos > maximumx) {
+                xPos = maximumx
+            }
+        } else {
+            xPos = maxMinXSideTab
         }
         if(isShow) {
-            if Utils.getConfigModeFB() == "2" {
-                maximumx = widthScreen - 10 - defaultWidthHeightMenuFB
-                if (xPos > maximumx) {
-                    xPos = maximumx
-                }
-            }
-            let minimumy = (defaultWidthHeightMenuFB * countMenuFB) - defaultHeightFB - 10
-            let maximumy = heightScreen - defaultHeightFB - 10
+            let minimumy = Utils.getConfigModeFB() == "1" ? 50 : (defaultWidthHeightMenuFB * countMenuFB) - defaultHeightFB - 10
+            let maximumy = Utils.getConfigModeFB() == "1" ? heightScreen - 50 : heightScreen - defaultHeightFB - 10
             if(yPos < minimumy) {
                 yPos = minimumy
             }
@@ -343,8 +374,8 @@ public class FloatingButton: UIView {
                 yPos = maximumy
             }
         } else {
-            let minimumy = defaultHeightFB - 50
-            let maximumy = heightScreen - defaultHeightFB + 50
+            let minimumy: CGFloat = 50
+            let maximumy = heightScreen - 50
             if(yPos < minimumy) {
                 yPos = minimumy
             }
@@ -506,7 +537,13 @@ public class FloatingButton: UIView {
                 lastPosY = frame.origin.y
                 yPosition = 25
             }
-            frame = CGRect(x: xPosition, y: yPosition, width: width, height: height)
+            if Utils.getConfigModeFB() != "1" {
+                frame = CGRect(x: xPosition, y: yPosition, width: width, height: height)
+            } else {
+                UIView.animate(withDuration: 0.5, animations: {
+                    self.frame.origin.x = 0
+                })
+            }
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { [self] in
                 if isShow {
                     let countSubviewsAfter = groupView.subviews.count
@@ -528,7 +565,13 @@ public class FloatingButton: UIView {
             if lastPosY != nil {
                 yPosition = lastPosY!
             }
-            frame = CGRect(x: frame.origin.x, y: yPosition, width: defaultWidthFB, height: defaultHeightFB)
+            if Utils.getConfigModeFB() != "1" {
+                frame = CGRect(x: frame.origin.x, y: yPosition, width: defaultWidthFB, height: defaultHeightFB)
+            } else {
+                UIView.animate(withDuration: 0.5, animations: { [self] in
+                    frame.origin.x = UIScreen.main.bounds.width - defaultWidthFB
+                })
+            }
         }
     }
 }

+ 105 - 62
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -40,6 +40,8 @@ public class FloatingButton: UIView {
     let defaultWidthHeightMenuFB = (UIScreen.main.bounds.height * 0.45) / 7.5
     let widthFBAnim = (UIScreen.main.bounds.height * 1) / 7.5
     let heightFBAnim = (UIScreen.main.bounds.height * 1) / 7.5
+    let heightFBSideTab = (UIScreen.main.bounds.height * 1.05) / 7.5
+    let widthFBSideTab: CGFloat = 18
     
     var countMenuFB: CGFloat = 5 {
         didSet {
@@ -70,7 +72,7 @@ public class FloatingButton: UIView {
         nexilis_button = UIImageView()
         nexilis_button.translatesAutoresizingMaskIntoConstraints = false
         nexilis_button.isUserInteractionEnabled = true
-        if !Utils.getIconDock().isEmpty {
+        if !Utils.getIconDock().isEmpty && Utils.getConfigModeFB() != "1" {
             var dataImage: Data?
             if Utils.getConfigModeFB() == "2" || Utils.getConfigModeFB() == "4" {
                 defaultWidthFB = widthFBAnim
@@ -93,11 +95,15 @@ public class FloatingButton: UIView {
                 }
             }
         } else {
-            nexilis_button.image = UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
+            if Utils.getConfigModeFB() == "1" {
+                defaultWidthFB = widthFBSideTab
+                defaultHeightFB = heightFBSideTab
+            }
+            nexilis_button.image = UIImage(named: Utils.getConfigModeFB() != "1" ? "pb_button" : "pb_side_tab", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)
         }
         
         backgroundColor = .clear
-        frame = CGRect(x: UIScreen.main.bounds.width - defaultWidthFB, y: (UIScreen.main.bounds.height / 2) - defaultHeightFB, width: defaultWidthFB, height: defaultHeightFB)
+        frame = CGRect(x: UIScreen.main.bounds.width - defaultWidthFB, y: (UIScreen.main.bounds.height / 2) - defaultHeightFB, width: Utils.getConfigModeFB() == "1" ? UIScreen.main.bounds.width - defaultWidthFB : defaultWidthFB, height: defaultHeightFB)
         
         let qmeraTap = UITapGestureRecognizer(target: self, action: #selector(qmeraTap))
         qmeraTap.numberOfTouchesRequired = 1
@@ -122,28 +128,45 @@ public class FloatingButton: UIView {
 //        scrollView.backgroundColor = .black.withAlphaComponent(0.25)
         addSubview(scrollView)
         
-        scrollView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB + 10).isActive = true
-        scrollView.topAnchor.constraint(equalTo: topAnchor).isActive = true
-        if Utils.getConfigModeFB() == "2" {
-            scrollView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
-            scrollView.leftAnchor.constraint(equalTo: nexilis_button.rightAnchor, constant: -20).isActive = true
-            scrollView.isHidden = true
+        if Utils.getConfigModeFB() != "1" {
+            scrollView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB + 10).isActive = true
+            scrollView.topAnchor.constraint(equalTo: topAnchor).isActive = true
+            if Utils.getConfigModeFB() == "2" {
+                scrollView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
+                scrollView.leftAnchor.constraint(equalTo: nexilis_button.rightAnchor, constant: -20).isActive = true
+                scrollView.isHidden = true
+            } else {
+                scrollView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
+                scrollView.bottomAnchor.constraint(equalTo: nexilis_button.topAnchor).isActive = true
+            }
         } else {
-            scrollView.centerXAnchor.constraint(equalTo: centerXAnchor).isActive = true
-            scrollView.bottomAnchor.constraint(equalTo: nexilis_button.topAnchor).isActive = true
+            scrollView.widthAnchor.constraint(equalToConstant: UIScreen.main.bounds.width - defaultWidthFB).isActive = true
+            scrollView.heightAnchor.constraint(equalToConstant: defaultHeightFB).isActive = true
+            scrollView.leftAnchor.constraint(equalTo: nexilis_button.rightAnchor).isActive = true
+            scrollView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
+            scrollView.backgroundColor = .black.withAlphaComponent(0.25)
         }
         
         groupView = UIStackView()
         groupView.translatesAutoresizingMaskIntoConstraints = false
-        groupView.axis = .vertical
-        groupView.distribution = .fillEqually
+        groupView.axis = Utils.getConfigModeFB() != "1" ? .vertical : .horizontal
+        if Utils.getConfigModeFB() != "1" {
+            groupView.distribution = .fillEqually
+        }
 
         scrollView.addSubview(groupView)
 
-        groupView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).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
+        if Utils.getConfigModeFB() != "1" {
+            groupView.widthAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).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
+        } else {
+            groupView.leftAnchor.constraint(equalTo: scrollView.leftAnchor).isActive = true
+            groupView.rightAnchor.constraint(equalTo: scrollView.rightAnchor).isActive = true
+            groupView.centerYAnchor.constraint(equalTo: scrollView.centerYAnchor).isActive = true
+            groupView.heightAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
+        }
         
         pullButton()
         
@@ -170,7 +193,7 @@ public class FloatingButton: UIView {
             return
         }
         DispatchQueue.global().async { [self] in
-            if !Utils.getCustomButtons().isEmpty {
+            if !Utils.getCustomButtons().isEmpty && Utils.getConfigModeFB() != "1" && Utils.getConfigModeFB() != "4" {
                 DispatchQueue.main.async { [self] in
                     groupView.subviews.forEach({ $0.removeFromSuperview() })
                     let customButtons = Utils.getCustomButtons().components(separatedBy: ",")
@@ -219,34 +242,43 @@ public class FloatingButton: UIView {
                                         let package_id = json["package_id"] as! String
                                         let app_id = (json["app_id"] as? String) ?? ""
                                         let icon = (json["icon"] as? String) ?? ""
+                                        let mode = (json["mode"] as? Int) ?? 1
                                         let newButton = UIButton()
-                                        newButton.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
+                                        if mode != Int(Utils.getConfigModeFB()) {
+                                            continue
+                                        }
+                                        if mode == 1 {
+                                            newButton.widthAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
+                                            newButton.heightAnchor.constraint(equalToConstant: defaultHeightFB - 10).isActive = true
+                                        } else {
+                                            newButton.heightAnchor.constraint(equalToConstant: defaultWidthHeightMenuFB).isActive = true
+                                        }
                                         newButton.translatesAutoresizingMaskIntoConstraints = false
-                                        if icon.isEmpty {
-                                            var indexTap = 0
-                                            if package_id.contains("_fb"){
-                                                indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
-                                            }
-                                            if indexTap == Nexilis.IDX_CHAT {
-                                                newButton.setImage(UIImage(named: "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_CALL {
-                                                newButton.setImage(UIImage(named: "pb_button_call", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_CC {
-                                                newButton.setImage(UIImage(named: "pb_button_cc", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_STREAM {
-                                                newButton.setImage(UIImage(named: "pb_button_stream", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_SOCIAL_COMMERCE {
-                                                newButton.setImage(UIImage(named: "pb_button_commerce", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_NEWS {
-                                                newButton.setImage(UIImage(named: "pb_button_news", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_POST {
-                                                newButton.setImage(UIImage(named: "pb_button_post", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else if indexTap == Nexilis.IDX_NOTIF_CENTER {
-                                                newButton.setImage(UIImage(named: "pb_button_notification", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            } else {
-                                                newButton.setImage(UIImage(named: "pb_button_others", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
-                                            }
+                                        var indexTap = 0
+                                        if package_id.contains("_fb"){
+                                            indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                                        }
+                                        if indexTap == Nexilis.IDX_CHAT {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_chat" : "pb_button_chat", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+                                        } else if indexTap == Nexilis.IDX_CALL {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_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 == 1 ? "pb_button_hrz_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 == 1 ? "pb_button_hrz_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 == 1 ? "pb_button_hrz_social_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 == 1 ? "pb_button_hrz_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 == 1 ? "pb_button_hrz_post" : "pb_button_post", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+                                        } else if indexTap == Nexilis.IDX_NOTIF_CENTER {
+                                            print("MASUK SINI \(indexTap) <> \(mode == 1)")
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_notif_center" : "pb_button_notification", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
                                         } else {
+                                            newButton.setImage(UIImage(named: mode == 1 ? "pb_button_hrz_more" : "pb_button_others", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+                                        }
+                                        if !icon.isEmpty {
                                             DispatchQueue.global().async {
                                                 let data = try? Data(contentsOf: URL(string: "https://newuniverse.io/get_file?account=\(Nexilis.sAPIKey)&image=\(icon)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
                                                 DispatchQueue.main.async {
@@ -315,27 +347,26 @@ public class FloatingButton: UIView {
         let size = UIScreen.main.bounds
         let widthScreen = size.width
         let heightScreen = size.height
-        let minimumx = (widthScreen + 30) - widthScreen
-        var maximumx = widthScreen - 30
+        let minimumx: CGFloat = Utils.getConfigModeFB() == "2" && isShow ? 60 : 40
+        let maximumx = Utils.getConfigModeFB() == "2" && isShow ? widthScreen - 10 - defaultWidthHeightMenuFB : widthScreen - 40
+        let maxMinXSideTab = isShow ? center.x : widthScreen + (center.x - widthScreen)
         let translation = sender.translation(in: self)
         var xPos = center.x + translation.x
         var yPos = center.y + translation.y
         bringSubviewToFront(self)
-        if (xPos < minimumx) {
-            xPos = minimumx
-        }
-        if (xPos > maximumx) {
-            xPos = maximumx
+        if Utils.getConfigModeFB() != "1" {
+            if (xPos < minimumx) {
+                xPos = minimumx
+            }
+            if (xPos > maximumx) {
+                xPos = maximumx
+            }
+        } else {
+            xPos = maxMinXSideTab
         }
         if(isShow) {
-            if Utils.getConfigModeFB() == "2" {
-                maximumx = widthScreen - 10 - defaultWidthHeightMenuFB
-                if (xPos > maximumx) {
-                    xPos = maximumx
-                }
-            }
-            let minimumy = (defaultWidthHeightMenuFB * countMenuFB) - defaultHeightFB - 10
-            let maximumy = heightScreen - defaultHeightFB - 10
+            let minimumy = Utils.getConfigModeFB() == "1" ? 50 : (defaultWidthHeightMenuFB * countMenuFB) - defaultHeightFB - 10
+            let maximumy = Utils.getConfigModeFB() == "1" ? heightScreen - 50 : heightScreen - defaultHeightFB - 10
             if(yPos < minimumy) {
                 yPos = minimumy
             }
@@ -343,8 +374,8 @@ public class FloatingButton: UIView {
                 yPos = maximumy
             }
         } else {
-            let minimumy = defaultHeightFB - 50
-            let maximumy = heightScreen - defaultHeightFB + 50
+            let minimumy: CGFloat = 50
+            let maximumy = heightScreen - 50
             if(yPos < minimumy) {
                 yPos = minimumy
             }
@@ -506,7 +537,13 @@ public class FloatingButton: UIView {
                 lastPosY = frame.origin.y
                 yPosition = 25
             }
-            frame = CGRect(x: xPosition, y: yPosition, width: width, height: height)
+            if Utils.getConfigModeFB() != "1" {
+                frame = CGRect(x: xPosition, y: yPosition, width: width, height: height)
+            } else {
+                UIView.animate(withDuration: 0.5, animations: {
+                    self.frame.origin.x = 0
+                })
+            }
             DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: { [self] in
                 if isShow {
                     let countSubviewsAfter = groupView.subviews.count
@@ -528,7 +565,13 @@ public class FloatingButton: UIView {
             if lastPosY != nil {
                 yPosition = lastPosY!
             }
-            frame = CGRect(x: frame.origin.x, y: yPosition, width: defaultWidthFB, height: defaultHeightFB)
+            if Utils.getConfigModeFB() != "1" {
+                frame = CGRect(x: frame.origin.x, y: yPosition, width: defaultWidthFB, height: defaultHeightFB)
+            } else {
+                UIView.animate(withDuration: 0.5, animations: { [self] in
+                    frame.origin.x = UIScreen.main.bounds.width - defaultWidthFB
+                })
+            }
         }
     }
 }