alqindiirsyam 1 éve
szülő
commit
458a849c19

+ 1 - 1
appbuilder-ios/AppBuilder/AppBuilder/AppDelegate.swift

@@ -17,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             showButton = true
             showButton = true
         }
         }
         Nexilis.isShowForceSignIn = false
         Nexilis.isShowForceSignIn = false
-        Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: showButton, fromMAB: true) //23091CF494A11149F5A8FC8D17FF690DC69AE656F91B86070A11506ED24144F5(BPKH) //38747683290F62E9667A018F490396EAE47BC16ADECD85B7E865C733E6DBD6A2(OneApp)
+        Nexilis.connect(apiKey: "38747683290F62E9667A018F490396EAE47BC16ADECD85B7E865C733E6DBD6A2", delegate: self, showButton: showButton, fromMAB: true) //23091CF494A11149F5A8FC8D17FF690DC69AE656F91B86070A11506ED24144F5(BPKH) //38747683290F62E9667A018F490396EAE47BC16ADECD85B7E865C733E6DBD6A2(OneApp)
         registerForPushNotifications()
         registerForPushNotifications()
         return true
         return true
     }
     }

+ 1 - 1
appbuilder-ios/AppBuilder/AppBuilder/PrefsUtil.swift

@@ -13,7 +13,7 @@ class PrefsUtil {
     static let CPAAS_MODE_DOCKED = 1
     static let CPAAS_MODE_DOCKED = 1
     static let CPAAS_MODE_BURGER = 2
     static let CPAAS_MODE_BURGER = 2
     static let CPAAS_MODE_MIX = 4
     static let CPAAS_MODE_MIX = 4
-    static let DEFAULT_CPAAS_MODE = CPAAS_MODE_DOCKED
+    static let DEFAULT_CPAAS_MODE = CPAAS_MODE_FLOATING
     
     
     static func getCpaasMode() -> Int {
     static func getCpaasMode() -> Int {
         let mode = UserDefaults.standard.integer(forKey: "cpaas_mode")
         let mode = UserDefaults.standard.integer(forKey: "cpaas_mode")

+ 9 - 6
appbuilder-ios/AppBuilder/AppBuilder/SecondTabViewController.swift

@@ -603,6 +603,15 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
             self.getGroups { g1 in
             self.getGroups { g1 in
                 self.groupMap.removeAll()
                 self.groupMap.removeAll()
                 self.groups = g1
                 self.groups = g1
+                self.groups.sort { (a, b) -> Bool in
+                    if Int(a.official) == 1 {
+                        return true
+                    } else if Int(b.official) == 1 {
+                        return false
+                    } else {
+                        return Int(a.official) ?? 0 > Int(b.official) ?? 0
+                    }
+                }
                 DispatchQueue.main.async {
                 DispatchQueue.main.async {
                     self.tableView.reloadData()
                     self.tableView.reloadData()
                 }
                 }
@@ -714,12 +723,6 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
                         dataGroups.append(group)
                         dataGroups.append(group)
                     }
                     }
                 }
                 }
-            } else {
-                DispatchQueue.main.async {
-                    self.groups.removeAll()
-                    self.groups.append(contentsOf: listGroups)
-                    self.tableView.reloadData()
-                }
             }
             }
             completion(dataGroups)
             completion(dataGroups)
         }
         }

+ 1 - 0
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -191,6 +191,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
         center.addObserver(self, selector: #selector(checkCounter), name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil)
         center.addObserver(self, selector: #selector(checkCounter), name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil)
         checkCounter()
         checkCounter()
         willappear()
         willappear()
+        Nexilis.debugBroadcast()
     }
     }
     
     
     static func getiPhoneModel() -> String {
     static func getiPhoneModel() -> String {

+ 7 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/CoreMessage_TMessageKey.swift

@@ -488,4 +488,11 @@ public class CoreMessage_TMessageKey {
     
     
     public static let TOTAL_PAYMENT = "TPM";
     public static let TOTAL_PAYMENT = "TPM";
     
     
+    public static let IS_ANIMATION = "ISN";
+    public static let START_ANIMATION = "SANI";
+    public static let LOOP_ANIMATION = "LANI";
+    public static let SCALE = "SCL";
+    public static let STYLE = "STL";
+    public static let GIF_ID = "GF";
+    
 }
 }

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/Extension.swift

@@ -373,7 +373,7 @@ extension URL {
 
 
 extension UIColor {
 extension UIColor {
     public static var mainColor: UIColor {
     public static var mainColor: UIColor {
-        return renderColor(hex: "#3669ad")
+        return renderColor(hex: "#046cfc")
     }
     }
     
     
     public static var borderTabColor: UIColor {
     public static var borderTabColor: UIColor {

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/IncomingThread.swift

@@ -60,7 +60,7 @@ class IncomingThread {
     }
     }
     
     
     private func process(message: TMessage) {
     private func process(message: TMessage) {
-        //print("incoming process", message.toLogString())
+        print("incoming process", message.toLogString())
         if message.getCode() == CoreMessage_TMessageCode.LOGIN_FILE {
         if message.getCode() == CoreMessage_TMessageCode.LOGIN_FILE {
             loginFile(message: message)
             loginFile(message: message)
         } else if message.getCode() == CoreMessage_TMessageCode.PUSH_MYSELF || message.getCode() == CoreMessage_TMessageCode.PUSH_MYSELF_ACK || message.getCode() == CoreMessage_TMessageCode.PULL_MYSELF {
         } else if message.getCode() == CoreMessage_TMessageCode.PUSH_MYSELF || message.getCode() == CoreMessage_TMessageCode.PUSH_MYSELF_ACK || message.getCode() == CoreMessage_TMessageCode.PULL_MYSELF {

+ 243 - 229
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -46,7 +46,7 @@ public class Nexilis: NSObject {
     
     
     public static let shared = Nexilis()
     public static let shared = Nexilis()
     
     
-    public static var broadcastTimer = Timer()
+//    public static var broadcastTimer = Timer()
     
     
     public static var broadcastList = [[String: String]]()
     public static var broadcastList = [[String: String]]()
     
     
@@ -1826,17 +1826,23 @@ public class Nexilis: NSObject {
         return permissionCheck
         return permissionCheck
     }
     }
     
     
-    public static func startTimer(){
-        broadcastTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true, block: {_ in
-            if(!openBroadcast && !broadcastList.isEmpty){
-                openBroadcast = true
-                let m = broadcastList.removeFirst()
-                //print("broadcast show: \(m)")
-                DispatchQueue.main.async {
-                    Nexilis.shared.showBroadcastMessage(m: m)
-                }
-            }
-        })
+//    public static func startTimer(){
+//        broadcastTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true, block: {_ in
+//            if(!openBroadcast && !broadcastList.isEmpty){
+//                openBroadcast = true
+//                let m = broadcastList.removeFirst()
+//                //print("broadcast show: \(m)")
+//                DispatchQueue.main.async {
+//                    Nexilis.shared.showBroadcastMessage(m: m)
+//                }
+//            }
+//        })
+//    }
+    public static func debugBroadcast(){
+        if(!broadcastList.isEmpty) {
+            let m = broadcastList[0]
+            Nexilis.shared.showBroadcastMessage(m: m)
+        }
     }
     }
     
     
     /*
     /*
@@ -2253,241 +2259,249 @@ extension Nexilis: MessageDelegate {
     
     
     func showBroadcastMessage(m: [String: String]) {
     func showBroadcastMessage(m: [String: String]) {
         let fileType = m[CoreMessage_TMessageKey.CATEGORY_FLAG]!
         let fileType = m[CoreMessage_TMessageKey.CATEGORY_FLAG]!
+        let gifId = m[CoreMessage_TMessageKey.GIF_ID] ?? ""
         let broadcastVC = UIViewController()
         let broadcastVC = UIViewController()
         if let viewBroadcast = broadcastVC.view {
         if let viewBroadcast = broadcastVC.view {
             broadcastVC.modalPresentationStyle = .custom
             broadcastVC.modalPresentationStyle = .custom
             viewBroadcast.backgroundColor = .black.withAlphaComponent(0.3)
             viewBroadcast.backgroundColor = .black.withAlphaComponent(0.3)
-            
-            let stringLink = m[CoreMessage_TMessageKey.LINK] ?? ""
-            
-            let containerView = UIView()
-            viewBroadcast.addSubview(containerView)
-            if stringLink.isEmpty {
-                containerView.anchor(centerX: viewBroadcast.centerXAnchor, centerY: viewBroadcast.centerYAnchor, width: viewBroadcast.bounds.width - 40, minHeight: 100, maxHeight: viewBroadcast.bounds.height - 100)
+            if !gifId.isEmpty {
+                let containerView = UIView()
+                viewBroadcast.addSubview(containerView)
+                containerView.anchor(centerX: viewBroadcast.centerXAnchor, centerY: viewBroadcast.centerYAnchor, width: 100, height: 100)
+                containerView.backgroundColor = .yellow.withAlphaComponent(0.5)
             } else {
             } else {
-                containerView.anchor(centerX: viewBroadcast.centerXAnchor, centerY: viewBroadcast.centerYAnchor, width: viewBroadcast.bounds.width - 40, minHeight: 200, maxHeight: viewBroadcast.bounds.height - 100)
-            }
-            containerView.backgroundColor = .white.withAlphaComponent(0.9)
-            containerView.layer.cornerRadius = 15.0
-            containerView.clipsToBounds = true
-            
-            let subContainerView = UIView()
-            subContainerView.backgroundColor = .clear
-            containerView.addSubview(subContainerView)
-            subContainerView.anchor(top: containerView.topAnchor, left: containerView.leftAnchor, bottom: containerView.bottomAnchor, right: containerView.rightAnchor, paddingTop: 20.0, paddingLeft: 10.0, paddingBottom: 20.0, paddingRight: 10.0)
-            
-            let buttonClose = UIButton(type: .close)
-            buttonClose.frame.size = CGSize(width: 30, height: 30)
-            buttonClose.layer.cornerRadius = 15.0
-            buttonClose.clipsToBounds = true
-            buttonClose.backgroundColor = .secondaryColor.withAlphaComponent(0.5)
-            buttonClose.actionHandle(controlEvents: .touchUpInside,
-             ForAction:{() -> Void in
-                broadcastVC.dismiss(animated: true, completion: {
-                    Nexilis.broadcastList.remove(at: 0)
-                    if Nexilis.broadcastList.count > 0 {
-                        Nexilis.shared.showBroadcastMessage(m: Nexilis.broadcastList[0])
-                    }
-                })
-             })
-            containerView.addSubview(buttonClose)
-            buttonClose.anchor(top: containerView.topAnchor, right: containerView.rightAnchor, width: 30, height: 30)
-            
-            let title = UILabel()
-            title.font = .systemFont(ofSize: 18, weight: .bold)
-            title.text = m["MERNAM"]
-            title.textAlignment = .center
-            subContainerView.addSubview(title)
-            title.anchor(top: subContainerView.topAnchor, left: subContainerView.leftAnchor, right: subContainerView.rightAnchor)
-            
-            let titleBroadcast = UILabel()
-            subContainerView.addSubview(titleBroadcast)
-            titleBroadcast.translatesAutoresizingMaskIntoConstraints = false
-            NSLayoutConstraint.activate([
-                titleBroadcast.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 20.0),
-                titleBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
-                titleBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
-            ])
-            titleBroadcast.font = UIFont.systemFont(ofSize: 14, weight: .semibold)
-            titleBroadcast.numberOfLines = 0
-            titleBroadcast.attributedText = m[CoreMessage_TMessageKey.TITLE]!.richText()
-            titleBroadcast.textColor = .black
-            
-            let descBroadcast = UILabel()
-            subContainerView.addSubview(descBroadcast)
-            descBroadcast.translatesAutoresizingMaskIntoConstraints = false
-            let constraintDesc = descBroadcast.bottomAnchor.constraint(equalTo: subContainerView.bottomAnchor)
-            if !stringLink.isEmpty{
-                constraintDesc.constant = constraintDesc.constant - 30
-            }
-            if fileType != BroadcastViewController.FILE_TYPE_CHAT {
-                constraintDesc.constant = constraintDesc.constant - 260
-            }
-            NSLayoutConstraint.activate([
-                descBroadcast.topAnchor.constraint(equalTo: titleBroadcast.bottomAnchor, constant: 10),
-                descBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
-                descBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
-                constraintDesc,
-            ])
-            descBroadcast.font = UIFont.systemFont(ofSize: 12)
-            descBroadcast.numberOfLines = 0
-            descBroadcast.attributedText = m[CoreMessage_TMessageKey.MESSAGE_TEXT_ENG]!.richText()
-            descBroadcast.textColor = .black
-            
-            let linkBroadcast = UILabel()
-            if !stringLink.isEmpty {
-                subContainerView.addSubview(linkBroadcast)
-                linkBroadcast.translatesAutoresizingMaskIntoConstraints = false
+                let stringLink = m[CoreMessage_TMessageKey.LINK] ?? ""
+                
+                let containerView = UIView()
+                viewBroadcast.addSubview(containerView)
+                if stringLink.isEmpty {
+                    containerView.anchor(centerX: viewBroadcast.centerXAnchor, centerY: viewBroadcast.centerYAnchor, width: viewBroadcast.bounds.width - 40, minHeight: 100, maxHeight: viewBroadcast.bounds.height - 100)
+                } else {
+                    containerView.anchor(centerX: viewBroadcast.centerXAnchor, centerY: viewBroadcast.centerYAnchor, width: viewBroadcast.bounds.width - 40, minHeight: 200, maxHeight: viewBroadcast.bounds.height - 100)
+                }
+                containerView.backgroundColor = .white.withAlphaComponent(0.9)
+                containerView.layer.cornerRadius = 15.0
+                containerView.clipsToBounds = true
+                
+                let subContainerView = UIView()
+                subContainerView.backgroundColor = .clear
+                containerView.addSubview(subContainerView)
+                subContainerView.anchor(top: containerView.topAnchor, left: containerView.leftAnchor, bottom: containerView.bottomAnchor, right: containerView.rightAnchor, paddingTop: 20.0, paddingLeft: 10.0, paddingBottom: 20.0, paddingRight: 10.0)
+                
+                let buttonClose = UIButton(type: .close)
+                buttonClose.frame.size = CGSize(width: 30, height: 30)
+                buttonClose.layer.cornerRadius = 15.0
+                buttonClose.clipsToBounds = true
+                buttonClose.backgroundColor = .secondaryColor.withAlphaComponent(0.5)
+                buttonClose.actionHandle(controlEvents: .touchUpInside,
+                 ForAction:{() -> Void in
+                    broadcastVC.dismiss(animated: true, completion: {
+                        Nexilis.broadcastList.remove(at: 0)
+                        if Nexilis.broadcastList.count > 0 {
+                            Nexilis.shared.showBroadcastMessage(m: Nexilis.broadcastList[0])
+                        }
+                    })
+                 })
+                containerView.addSubview(buttonClose)
+                buttonClose.anchor(top: containerView.topAnchor, right: containerView.rightAnchor, width: 30, height: 30)
+                
+                let title = UILabel()
+                title.font = .systemFont(ofSize: 18, weight: .bold)
+                title.text = m["MERNAM"]
+                title.textAlignment = .center
+                subContainerView.addSubview(title)
+                title.anchor(top: subContainerView.topAnchor, left: subContainerView.leftAnchor, right: subContainerView.rightAnchor)
+                
+                let titleBroadcast = UILabel()
+                subContainerView.addSubview(titleBroadcast)
+                titleBroadcast.translatesAutoresizingMaskIntoConstraints = false
                 NSLayoutConstraint.activate([
                 NSLayoutConstraint.activate([
-                    linkBroadcast.topAnchor.constraint(equalTo: descBroadcast.bottomAnchor, constant: 10),
-                    linkBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
-                    linkBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
+                    titleBroadcast.topAnchor.constraint(equalTo: title.bottomAnchor, constant: 20.0),
+                    titleBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
+                    titleBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
                 ])
                 ])
-                linkBroadcast.font = UIFont.systemFont(ofSize: 12)
-                linkBroadcast.isUserInteractionEnabled = true
-                linkBroadcast.numberOfLines = 2
-                let attributedString = NSMutableAttributedString(string: stringLink, attributes:[NSAttributedString.Key.link: URL(string: stringLink)!])
-                linkBroadcast.attributedText = attributedString
-                let tap = ObjectGesture(target: self, action: #selector(tapLinkBroadcast))
-                tap.message_id = stringLink
-                linkBroadcast.addGestureRecognizer(tap)
-            }
-            
-            let thumb = m[CoreMessage_TMessageKey.THUMB_ID] ?? ""
-            let image = m[CoreMessage_TMessageKey.IMAGE_ID] ?? ""
-            let video = m[CoreMessage_TMessageKey.VIDEO_ID] ?? ""
-            let file = m[CoreMessage_TMessageKey.FILE_ID] ?? ""
-            if fileType != BroadcastViewController.FILE_TYPE_CHAT {
-                let imageBroadcast = UIImageView()
-                subContainerView.addSubview(imageBroadcast)
-                imageBroadcast.translatesAutoresizingMaskIntoConstraints = false
-                var constImage = imageBroadcast.topAnchor.constraint(equalTo: descBroadcast.bottomAnchor, constant: 10)
-                if !stringLink.isEmpty {
-                    constImage = imageBroadcast.topAnchor.constraint(equalTo: linkBroadcast.bottomAnchor, constant: 10)
+                titleBroadcast.font = UIFont.systemFont(ofSize: 14, weight: .semibold)
+                titleBroadcast.numberOfLines = 0
+                titleBroadcast.attributedText = m[CoreMessage_TMessageKey.TITLE]!.richText()
+                titleBroadcast.textColor = .black
+                
+                let descBroadcast = UILabel()
+                subContainerView.addSubview(descBroadcast)
+                descBroadcast.translatesAutoresizingMaskIntoConstraints = false
+                let constraintDesc = descBroadcast.bottomAnchor.constraint(equalTo: subContainerView.bottomAnchor)
+                if !stringLink.isEmpty{
+                    constraintDesc.constant = constraintDesc.constant - 30
+                }
+                if fileType != BroadcastViewController.FILE_TYPE_CHAT {
+                    constraintDesc.constant = constraintDesc.constant - 260
                 }
                 }
                 NSLayoutConstraint.activate([
                 NSLayoutConstraint.activate([
-                    constImage,
-                    imageBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
-                    imageBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
-                    imageBroadcast.heightAnchor.constraint(equalToConstant: 250)
+                    descBroadcast.topAnchor.constraint(equalTo: titleBroadcast.bottomAnchor, constant: 10),
+                    descBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
+                    descBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
+                    constraintDesc,
                 ])
                 ])
-                imageBroadcast.layer.cornerRadius = 10.0
-                imageBroadcast.clipsToBounds = true
-                if fileType != BroadcastViewController.FILE_TYPE_DOCUMENT {
-                    imageBroadcast.contentMode = .scaleAspectFill
-                    imageBroadcast.setImage(name: thumb)
-            
-                    if fileType == BroadcastViewController.FILE_TYPE_VIDEO {
-                        let imagePlay = UIImageView(image: UIImage(systemName: "play.circle.fill"))
-                        imageBroadcast.addSubview(imagePlay)
-                        imagePlay.clipsToBounds = true
-                        imagePlay.translatesAutoresizingMaskIntoConstraints = false
-                        imagePlay.centerYAnchor.constraint(equalTo: imageBroadcast.centerYAnchor).isActive = true
-                        imagePlay.centerXAnchor.constraint(equalTo: imageBroadcast.centerXAnchor).isActive = true
-                        imagePlay.widthAnchor.constraint(equalToConstant: 60).isActive = true
-                        imagePlay.heightAnchor.constraint(equalToConstant: 60).isActive = true
-                        imagePlay.tintColor = .gray.withAlphaComponent(0.5)
-                    }
-                } else {
-                    imageBroadcast.image = UIImage(systemName: "doc.fill")
-                    imageBroadcast.tintColor = .mainColor
-                    imageBroadcast.contentMode = .scaleAspectFit
+                descBroadcast.font = UIFont.systemFont(ofSize: 12)
+                descBroadcast.numberOfLines = 0
+                descBroadcast.attributedText = m[CoreMessage_TMessageKey.MESSAGE_TEXT_ENG]!.richText()
+                descBroadcast.textColor = .black
+                
+                let linkBroadcast = UILabel()
+                if !stringLink.isEmpty {
+                    subContainerView.addSubview(linkBroadcast)
+                    linkBroadcast.translatesAutoresizingMaskIntoConstraints = false
+                    NSLayoutConstraint.activate([
+                        linkBroadcast.topAnchor.constraint(equalTo: descBroadcast.bottomAnchor, constant: 10),
+                        linkBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
+                        linkBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
+                    ])
+                    linkBroadcast.font = UIFont.systemFont(ofSize: 12)
+                    linkBroadcast.isUserInteractionEnabled = true
+                    linkBroadcast.numberOfLines = 2
+                    let attributedString = NSMutableAttributedString(string: stringLink, attributes:[NSAttributedString.Key.link: URL(string: stringLink)!])
+                    linkBroadcast.attributedText = attributedString
+                    let tap = ObjectGesture(target: self, action: #selector(tapLinkBroadcast))
+                    tap.message_id = stringLink
+                    linkBroadcast.addGestureRecognizer(tap)
                 }
                 }
-            
-                imageBroadcast.actionHandle(controlEvents: .touchUpInside,
-                 ForAction:{() -> Void in
-                    let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
-                    let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
-                    let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
-                    if fileType == BroadcastViewController.FILE_TYPE_IMAGE {
-                        if let dirPath = paths.first {
-                            let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(image)
-                            if FileManager.default.fileExists(atPath: imageURL.path) {
-                                let image    = UIImage(contentsOfFile: imageURL.path)
-                                let previewImageVC = PreviewAttachmentImageVideo(nibName: "PreviewAttachmentImageVideo", bundle: Bundle.resourceBundle(for: Nexilis.self))
-                                previewImageVC.image = image
-                                previewImageVC.isHiddenTextField = true
-                                previewImageVC.modalPresentationStyle = .overFullScreen
-                                previewImageVC.modalTransitionStyle  = .crossDissolve
-                                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                                    UIApplication.shared.visibleViewController?.navigationController?.present(previewImageVC, animated: true, completion: nil)
-                                } else {
-                                    UIApplication.shared.visibleViewController?.present(previewImageVC, animated: true, completion: nil)
-                                }
-                            } else {
-                                Download().startHTTP(forKey: image) { (name, progress) in
-                                    guard progress == 100 else {
-                                        return
+                
+                let thumb = m[CoreMessage_TMessageKey.THUMB_ID] ?? ""
+                let image = m[CoreMessage_TMessageKey.IMAGE_ID] ?? ""
+                let video = m[CoreMessage_TMessageKey.VIDEO_ID] ?? ""
+                let file = m[CoreMessage_TMessageKey.FILE_ID] ?? ""
+                if fileType != BroadcastViewController.FILE_TYPE_CHAT {
+                    let imageBroadcast = UIImageView()
+                    subContainerView.addSubview(imageBroadcast)
+                    imageBroadcast.translatesAutoresizingMaskIntoConstraints = false
+                    var constImage = imageBroadcast.topAnchor.constraint(equalTo: descBroadcast.bottomAnchor, constant: 10)
+                    if !stringLink.isEmpty {
+                        constImage = imageBroadcast.topAnchor.constraint(equalTo: linkBroadcast.bottomAnchor, constant: 10)
+                    }
+                    NSLayoutConstraint.activate([
+                        constImage,
+                        imageBroadcast.leadingAnchor.constraint(equalTo: subContainerView.leadingAnchor),
+                        imageBroadcast.trailingAnchor.constraint(equalTo: subContainerView.trailingAnchor),
+                        imageBroadcast.heightAnchor.constraint(equalToConstant: 250)
+                    ])
+                    imageBroadcast.layer.cornerRadius = 10.0
+                    imageBroadcast.clipsToBounds = true
+                    if fileType != BroadcastViewController.FILE_TYPE_DOCUMENT {
+                        imageBroadcast.contentMode = .scaleAspectFill
+                        imageBroadcast.setImage(name: thumb)
+                
+                        if fileType == BroadcastViewController.FILE_TYPE_VIDEO {
+                            let imagePlay = UIImageView(image: UIImage(systemName: "play.circle.fill"))
+                            imageBroadcast.addSubview(imagePlay)
+                            imagePlay.clipsToBounds = true
+                            imagePlay.translatesAutoresizingMaskIntoConstraints = false
+                            imagePlay.centerYAnchor.constraint(equalTo: imageBroadcast.centerYAnchor).isActive = true
+                            imagePlay.centerXAnchor.constraint(equalTo: imageBroadcast.centerXAnchor).isActive = true
+                            imagePlay.widthAnchor.constraint(equalToConstant: 60).isActive = true
+                            imagePlay.heightAnchor.constraint(equalToConstant: 60).isActive = true
+                            imagePlay.tintColor = .gray.withAlphaComponent(0.5)
+                        }
+                    } else {
+                        imageBroadcast.image = UIImage(systemName: "doc.fill")
+                        imageBroadcast.tintColor = .mainColor
+                        imageBroadcast.contentMode = .scaleAspectFit
+                    }
+                
+                    imageBroadcast.actionHandle(controlEvents: .touchUpInside,
+                     ForAction:{() -> Void in
+                        let nsDocumentDirectory = FileManager.SearchPathDirectory.documentDirectory
+                        let nsUserDomainMask = FileManager.SearchPathDomainMask.userDomainMask
+                        let paths = NSSearchPathForDirectoriesInDomains(nsDocumentDirectory, nsUserDomainMask, true)
+                        if fileType == BroadcastViewController.FILE_TYPE_IMAGE {
+                            if let dirPath = paths.first {
+                                let imageURL = URL(fileURLWithPath: dirPath).appendingPathComponent(image)
+                                if FileManager.default.fileExists(atPath: imageURL.path) {
+                                    let image    = UIImage(contentsOfFile: imageURL.path)
+                                    let previewImageVC = PreviewAttachmentImageVideo(nibName: "PreviewAttachmentImageVideo", bundle: Bundle.resourceBundle(for: Nexilis.self))
+                                    previewImageVC.image = image
+                                    previewImageVC.isHiddenTextField = true
+                                    previewImageVC.modalPresentationStyle = .overFullScreen
+                                    previewImageVC.modalTransitionStyle  = .crossDissolve
+                                    if UIApplication.shared.visibleViewController?.navigationController != nil {
+                                        UIApplication.shared.visibleViewController?.navigationController?.present(previewImageVC, animated: true, completion: nil)
+                                    } else {
+                                        UIApplication.shared.visibleViewController?.present(previewImageVC, animated: true, completion: nil)
                                     }
                                     }
-            
-                                    DispatchQueue.main.async {
-                                        let image    = UIImage(contentsOfFile: imageURL.path)
-                                        let previewImageVC = PreviewAttachmentImageVideo(nibName: "PreviewAttachmentImageVideo", bundle: Bundle.resourceBundle(for: Nexilis.self))
-                                        previewImageVC.image = image
-                                        previewImageVC.isHiddenTextField = true
-                                        previewImageVC.modalPresentationStyle = .overFullScreen
-                                        previewImageVC.modalTransitionStyle  = .crossDissolve
-                                        if UIApplication.shared.visibleViewController?.navigationController != nil {
-                                            UIApplication.shared.visibleViewController?.navigationController?.present(previewImageVC, animated: true, completion: nil)
-                                        } else {
-                                            UIApplication.shared.visibleViewController?.present(previewImageVC, animated: true, completion: nil)
+                                } else {
+                                    Download().startHTTP(forKey: image) { (name, progress) in
+                                        guard progress == 100 else {
+                                            return
+                                        }
+                
+                                        DispatchQueue.main.async {
+                                            let image    = UIImage(contentsOfFile: imageURL.path)
+                                            let previewImageVC = PreviewAttachmentImageVideo(nibName: "PreviewAttachmentImageVideo", bundle: Bundle.resourceBundle(for: Nexilis.self))
+                                            previewImageVC.image = image
+                                            previewImageVC.isHiddenTextField = true
+                                            previewImageVC.modalPresentationStyle = .overFullScreen
+                                            previewImageVC.modalTransitionStyle  = .crossDissolve
+                                            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                                                UIApplication.shared.visibleViewController?.navigationController?.present(previewImageVC, animated: true, completion: nil)
+                                            } else {
+                                                UIApplication.shared.visibleViewController?.present(previewImageVC, animated: true, completion: nil)
+                                            }
                                         }
                                         }
                                     }
                                     }
                                 }
                                 }
                             }
                             }
-                        }
-                    } else if fileType == BroadcastViewController.FILE_TYPE_VIDEO {
-                        //https://qmera.io/filepalio/image/
-                        let player = AVPlayer(url: URL(string: "https://nexilis.io/get_file?account=\(Nexilis.sAPIKey)&image=\(video)")!)
-                        let playerVC = AVPlayerViewController()
-                        playerVC.player = player
-                        playerVC.modalPresentationStyle = .custom
-                        if UIApplication.shared.visibleViewController?.navigationController != nil {
-                            UIApplication.shared.visibleViewController?.navigationController?.present(playerVC, animated: true, completion: nil)
-                        } else {
-                            UIApplication.shared.visibleViewController?.present(playerVC, animated: true, completion: nil)
-                        }
-                    } else if fileType == BroadcastViewController.FILE_TYPE_DOCUMENT {
-                        if let dirPath = paths.first {
-                            let fileURL = URL(fileURLWithPath: dirPath).appendingPathComponent(file)
-                            if FileManager.default.fileExists(atPath: fileURL.path) {
-                                previewItem = fileURL as NSURL
-                                let previewController = QLPreviewController()
-                                let rightBarButton = UIBarButtonItem()
-                                previewController.navigationItem.rightBarButtonItem = rightBarButton
-                                previewController.dataSource = self
-                                previewController.modalPresentationStyle = .overFullScreen
-            
-                                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                                    UIApplication.shared.visibleViewController?.navigationController?.present(previewController, animated: true, completion: nil)
-                                } else {
-                                    UIApplication.shared.visibleViewController?.present(previewController, animated: true, completion: nil)
-                                }
+                        } else if fileType == BroadcastViewController.FILE_TYPE_VIDEO {
+                            //https://qmera.io/filepalio/image/
+                            let player = AVPlayer(url: URL(string: "https://nexilis.io/get_file?account=\(Nexilis.sAPIKey)&image=\(video)")!)
+                            let playerVC = AVPlayerViewController()
+                            playerVC.player = player
+                            playerVC.modalPresentationStyle = .custom
+                            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                                UIApplication.shared.visibleViewController?.navigationController?.present(playerVC, animated: true, completion: nil)
                             } else {
                             } else {
-                                Download().startHTTP(forKey: file) { (name, progress) in
-                                    DispatchQueue.main.async {
-                                        guard progress == 100 else {
-                                            return
-                                        }
-                                        previewItem = fileURL as NSURL
-                                        let previewController = QLPreviewController()
-                                        let rightBarButton = UIBarButtonItem()
-                                        previewController.navigationItem.rightBarButtonItem = rightBarButton
-                                        previewController.dataSource = self
-                                        previewController.modalPresentationStyle = .overFullScreen
-            
-                                        if UIApplication.shared.visibleViewController?.navigationController != nil {
-                                            UIApplication.shared.visibleViewController?.navigationController?.present(previewController, animated: true, completion: nil)
-                                        } else {
-                                            UIApplication.shared.visibleViewController?.present(previewController, animated: true, completion: nil)
+                                UIApplication.shared.visibleViewController?.present(playerVC, animated: true, completion: nil)
+                            }
+                        } else if fileType == BroadcastViewController.FILE_TYPE_DOCUMENT {
+                            if let dirPath = paths.first {
+                                let fileURL = URL(fileURLWithPath: dirPath).appendingPathComponent(file)
+                                if FileManager.default.fileExists(atPath: fileURL.path) {
+                                    previewItem = fileURL as NSURL
+                                    let previewController = QLPreviewController()
+                                    let rightBarButton = UIBarButtonItem()
+                                    previewController.navigationItem.rightBarButtonItem = rightBarButton
+                                    previewController.dataSource = self
+                                    previewController.modalPresentationStyle = .overFullScreen
+                
+                                    if UIApplication.shared.visibleViewController?.navigationController != nil {
+                                        UIApplication.shared.visibleViewController?.navigationController?.present(previewController, animated: true, completion: nil)
+                                    } else {
+                                        UIApplication.shared.visibleViewController?.present(previewController, animated: true, completion: nil)
+                                    }
+                                } else {
+                                    Download().startHTTP(forKey: file) { (name, progress) in
+                                        DispatchQueue.main.async {
+                                            guard progress == 100 else {
+                                                return
+                                            }
+                                            previewItem = fileURL as NSURL
+                                            let previewController = QLPreviewController()
+                                            let rightBarButton = UIBarButtonItem()
+                                            previewController.navigationItem.rightBarButtonItem = rightBarButton
+                                            previewController.dataSource = self
+                                            previewController.modalPresentationStyle = .overFullScreen
+                
+                                            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                                                UIApplication.shared.visibleViewController?.navigationController?.present(previewController, animated: true, completion: nil)
+                                            } else {
+                                                UIApplication.shared.visibleViewController?.present(previewController, animated: true, completion: nil)
+                                            }
                                         }
                                         }
                                     }
                                     }
                                 }
                                 }
                             }
                             }
                         }
                         }
-                    }
-                 })
+                     })
+                }
             }
             }
+
             broadcastVC.modalTransitionStyle = .crossDissolve
             broadcastVC.modalTransitionStyle = .crossDissolve
             if UIApplication.shared.visibleViewController?.navigationController != nil {
             if UIApplication.shared.visibleViewController?.navigationController != nil {
                 UIApplication.shared.visibleViewController?.navigationController?.present(broadcastVC, animated: true, completion: nil)
                 UIApplication.shared.visibleViewController?.navigationController?.present(broadcastVC, animated: true, completion: nil)
@@ -3249,12 +3263,12 @@ extension Nexilis: MessageDelegate {
             let m = message.mBodies
             let m = message.mBodies
             if !message.getBody(key: CoreMessage_TMessageKey.MERCHANT_NAME).isEmpty {
             if !message.getBody(key: CoreMessage_TMessageKey.MERCHANT_NAME).isEmpty {
                 DispatchQueue.main.async {
                 DispatchQueue.main.async {
-                    if !Nexilis.broadcastList.isEmpty {
-                        Nexilis.broadcastList.append(m)
-                    } else {
+//                    if !Nexilis.broadcastList.isEmpty {
                         Nexilis.broadcastList.append(m)
                         Nexilis.broadcastList.append(m)
-                        Nexilis.shared.showBroadcastMessage(m: m)
-                    }
+//                    } else {
+//                        Nexilis.broadcastList.append(m)
+//                        Nexilis.shared.showBroadcastMessage(m: m)
+//                    }
                 }
                 }
                 return
                 return
             }
             }

+ 9 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ContactChatViewController.swift

@@ -371,6 +371,15 @@ class ContactChatViewController: UITableViewController {
                 self.getGroups { g1 in
                 self.getGroups { g1 in
                     self.groupMap.removeAll()
                     self.groupMap.removeAll()
                     self.groups = g1
                     self.groups = g1
+                    self.groups.sort { (a, b) -> Bool in
+                        if Int(a.official) == 1 {
+                            return true
+                        } else if Int(b.official) == 1 {
+                            return false
+                        } else {
+                            return Int(a.official) ?? 0 > Int(b.official) ?? 0
+                        }
+                    }
                     DispatchQueue.main.async {
                     DispatchQueue.main.async {
                         self.tableView.reloadData()
                         self.tableView.reloadData()
                     }
                     }

+ 8 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/SignUpSignIn.swift

@@ -23,6 +23,14 @@ public class SignUpSignIn: UIViewController {
         super.viewDidLoad()
         super.viewDidLoad()
 
 
 //        self.view.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .black : .white
 //        self.view.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .black : .white
+        let attributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
+        let navBarAppearance = UINavigationBarAppearance()
+        navBarAppearance.configureWithOpaqueBackground()
+        navBarAppearance.backgroundColor = self.traitCollection.userInterfaceStyle == .dark ? .blackDarkMode : UIColor.mainColor
+        navBarAppearance.titleTextAttributes = attributes
+        navigationController?.navigationBar.standardAppearance = navBarAppearance
+        navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
+        navigationController?.navigationBar.tintColor = .white
 
 
         self.title = "Sign-Up/Sign-In".localized()
         self.title = "Sign-Up/Sign-In".localized()
         descSignUpSignIn.text = "Please enter your nickname or email address and your password".localized()
         descSignUpSignIn.text = "Please enter your nickname or email address and your password".localized()