kevin 2 жил өмнө
parent
commit
6a85c1c775

+ 1 - 0
.gitignore

@@ -8,3 +8,4 @@ src/venv/
 .DS_Store
 .DS_Store
 Podfile.lock
 Podfile.lock
 src/__pycache__/
 src/__pycache__/
+ExampleCode/

+ 21 - 0
appbuilder-ios/NexilisLite/NexilisLite/Resource/Assets.xcassets/pb_ic_camera_rear.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images": [
+    {
+      "idiom": "universal",
+      "filename": "pb_ic_camera_rear.png",
+      "scale": "1x"
+    },
+    {
+      "idiom": "universal",
+      "scale": "2x"
+    },
+    {
+      "idiom": "universal",
+      "scale": "3x"
+    }
+  ],
+  "info": {
+    "version": 1,
+    "author": "xcode"
+  }
+}

BIN
appbuilder-ios/NexilisLite/NexilisLite/Resource/Assets.xcassets/pb_ic_camera_rear.imageset/pb_ic_camera_rear.png


+ 73 - 16
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Streaming/SeminarViewController.swift

@@ -144,8 +144,9 @@ class SeminarViewController: UIViewController {
     
     
     lazy var raiseHandBtn: UIButton = {
     lazy var raiseHandBtn: UIButton = {
         let button = UIButton()
         let button = UIButton()
-        buttonRotate.frame = CGRect(x:0, y:0, width:30, height:30)
+        button.frame = CGRect(x:0, y:0, width:40, height:40)
         button.setImage(UIImage(named: "pb_raise_hand", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
         button.setImage(UIImage(named: "pb_raise_hand", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+        button.imageView?.contentMode = .scaleAspectFit
         button.layer.cornerRadius = button.maxCornerRadius()
         button.layer.cornerRadius = button.maxCornerRadius()
         button.backgroundColor = .mainColor
         button.backgroundColor = .mainColor
         button.addTarget(self, action: #selector(raiseHand(sender:)), for: .touchUpInside)
         button.addTarget(self, action: #selector(raiseHand(sender:)), for: .touchUpInside)
@@ -154,8 +155,9 @@ class SeminarViewController: UIViewController {
     
     
     lazy var screenShareBtn: UIButton = {
     lazy var screenShareBtn: UIButton = {
         let button = UIButton()
         let button = UIButton()
-        buttonRotate.frame = CGRect(x:0, y:0, width:30, height:30)
+        button.frame = CGRect(x:0, y:0, width:40, height:40)
         button.setImage(UIImage(named: "pb_screen_share", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
         button.setImage(UIImage(named: "pb_screen_share", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+        button.imageView?.contentMode = .scaleAspectFit
         button.layer.cornerRadius = button.maxCornerRadius()
         button.layer.cornerRadius = button.maxCornerRadius()
         button.backgroundColor = .mainColor
         button.backgroundColor = .mainColor
         button.addTarget(self, action: #selector(screenShare(sender:)), for: .touchUpInside)
         button.addTarget(self, action: #selector(screenShare(sender:)), for: .touchUpInside)
@@ -164,8 +166,9 @@ class SeminarViewController: UIViewController {
     
     
     lazy var whiteboardBtn: UIButton = {
     lazy var whiteboardBtn: UIButton = {
         let button = UIButton()
         let button = UIButton()
-        buttonRotate.frame = CGRect(x:0, y:0, width:30, height:30)
+        button.frame = CGRect(x:0, y:0, width:40, height:40)
         button.setImage(UIImage(named: "pb_od_draw", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
         button.setImage(UIImage(named: "pb_od_draw", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+        button.imageView?.contentMode = .scaleAspectFit
         button.layer.cornerRadius = button.maxCornerRadius()
         button.layer.cornerRadius = button.maxCornerRadius()
         button.backgroundColor = .mainColor
         button.backgroundColor = .mainColor
         button.addTarget(self, action: #selector(whiteboard(sender:)), for: .touchUpInside)
         button.addTarget(self, action: #selector(whiteboard(sender:)), for: .touchUpInside)
@@ -173,13 +176,14 @@ class SeminarViewController: UIViewController {
     }()
     }()
     
     
     lazy var buttonRotate: UIButton = {
     lazy var buttonRotate: UIButton = {
-        let buttonRotate = UIButton()
-        buttonRotate.frame = CGRect(x:0, y:0, width:30, height:30)
-        buttonRotate.setImage(UIImage(systemName: "arrow.triangle.2.circlepath.camera")?.withTintColor(.mainColor, renderingMode: .alwaysOriginal), for: .normal)
-        buttonRotate.backgroundColor = .white.withAlphaComponent(0.2)
-        buttonRotate.layer.cornerRadius = 15.0
-        buttonRotate.addTarget(self, action: #selector(camera(sender:)), for: .touchUpInside)
-        return buttonRotate
+        let button = UIButton()
+        button.frame = CGRect(x:0, y:0, width:40, height:40)
+        button.setImage(UIImage(named: "pb_ic_camera_rear", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+        button.imageView?.contentMode = .scaleAspectFit
+        button.layer.cornerRadius = button.maxCornerRadius()
+        button.backgroundColor = .mainColor
+        button.addTarget(self, action: #selector(camera(sender:)), for: .touchUpInside)
+        return button
     }()
     }()
     
     
     // TODO: badges when raise hand to broadcaster
     // TODO: badges when raise hand to broadcaster
@@ -212,6 +216,16 @@ class SeminarViewController: UIViewController {
         return count
         return count
     }()
     }()
     
     
+    lazy var toolbarView : UIStackView = {
+        let stackView = UIStackView()
+        stackView.axis = .vertical
+        stackView.alignment = .center
+        stackView.distribution = .fillEqually
+        stackView.spacing = 10 // Adjust the spacing between buttons
+        
+        return stackView
+    }()
+    
     override func viewDidLoad() {
     override func viewDidLoad() {
         super.viewDidLoad()
         super.viewDidLoad()
         
         
@@ -255,15 +269,17 @@ class SeminarViewController: UIViewController {
         stack.anchor(left: view.leftAnchor, bottom: keyboardLayoutGuide.topAnchor,
         stack.anchor(left: view.leftAnchor, bottom: keyboardLayoutGuide.topAnchor,
                      right: view.rightAnchor, paddingLeft: 20, paddingBottom: 30, paddingRight: 20, height: 200)
                      right: view.rightAnchor, paddingLeft: 20, paddingBottom: 30, paddingRight: 20, height: 200)
         
         
+        addToolbarView()
+        
         stack.addSubview(tableView)
         stack.addSubview(tableView)
         stack.addSubview(textView)
         stack.addSubview(textView)
         stack.addSubview(send)
         stack.addSubview(send)
         
         
-        send.layer.cornerRadius = 16.5
+        send.layer.cornerRadius = 16
         send.layer.masksToBounds = true
         send.layer.masksToBounds = true
         
         
         textView.anchor(left: stack.leftAnchor, bottom: stack.bottomAnchor, right: stack.rightAnchor)
         textView.anchor(left: stack.leftAnchor, bottom: stack.bottomAnchor, right: stack.rightAnchor)
-        send.anchor(bottom: textView.bottomAnchor, right: textView.rightAnchor, paddingBottom: 2, width: 33, height: 33)
+        send.anchor(bottom: textView.bottomAnchor, right: textView.rightAnchor, paddingBottom: 1, width: 32, height: 32)
         tableView.anchor(left: stack.leftAnchor, bottom: textView.topAnchor, right: stack.rightAnchor)
         tableView.anchor(left: stack.leftAnchor, bottom: textView.topAnchor, right: stack.rightAnchor)
         heightTableView = tableView.heightAnchor.constraint(equalToConstant: 44.0)
         heightTableView = tableView.heightAnchor.constraint(equalToConstant: 44.0)
         heightTableView?.isActive = true
         heightTableView?.isActive = true
@@ -278,7 +294,6 @@ class SeminarViewController: UIViewController {
         
         
         Nexilis.shared.seminarDelegate = self
         Nexilis.shared.seminarDelegate = self
         if isLive {
         if isLive {
-            navigationItem.rightBarButtonItem = UIBarButtonItem(customView: buttonRotate)
             API.ibca(sTitle: data, nCamIdx: 1, nResIdx: 2, nVQuality: 4, tvCameraPreview: tvCameraPreviewB, ivRemoteS: ivRemoteViewS)
             API.ibca(sTitle: data, nCamIdx: 1, nResIdx: 2, nVQuality: 4, tvCameraPreview: tvCameraPreviewB, ivRemoteS: ivRemoteViewS)
         } else {
         } else {
             API.iabc(nCamIdx: 1, nResIdx: 2, nVQuality: 4, tvCameraPreview: tvCameraPreviewS, sBroadcasterID: data, ivRemoteM: ivRemoteViewM, ivRemoteS: ivRemoteViewS)
             API.iabc(nCamIdx: 1, nResIdx: 2, nVQuality: 4, tvCameraPreview: tvCameraPreviewS, sBroadcasterID: data, ivRemoteM: ivRemoteViewM, ivRemoteS: ivRemoteViewS)
@@ -286,7 +301,49 @@ class SeminarViewController: UIViewController {
     }
     }
 
 
     func addToolbarView(){
     func addToolbarView(){
-        // TODO: add buttons
+        if isLive {
+            buttonRotate.widthAnchor.constraint(equalToConstant: 40).isActive = true
+            buttonRotate.heightAnchor.constraint(equalToConstant: 40).isActive = true
+            toolbarView.insertArrangedSubview(buttonRotate, at: 0)
+        }
+        else {
+            raiseHandBtn.widthAnchor.constraint(equalToConstant: 40).isActive = true
+            raiseHandBtn.heightAnchor.constraint(equalToConstant: 40).isActive = true
+            toolbarView.insertArrangedSubview(raiseHandBtn, at: 0)
+        }
+        whiteboardBtn.widthAnchor.constraint(equalToConstant: 40).isActive = true
+        whiteboardBtn.heightAnchor.constraint(equalToConstant: 40).isActive = true
+        screenShareBtn.widthAnchor.constraint(equalToConstant: 40).isActive = true
+        screenShareBtn.heightAnchor.constraint(equalToConstant: 40).isActive = true
+        toolbarView.addArrangedSubview(whiteboardBtn)
+        toolbarView.addArrangedSubview(screenShareBtn)
+        
+        // Add the stack view to the view controller's view
+        view.addSubview(toolbarView)
+        
+        // Set constraints for the stack view
+        toolbarView.translatesAutoresizingMaskIntoConstraints = false
+        NSLayoutConstraint.activate([
+            toolbarView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 10),
+            toolbarView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -10),
+            toolbarView.heightAnchor.constraint(equalToConstant: 140),
+            toolbarView.widthAnchor.constraint(equalToConstant: 45)
+        ])
+    }
+    
+    func switchRaiseHand(){
+        if hasRaiseHand {
+            raiseHandBtn.removeFromSuperview()
+            buttonRotate.widthAnchor.constraint(equalToConstant: 40).isActive = true
+            buttonRotate.heightAnchor.constraint(equalToConstant: 40).isActive = true
+            toolbarView.insertArrangedSubview(buttonRotate, at: 0)
+        }
+        else {
+            buttonRotate.removeFromSuperview()
+            raiseHandBtn.widthAnchor.constraint(equalToConstant: 40).isActive = true
+            raiseHandBtn.heightAnchor.constraint(equalToConstant: 40).isActive = true
+            toolbarView.insertArrangedSubview(raiseHandBtn, at: 0)
+        }
     }
     }
     
     
     func addCountViewerView() {
     func addCountViewerView() {
@@ -304,7 +361,7 @@ class SeminarViewController: UIViewController {
         
         
         viewCountViewer.addSubview(countViewer)
         viewCountViewer.addSubview(countViewer)
         countViewer.anchor(left: imageEye.rightAnchor, right:viewCountViewer.rightAnchor, paddingLeft: 5.0, paddingRight: 5.0, centerY: viewCountViewer.centerYAnchor)
         countViewer.anchor(left: imageEye.rightAnchor, right:viewCountViewer.rightAnchor, paddingLeft: 5.0, paddingRight: 5.0, centerY: viewCountViewer.centerYAnchor)
-        countViewer.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showListViewer(selector:))))
+        countViewer.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showListViewer(sender:))))
     }
     }
     
     
     override func viewWillDisappear(_ animated: Bool) {
     override func viewWillDisappear(_ animated: Bool) {
@@ -449,7 +506,7 @@ class SeminarViewController: UIViewController {
         guard hasRaiseHand else {
         guard hasRaiseHand else {
             return
             return
         }
         }
-        / TODO: Show list viewer
+        // TODO: Show list viewer
     }
     }
     
     
 }
 }