alqindiirsyam 2 лет назад
Родитель
Сommit
e25c6d8617

+ 10 - 6
appbuilder-ios/NexilisLite/NexilisLite.xcodeproj/project.pbxproj

@@ -189,6 +189,7 @@
 		CD46A0C52A0D0D5D009E4C87 /* MyArchive.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD46A0C42A0D0D5D009E4C87 /* MyArchive.swift */; };
 		CDDF46752A2DD81300049A19 /* CreateSeminarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDF46732A2DD81300049A19 /* CreateSeminarViewController.swift */; };
 		CDDF46762A2DD81300049A19 /* SeminarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDF46742A2DD81300049A19 /* SeminarViewController.swift */; };
+		CDDF467A2A2EF0A700049A19 /* ScreenSharingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDDF46792A2EF0A700049A19 /* ScreenSharingViewController.swift */; };
 		E041D3F3664E6832F1C7D472 /* Pods_NexilisLite_NexilisLiteTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29B82D1BED77BA49C75DE10C /* Pods_NexilisLite_NexilisLiteTests.framework */; };
 /* End PBXBuildFile section */
 
@@ -421,6 +422,7 @@
 		CD46A0C42A0D0D5D009E4C87 /* MyArchive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyArchive.swift; sourceTree = "<group>"; };
 		CDDF46732A2DD81300049A19 /* CreateSeminarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateSeminarViewController.swift; sourceTree = "<group>"; };
 		CDDF46742A2DD81300049A19 /* SeminarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SeminarViewController.swift; sourceTree = "<group>"; };
+		CDDF46792A2EF0A700049A19 /* ScreenSharingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenSharingViewController.swift; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -636,18 +638,19 @@
 		CD1E717C2A0BA86100BF871F /* Call */ = {
 			isa = PBXGroup;
 			children = (
-				CD1E717D2A0BA86100BF871F /* CallManager.swift */,
-				CD1E717E2A0BA86100BF871F /* QmeraAudioConference.swift */,
 				CD1E717F2A0BA86100BF871F /* AudioViewController.swift */,
-				CD1E71802A0BA86100BF871F /* ProfileView.swift */,
+				CD1E71872A0BA86100BF871F /* Call.swift */,
+				CD1E717D2A0BA86100BF871F /* CallManager.swift */,
 				CD1E71812A0BA86100BF871F /* CallProviderDelegate.swift */,
+				CD1E71882A0BA86100BF871F /* GroupView.swift */,
+				CD1E71802A0BA86100BF871F /* ProfileView.swift */,
+				CD1E717E2A0BA86100BF871F /* QmeraAudioConference.swift */,
 				CD1E71822A0BA86100BF871F /* QmeraAudioViewController.swift */,
 				CD1E71832A0BA86100BF871F /* QmeraCallContactViewController.swift */,
-				CD1E71842A0BA86100BF871F /* WhiteboardViewController.swift */,
 				CD1E71852A0BA86100BF871F /* QmeraVideoViewController.swift */,
+				CDDF46792A2EF0A700049A19 /* ScreenSharingViewController.swift */,
 				CD1E71862A0BA86100BF871F /* VideoViewController.swift */,
-				CD1E71872A0BA86100BF871F /* Call.swift */,
-				CD1E71882A0BA86100BF871F /* GroupView.swift */,
+				CD1E71842A0BA86100BF871F /* WhiteboardViewController.swift */,
 			);
 			path = Call;
 			sourceTree = "<group>";
@@ -1125,6 +1128,7 @@
 				CD1E721B2A0BA86100BF871F /* Nexilis.swift in Sources */,
 				CD1E72102A0BA86100BF871F /* Extension.swift in Sources */,
 				CD1E724C2A0BA86100BF871F /* NotificationSound.swift in Sources */,
+				CDDF467A2A2EF0A700049A19 /* ScreenSharingViewController.swift in Sources */,
 				CD1E72402A0BA86100BF871F /* ChangeNamePassswordViewController.swift in Sources */,
 				CD1E722E2A0BA86100BF871F /* AudioViewController.swift in Sources */,
 				CD1E725E2A0BA86100BF871F /* TMessage.swift in Sources */,

+ 6 - 0
appbuilder-ios/NexilisLite/NexilisLite/Resource/id.lproj/Localizable.strings

@@ -298,8 +298,14 @@
 "Live Streaming title can't be empty" = "Judul Siaran Langsung tidak boleh kosong";
 "Live Streaming description can't be empty" = "Deskripsi Siaran Langsung tidak boleh kosong";
 "Start Whiteboard" = "Mulai Whiteboard";
+"Start Screen Sharing" = "Mulai Screen Sharing";
 "Waiting for answer" = "Menunggu Jawaban";
 "Incoming Whiteboard" = "Masuk Whiteboard";
+"Incoming Screen Sharing" = "Masuk Screen Sharing";
 "End Whiteboard Session" = "Akhiri Sesi Whiteboard";
+"End Screen Sharing Session" = "Akhiri Sesi Screen Sharing";
 "Are you sure you want to end whiteboard session?" = "Apakah anda ingin mengakhiri sesi whiteboard?";
+"Are you sure you want to end screen sharing session?" = "Apakah anda ingin mengakhiri sesi screen sharing?";
 "WhiteBoard session is over" = "Sesi whiteBoard telah berakhir";
+"Screen Sharing session is over" = "Sesi screen sharing telah berakhir";
+"You are now sharing your screen" = "Anda sekarang sedang membagikan layar anda";

+ 17 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/APIS.swift

@@ -356,6 +356,23 @@ public class APIS: NSObject {
             UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
         }
     }
+    
+    public static func openScreenSharing() {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            APIS.showChangeProfile()
+            return
+        }
+        let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID") as! ContactCallViewController
+        callContact.startSS = true
+        let navigationController = UINavigationController(rootViewController: callContact)
+        navigationController.defaultStyle()
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+        }
+    }
 }
 
 extension UINavigationController {

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

@@ -199,7 +199,26 @@ class IncomingThread {
                 NotificationCenter.default.post(name: NSNotification.Name(rawValue: "wbSession"), object: nil, userInfo: dataMessage)
             }
         } else if type == "ss"{
-            
+            switch (Int(status)) {
+            case CoreMessage_TMessageCode.SS_INCOMING:
+                print("SS_INCOMING")
+                DispatchQueue.main.async {
+                    let controller = ScreenSharingViewController()
+                    controller.modalPresentationStyle = .overFullScreen
+                    controller.fromContact = 1
+                    controller.user = User.getData(pin: f_pin)
+                    if UIApplication.shared.visibleViewController?.navigationController != nil {
+                        UIApplication.shared.visibleViewController?.navigationController?.present(controller, animated: true, completion: nil)
+                    } else {
+                        UIApplication.shared.visibleViewController?.present(controller, animated: true, completion: nil)
+                    }
+                }
+            default:
+                print("default")
+                var dataMessage: [AnyHashable : Any] = [:]
+                dataMessage["message"] = message
+                NotificationCenter.default.post(name: NSNotification.Name(rawValue: "ssSession"), object: nil, userInfo: dataMessage)
+            }
         }
         ack(message: message)
     }

+ 271 - 10
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/ScreenSharingViewController.swift

@@ -6,24 +6,285 @@
 //
 
 import UIKit
+import nuSDKService
 
 class ScreenSharingViewController: UIViewController {
+    
+    var fromContact: Int?
+    let myImage = UIImageView()
+    let name = UILabel()
+    let profileImage = UIImageView()
+    let labelIncomingOutgoing = UILabel()
+    var user: User?
+    let buttonDecline = UIButton()
+    let buttonAccept = UIButton()
+    var constraintLeadingButtonDecline = NSLayoutConstraint()
+    var constraintBottomButtonDecline = NSLayoutConstraint()
+    var imageSS = UIImageView()
 
     override func viewDidLoad() {
         super.viewDidLoad()
 
-        // Do any additional setup after loading the view.
+        if fromContact != nil {
+            addBackgroundIncoming()
+            addProfileNameCalling()
+            Calling()
+            addToolbar()
+        }
+        self.view.backgroundColor = .white
+        self.title = "Screen Sharing".localized()
+        let center: NotificationCenter = NotificationCenter.default
+        center.addObserver(self, selector: #selector(ssSession(notification:)), name: NSNotification.Name(rawValue: "ssSession"), object: nil)
     }
     
-
-    /*
-    // MARK: - Navigation
-
-    // In a storyboard-based application, you will often want to do a little preparation before navigation
-    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-        // Get the new view controller using segue.destination.
-        // Pass the selected object to the new view controller.
+    func addBackgroundIncoming() {
+        view.addSubview(myImage)
+        myImage.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            myImage.topAnchor.constraint(equalTo: view.topAnchor),
+            myImage.bottomAnchor.constraint(equalTo: view.bottomAnchor),
+            myImage.leadingAnchor.constraint(equalTo: view.leadingAnchor),
+            myImage.trailingAnchor.constraint(equalTo: view.trailingAnchor),
+        ])
+        myImage.backgroundColor = .lightGray
+        myImage.tintColor = .secondaryColor
+        let image = user!.thumb
+        if image.isEmpty {
+            myImage.image = UIImage(systemName: "person")
+            myImage.contentMode = .scaleAspectFit
+        } else {
+            myImage.setImage(name: image)
+            myImage.contentMode = .scaleAspectFill
+        }
+    }
+    
+    func addProfileNameCalling() {
+        view.addSubview(profileImage)
+        profileImage.translatesAutoresizingMaskIntoConstraints = false
+        profileImage.frame.size = CGSize(width: 60.0, height: 60.0)
+        NSLayoutConstraint.activate([
+            profileImage.topAnchor.constraint(equalTo: view.topAnchor, constant: 40.0),
+            profileImage.centerXAnchor.constraint(equalTo: view.centerXAnchor),
+            profileImage.widthAnchor.constraint(equalToConstant: 60.0),
+            profileImage.heightAnchor.constraint(equalToConstant: 63.0)
+        ])
+        profileImage.backgroundColor = .lightGray
+        profileImage.tintColor = .secondaryColor
+        profileImage.circle()
+        let image = user!.thumb
+        if image.isEmpty {
+            profileImage.image = UIImage(systemName: "person")
+            profileImage.contentMode = .scaleAspectFit
+            profileImage.layer.borderWidth = 1
+            profileImage.layer.borderColor = UIColor.secondaryColor.cgColor
+        } else {
+            profileImage.setImage(name: image)
+            profileImage.contentMode = .scaleAspectFill
+        }
+        
+        view.addSubview(name)
+        name.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            name.topAnchor.constraint(equalTo: profileImage.bottomAnchor, constant: 5.0),
+            name.centerXAnchor.constraint(equalTo: view.centerXAnchor)
+        ])
+        name.font = UIFont.systemFont(ofSize: 12)
+        name.backgroundColor = .black.withAlphaComponent(0.05)
+        name.layer.cornerRadius = 5.0
+        name.clipsToBounds = true
+        name.textColor = .mainColor
+        name.text = user?.fullName.trimmingCharacters(in: .whitespaces)
+    }
+    
+    func Calling() {
+        view.addSubview(labelIncomingOutgoing)
+        labelIncomingOutgoing.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            labelIncomingOutgoing.topAnchor.constraint(equalTo: name.bottomAnchor, constant: 40.0),
+            labelIncomingOutgoing.centerXAnchor.constraint(equalTo: view.centerXAnchor)
+        ])
+        if fromContact == 0 {
+            labelIncomingOutgoing.text = "Waiting for answer".localized() + "..."
+            _ = Nexilis.write(message: CoreMessage_TMessageBank.ssCreate(l_pin: user!.pin))
+        } else {
+            labelIncomingOutgoing.text = "Incoming Screen Sharing".localized() + "..."
+        }
+        labelIncomingOutgoing.font = UIFont.systemFont(ofSize: 12)
+        labelIncomingOutgoing.backgroundColor = .black.withAlphaComponent(0.05)
+        labelIncomingOutgoing.layer.cornerRadius = 5.0
+        labelIncomingOutgoing.clipsToBounds = true
+        labelIncomingOutgoing.textColor = .mainColor
+    }
+    
+    func addToolbar() {
+        view.addSubview(buttonDecline)
+        buttonDecline.translatesAutoresizingMaskIntoConstraints = false
+        buttonDecline.frame.size = CGSize(width: 70.0, height: 70.0)
+        if fromContact == 0 {
+            constraintLeadingButtonDecline = buttonDecline.centerXAnchor.constraint(equalTo: view.centerXAnchor)
+        } else {
+            constraintLeadingButtonDecline = buttonDecline.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: view.frame.width * 0.2)
+        }
+        constraintBottomButtonDecline = buttonDecline.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -60.0)
+        NSLayoutConstraint.activate([
+            constraintBottomButtonDecline,
+            constraintLeadingButtonDecline,
+            buttonDecline.widthAnchor.constraint(equalToConstant: 70.0),
+            buttonDecline.heightAnchor.constraint(equalToConstant: 70.0)
+        ])
+        buttonDecline.backgroundColor = .red
+        buttonDecline.circle()
+        buttonDecline.setImage(UIImage(systemName: "xmark", withConfiguration: UIImage.SymbolConfiguration(pointSize: 30, weight: .medium, scale: .default)), for: .normal)
+        buttonDecline.tintColor = .white
+        buttonDecline.addTarget(self, action: #selector(didTapDeclineCallButton(sender:)), for: .touchUpInside)
+        
+        if fromContact == 1 {
+            view.addSubview(buttonAccept)
+            buttonAccept.translatesAutoresizingMaskIntoConstraints = false
+            buttonAccept.frame.size = CGSize(width: 70.0, height: 70.0)
+            NSLayoutConstraint.activate([
+                buttonAccept.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -60.0),
+                buttonAccept.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -(view.frame.width * 0.2)),
+                buttonAccept.widthAnchor.constraint(equalToConstant: 70.0),
+                buttonAccept.heightAnchor.constraint(equalToConstant: 70.0)
+            ])
+            buttonAccept.backgroundColor = .greenColor
+            buttonAccept.circle()
+            buttonAccept.setImage(UIImage(systemName: "checkmark", withConfiguration: UIImage.SymbolConfiguration(pointSize: 30, weight: .medium, scale: .default)), for: .normal)
+            buttonAccept.tintColor = .white
+            buttonAccept.addTarget(self, action: #selector(didTapAcceptCallButton), for: .touchUpInside)
+        }
+    }
+    
+    @objc func didTapDeclineCallButton(sender: Any) {
+        let alert = UIAlertController(title: "End Screen Sharing Session".localized(), message: "Are you sure you want to end screen sharing session?".localized(), preferredStyle: .alert)
+        alert.addAction(UIAlertAction(title: "No".localized(), style: UIAlertAction.Style.default, handler: nil))
+        alert.addAction(UIAlertAction(title: "Yes".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            if self.fromContact == 0 {
+                _ = Nexilis.write(message: CoreMessage_TMessageBank.ssEnded(l_pin: self.user!.pin))
+            } else {
+                _ = Nexilis.write(message: CoreMessage_TMessageBank.ssReject(l_pin: self.user!.pin))
+            }
+            self.dismiss(animated: true, completion: nil)
+        }))
+        self.present(alert, animated: true, completion: nil)
+    }
+    
+    @objc func didTapAcceptCallButton() {
+        _ = Nexilis.write(message: CoreMessage_TMessageBank.ssAccept(l_pin: user!.pin))
+        DispatchQueue.main.async {
+            self.myImage.removeFromSuperview()
+            self.name.removeFromSuperview()
+            self.profileImage.removeFromSuperview()
+            self.labelIncomingOutgoing.removeFromSuperview()
+            self.buttonAccept.removeFromSuperview()
+            NSLayoutConstraint.deactivate([
+                self.constraintLeadingButtonDecline,
+                self.constraintBottomButtonDecline
+            ])
+            self.view.addSubview(self.imageSS)
+            self.imageSS.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, bottom: self.view.bottomAnchor, right: self.view.rightAnchor)
+            self.imageSS.backgroundColor = .white
+            self.sendJoin()
+        }
+    }
+    
+    @objc func ssSession(notification: NSNotification) {
+        DispatchQueue.main.async { [self] in
+            let data:[AnyHashable : Any] = notification.userInfo!
+            if let message = data["message"] as? TMessage {
+                let status = message.getBody(key: CoreMessage_TMessageKey.STATUS, default_value: "")
+                switch (Int(status)) {
+                case CoreMessage_TMessageCode.SS_ACCEPT_INCOMING:
+                    print("SS_ACCEPT_INCOMING")
+                    let f_pin = message.getBody(key: CoreMessage_TMessageKey.F_USER_ID, default_value: "")
+                    _ = Nexilis.write(message: CoreMessage_TMessageBank.ssOffhook(l_pin: f_pin))
+                    DispatchQueue.main.async {
+                        self.myImage.removeFromSuperview()
+                        self.name.removeFromSuperview()
+                        self.profileImage.removeFromSuperview()
+                        self.labelIncomingOutgoing.removeFromSuperview()
+                        NSLayoutConstraint.deactivate([
+                            self.constraintLeadingButtonDecline,
+                            self.constraintBottomButtonDecline
+                        ])
+                        let stackViewToolbar = UIStackView()
+                        self.view.addSubview(stackViewToolbar)
+                        stackViewToolbar.translatesAutoresizingMaskIntoConstraints = false
+                        NSLayoutConstraint.activate([
+                            stackViewToolbar.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
+                            stackViewToolbar.bottomAnchor.constraint(equalTo: self.view.bottomAnchor, constant: -60.0)
+                        ])
+                        stackViewToolbar.axis = .horizontal
+                        stackViewToolbar.distribution = .equalSpacing
+                        stackViewToolbar.alignment = .center
+                        stackViewToolbar.spacing = 30
+                        stackViewToolbar.addArrangedSubview(self.buttonDecline)
+                        self.buttonDecline.setImage(UIImage(systemName: "phone.down", withConfiguration: UIImage.SymbolConfiguration(pointSize: 30, weight: .medium, scale: .default)), for: .normal)
+                        UIView.animate(withDuration: 1.0, animations: {
+                            self.view.layoutIfNeeded()
+                        })
+                        
+                        self.view.addSubview(self.imageSS)
+                        self.imageSS.anchor(top: self.view.topAnchor, left: self.view.leftAnchor, bottom: stackViewToolbar.topAnchor, right: self.view.rightAnchor)
+                        self.imageSS.backgroundColor = .white
+                        self.sendInit()
+                        let labelSSInit = UILabel()
+                        self.imageSS.addSubview(labelSSInit)
+                        labelSSInit.anchor(centerX: self.imageSS.centerXAnchor, centerY: self.imageSS.centerYAnchor)
+                        labelSSInit.font = .systemFont(ofSize: 25)
+                        labelSSInit.textColor = .mainColor
+                        labelSSInit.text = "You are now sharing your screen".localized()
+                    }
+                case CoreMessage_TMessageCode.SS_REJECT_INCOMING,CoreMessage_TMessageCode.SS_END:
+                    print("SS_END \(status)")
+                    if self.labelIncomingOutgoing.isDescendant(of: self.view) {
+                        self.labelIncomingOutgoing.text = "Screen Sharing session is over".localized()
+                    }
+                    if !self.labelIncomingOutgoing.isDescendant(of: self.view) {
+                        let conainerEnd = UIView()
+                        view.addSubview(conainerEnd)
+                        conainerEnd.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor)
+                        conainerEnd.backgroundColor = .white
+                        
+                        let labelEnd = UILabel()
+                        conainerEnd.addSubview(labelEnd)
+                        labelEnd.anchor(centerX: conainerEnd.centerXAnchor, centerY: conainerEnd.centerYAnchor)
+                        labelEnd.font = .systemFont(ofSize: 25)
+                        labelEnd.textColor = .mainColor
+                        labelEnd.text = "Screen Sharing session is over".localized()
+                    }
+                    if self.buttonDecline.isDescendant(of: self.view) {
+                        self.buttonDecline.removeFromSuperview()
+                    }
+                    if self.buttonAccept.isDescendant(of: self.view) {
+                        self.buttonAccept.removeFromSuperview()
+                    }
+                    terminate()
+                    DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
+                        self.dismiss(animated: true, completion: nil)
+                    }
+                case CoreMessage_TMessageCode.SS_OFFHOOK:
+                    print("SS_OFFHOOK")
+                case CoreMessage_TMessageCode.SS_RINGING:
+                    print("SS_RINGING")
+                default:
+                    print("default")
+                }
+            }
+        }
+    }
+    
+    func sendInit(){
+        API.initiateSS(sTitle: "", nQuality: 0)
+    }
+    
+    func sendJoin(){
+        API.joinSS(sBroadcasterID: user!.pin, ivRemoteView: imageSS)
+    }
+    
+    func terminate(){
+        API.terminateSS()
     }
-    */
 
 }

+ 7 - 4
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/WhiteboardViewController.swift

@@ -250,10 +250,7 @@ class WhiteboardViewController: UIViewController, WhiteboardDelegate {
                     if self.labelIncomingOutgoing.isDescendant(of: self.view) {
                         self.labelIncomingOutgoing.text = "WhiteBoard session is over".localized()
                     }
-                    if self.buttonDecline.isDescendant(of: self.view) {
-                        self.buttonDecline.removeFromSuperview()
-                    }
-                    if !self.buttonDecline.isDescendant(of: self.view) {
+                    if !self.labelIncomingOutgoing.isDescendant(of: self.view) {
                         let conainerEnd = UIView()
                         view.addSubview(conainerEnd)
                         conainerEnd.anchor(top: view.topAnchor, left: view.leftAnchor, bottom: view.bottomAnchor, right: view.rightAnchor)
@@ -266,6 +263,12 @@ class WhiteboardViewController: UIViewController, WhiteboardDelegate {
                         labelEnd.textColor = .mainColor
                         labelEnd.text = "WhiteBoard session is over".localized()
                     }
+                    if self.buttonDecline.isDescendant(of: self.view) {
+                        self.buttonDecline.removeFromSuperview()
+                    }
+                    if self.buttonAccept.isDescendant(of: self.view) {
+                        self.buttonAccept.removeFromSuperview()
+                    }
                     DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
                         self.dismiss(animated: true, completion: nil)
                     }

+ 18 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Contact/ContactCallViewController.swift

@@ -29,6 +29,7 @@ class ContactCallViewController: UIViewController {
     
     var onlyAudioOrVideo = 0
     var startWhiteBoard = false
+    var startSS = false
     
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
         if (segue.identifier == "videoVC") {
@@ -59,6 +60,8 @@ class ContactCallViewController: UIViewController {
             title = "Start Video Call".localized()
         } else if startWhiteBoard {
             title = "Start Whiteboard".localized()
+        } else if startSS {
+            title = "Start Screen Sharing".localized()
         }
         let attributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16.0), NSAttributedString.Key.foregroundColor: UIColor.white]
         self.navigationController?.navigationBar.titleTextAttributes = attributes
@@ -189,7 +192,20 @@ extension ContactCallViewController: UITableViewDelegate {
             let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "wbVC") as! WhiteboardViewController
             controller.modalPresentationStyle = .overFullScreen
             controller.fromContact = 0
-            controller.user = User.getData(pin: self.dataPerson[indexPath.row]["f_pin"] as! String)
+            controller.user = User.getData(pin: self.dataPerson[indexPath.row]["f_pin"]!!)
+            present(controller, animated: true, completion: nil)
+        } else if startSS {
+            if !CheckConnection.isConnectedToNetwork() {
+                let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
+                imageView.tintColor = .white
+                let banner = FloatingNotificationBanner(title: "Check your connection".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
+                banner.show()
+                return
+            }
+            let controller = ScreenSharingViewController()
+            controller.modalPresentationStyle = .overFullScreen
+            controller.fromContact = 0
+            controller.user = User.getData(pin: self.dataPerson[indexPath.row]["f_pin"]!!)
             present(controller, animated: true, completion: nil)
         }
     }
@@ -252,7 +268,7 @@ extension ContactCallViewController: UITableViewDataSource {
                     cell.audioCallButton.removeConstraints(cell.audioCallButton.constraints)
                     cell.audioCallButton.anchor(right: cell.rightAnchor, paddingRight: 20.0, centerY: cell.centerYAnchor)
                 }
-            } else if startWhiteBoard {
+            } else if startWhiteBoard || startSS {
                 cell.audioCallButton.isHidden = true
                 cell.videoCallButton.isHidden = true
             } else if onlyAudioOrVideo == 2 {