|
@@ -12,6 +12,15 @@ import NotificationBannerSwift
|
|
|
|
|
|
class QmeraAudioViewController: UIViewController {
|
|
class QmeraAudioViewController: UIViewController {
|
|
|
|
|
|
|
|
+ let stackViewToolbar2 = UIStackView()
|
|
|
|
+ var onScreenConstraintWB = [NSLayoutConstraint]()
|
|
|
|
+ let buttonWB = UIButton()
|
|
|
|
+ let buttonChat = UIButton()
|
|
|
|
+ var wbVC : WhiteboardViewController?
|
|
|
|
+ var wbTimer = Timer()
|
|
|
|
+ var wbBlink = false
|
|
|
|
+ var wbRoomId = ""
|
|
|
|
+
|
|
let buttonSize: CGFloat = 70
|
|
let buttonSize: CGFloat = 70
|
|
|
|
|
|
lazy var data: String = "" {
|
|
lazy var data: String = "" {
|
|
@@ -355,6 +364,45 @@ class QmeraAudioViewController: UIViewController {
|
|
end.addTarget(self, action: #selector(didPressEnd(sender:)), for: .touchUpInside)
|
|
end.addTarget(self, action: #selector(didPressEnd(sender:)), for: .touchUpInside)
|
|
speaker.addTarget(self, action: #selector(didSpeaker(sender:)), for: .touchUpInside)
|
|
speaker.addTarget(self, action: #selector(didSpeaker(sender:)), for: .touchUpInside)
|
|
|
|
|
|
|
|
+ if !ticketId.isEmpty {
|
|
|
|
+ self.view.addSubview(self.stackViewToolbar2)
|
|
|
|
+ self.stackViewToolbar2.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ NSLayoutConstraint.activate([
|
|
|
|
+ self.stackViewToolbar2.centerYAnchor.constraint(equalTo: self.view.centerYAnchor),
|
|
|
|
+ self.stackViewToolbar2.leftAnchor.constraint(equalTo: self.view.leftAnchor, constant: 10.0)
|
|
|
|
+ ])
|
|
|
|
+ self.stackViewToolbar2.axis = .vertical
|
|
|
|
+ self.stackViewToolbar2.distribution = .equalSpacing
|
|
|
|
+ self.stackViewToolbar2.alignment = .center
|
|
|
|
+ self.stackViewToolbar2.spacing = 5
|
|
|
|
+
|
|
|
|
+ view.addSubview(buttonWB)
|
|
|
|
+ buttonWB.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ buttonWB.frame.size = CGSize(width: 40.0, height: 40.0)
|
|
|
|
+ NSLayoutConstraint.activate([
|
|
|
|
+ buttonWB.widthAnchor.constraint(equalToConstant: 40.0),
|
|
|
|
+ buttonWB.heightAnchor.constraint(equalToConstant: 40.0)
|
|
|
|
+ ])
|
|
|
|
+ buttonWB.backgroundColor = .lightGray
|
|
|
|
+ buttonWB.setImage(UIImage(systemName: "ipad.landscape", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .medium, scale: .default)), for: .normal)
|
|
|
|
+ buttonWB.circle()
|
|
|
|
+ buttonWB.tintColor = .black
|
|
|
|
+ buttonWB.addTarget(self, action: #selector(didTapWBButton), for: .touchUpInside)
|
|
|
|
+
|
|
|
|
+ view.addSubview(buttonChat)
|
|
|
|
+ buttonChat.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ buttonChat.frame.size = CGSize(width: 40.0, height: 40.0)
|
|
|
|
+ NSLayoutConstraint.activate([
|
|
|
|
+ buttonChat.widthAnchor.constraint(equalToConstant: 40.0),
|
|
|
|
+ buttonChat.heightAnchor.constraint(equalToConstant: 40.0)
|
|
|
|
+ ])
|
|
|
|
+ buttonChat.backgroundColor = .lightGray
|
|
|
|
+ buttonChat.setImage(UIImage(systemName: "bubble.right", withConfiguration: UIImage.SymbolConfiguration(pointSize: 20, weight: .medium, scale: .default)), for: .normal)
|
|
|
|
+ buttonChat.circle()
|
|
|
|
+ buttonChat.tintColor = .black
|
|
|
|
+ buttonChat.addTarget(self, action: #selector(didTapChatButton), for: .touchUpInside)
|
|
|
|
+ }
|
|
|
|
+
|
|
self.view.addSubview(poweredByView)
|
|
self.view.addSubview(poweredByView)
|
|
self.poweredByView.translatesAutoresizingMaskIntoConstraints = false
|
|
self.poweredByView.translatesAutoresizingMaskIntoConstraints = false
|
|
let constraintRightPowered = self.poweredByView.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: -10.0)
|
|
let constraintRightPowered = self.poweredByView.rightAnchor.constraint(equalTo: self.view.rightAnchor, constant: -10.0)
|
|
@@ -368,6 +416,8 @@ class QmeraAudioViewController: UIViewController {
|
|
|
|
|
|
poweredByView.addArrangedSubview(poweredByLabel)
|
|
poweredByView.addArrangedSubview(poweredByLabel)
|
|
poweredByView.addArrangedSubview(nexilisLogo)
|
|
poweredByView.addArrangedSubview(nexilisLogo)
|
|
|
|
+ stackViewToolbar2.addArrangedSubview(buttonWB)
|
|
|
|
+ stackViewToolbar2.addArrangedSubview(buttonChat)
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -376,6 +426,107 @@ class QmeraAudioViewController: UIViewController {
|
|
|
|
|
|
// MARK: - Action
|
|
// MARK: - Action
|
|
|
|
|
|
|
|
+ @objc func didTapChatButton(){
|
|
|
|
+ let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
|
|
+ let members = UserDefaults.standard.string(forKey: "membersCC") ?? ""
|
|
|
|
+ let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
|
|
+ let editorPersonalVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
|
|
|
|
+ editorPersonalVC.hidesBottomBarWhenPushed = true
|
|
|
|
+ editorPersonalVC.unique_l_pin = officer
|
|
|
|
+ editorPersonalVC.fromNotification = true
|
|
|
|
+ editorPersonalVC.isContactCenter = true
|
|
|
|
+ editorPersonalVC.fPinContacCenter = members
|
|
|
|
+ editorPersonalVC.complaintId = ticketId
|
|
|
|
+ editorPersonalVC.onGoingCC = true
|
|
|
|
+ editorPersonalVC.isRequestContactCenter = false
|
|
|
|
+ editorPersonalVC.users = users
|
|
|
|
+ editorPersonalVC.fromVCAC = true
|
|
|
|
+ let navigationController = UINavigationController(rootViewController: editorPersonalVC)
|
|
|
|
+ navigationController.modalPresentationStyle = .overCurrentContext
|
|
|
|
+ navigationController.navigationBar.tintColor = .white
|
|
|
|
+ navigationController.navigationBar.barTintColor = .mainColor
|
|
|
|
+ navigationController.navigationBar.isTranslucent = false
|
|
|
|
+ navigationController.navigationBar.overrideUserInterfaceStyle = .dark
|
|
|
|
+ navigationController.navigationBar.barStyle = .black
|
|
|
|
+ let cancelButtonAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: UIColor.white]
|
|
|
|
+ UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, for: .normal)
|
|
|
|
+ let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
|
|
|
|
+ navigationController.navigationBar.titleTextAttributes = textAttributes
|
|
|
|
+ navigationController.view.backgroundColor = .mainColor
|
|
|
|
+ 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)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func didTapWBButton(){
|
|
|
|
+ if(wbVC == nil){
|
|
|
|
+ wbVC = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "wbVC") as? WhiteboardViewController
|
|
|
|
+ if(wbRoomId.isEmpty){
|
|
|
|
+ let me = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
+ let tid = CoreMessage_TMessageUtil.getTID()
|
|
|
|
+ wbRoomId = "\(me)wbvc\(tid)"
|
|
|
|
+ wbVC!.roomId = wbRoomId
|
|
|
|
+ var destinations = [String]()
|
|
|
|
+ var destString = ""
|
|
|
|
+ for d in users{
|
|
|
|
+ destinations.append(d.pin)
|
|
|
|
+ if destString.isEmpty{
|
|
|
|
+ destString = d.pin
|
|
|
|
+ } else {
|
|
|
|
+ destString = destString + ",\(d.pin)"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ wbVC!.destinations = destinations
|
|
|
|
+ wbVC!.sendInit()
|
|
|
|
+ UserDefaults.standard.set("\(me),\(destString)", forKey: "wb_vc")
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ self.wbTimer.invalidate()
|
|
|
|
+ self.buttonWB.backgroundColor = .lightGray
|
|
|
|
+ wbVC!.roomId = wbRoomId
|
|
|
|
+ wbVC!.sendJoin()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ wbVC!.close = {
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ if self.wbVC!.view.isDescendant(of: self.view){
|
|
|
|
+ self.wbVC!.view.removeFromSuperview()
|
|
|
|
+ }
|
|
|
|
+// self.buttonDecline.isHidden = false
|
|
|
|
+// self.buttonSpeaker.isHidden = false
|
|
|
|
+// self.buttonAddParticipant.isHidden = false
|
|
|
|
+// self.buttonRotate.isHidden = false
|
|
|
|
+// if(!self.wbRoomId.isEmpty){
|
|
|
|
+// DispatchQueue.main.async {
|
|
|
|
+// self.wbTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.runTimer), userInfo: nil, repeats: true)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+// self.buttonDecline.isHidden = true
|
|
|
|
+// self.buttonSpeaker.isHidden = true
|
|
|
|
+// self.buttonAddParticipant.isHidden = true
|
|
|
|
+// self.buttonRotate.isHidden = true
|
|
|
|
+ addChild(wbVC!)
|
|
|
|
+ wbVC!.view.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
+ view.addSubview(wbVC!.view)
|
|
|
|
+ onScreenConstraintWB = [
|
|
|
|
+ wbVC!.view.topAnchor.constraint(equalTo: self.view.topAnchor),
|
|
|
|
+ wbVC!.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
|
|
|
|
+ wbVC!.view.rightAnchor.constraint(equalTo: self.view.rightAnchor),
|
|
|
|
+ wbVC!.view.leftAnchor.constraint(equalTo: self.view.leftAnchor),
|
|
|
|
+ ]
|
|
|
|
+ NSLayoutConstraint.activate(onScreenConstraintWB)
|
|
|
|
+
|
|
|
|
+ // Notify the child view controller that the move is complete.
|
|
|
|
+ wbVC!.didMove(toParent: self)
|
|
|
|
+// self.navigationController?.setNavigationBarHidden(false, animated: true)
|
|
|
|
+// controller.modalPresentationStyle = .overCurrentContext
|
|
|
|
+// self.navigationController?.present(controller, animated: true)
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func didSpeaker(sender: Any?) {
|
|
@objc func didSpeaker(sender: Any?) {
|
|
isSpeaker = !isSpeaker
|
|
isSpeaker = !isSpeaker
|
|
speaker.isSelected = isSpeaker
|
|
speaker.isSelected = isSpeaker
|
|
@@ -434,10 +585,20 @@ class QmeraAudioViewController: UIViewController {
|
|
}
|
|
}
|
|
|
|
|
|
@objc func didEnd(sender: Any?) {
|
|
@objc func didEnd(sender: Any?) {
|
|
|
|
+ if self.buttonWB.isDescendant(of: self.view){
|
|
|
|
+ self.buttonWB.removeFromSuperview()
|
|
|
|
+ }
|
|
|
|
+ if self.buttonChat.isDescendant(of: self.view){
|
|
|
|
+ self.buttonChat.removeFromSuperview()
|
|
|
|
+ }
|
|
poweredByView.isHidden = true
|
|
poweredByView.isHidden = true
|
|
let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
if !onGoingCC.isEmpty {
|
|
if !onGoingCC.isEmpty {
|
|
if sender != nil && sender is Bool {
|
|
if sender != nil && sender is Bool {
|
|
|
|
+ let controller = self.presentedViewController
|
|
|
|
+ if controller != nil {
|
|
|
|
+ controller!.dismiss(animated: true)
|
|
|
|
+ }
|
|
self.dismiss(animated: false, completion: nil)
|
|
self.dismiss(animated: false, completion: nil)
|
|
let requester = onGoingCC.components(separatedBy: ",")[0]
|
|
let requester = onGoingCC.components(separatedBy: ",")[0]
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
let officer = onGoingCC.isEmpty ? "" : onGoingCC.components(separatedBy: ",")[1]
|
|
@@ -523,6 +684,10 @@ class QmeraAudioViewController: UIViewController {
|
|
}))
|
|
}))
|
|
self.present(alert, animated: true, completion: nil)
|
|
self.present(alert, animated: true, completion: nil)
|
|
} else {
|
|
} else {
|
|
|
|
+ let controller = self.presentedViewController
|
|
|
|
+ if controller != nil {
|
|
|
|
+ controller!.dismiss(animated: true)
|
|
|
|
+ }
|
|
if isEndByMe {
|
|
if isEndByMe {
|
|
// for i in 0..<Nexilis.shared.callManager.calls.count {
|
|
// for i in 0..<Nexilis.shared.callManager.calls.count {
|
|
// Nexilis.shared.callManager.end(call: Nexilis.shared.callManager.calls[i])
|
|
// Nexilis.shared.callManager.end(call: Nexilis.shared.callManager.calls[i])
|
|
@@ -767,3 +932,61 @@ class QmeraAudioViewController: UIViewController {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+extension QmeraAudioViewController : WhiteboardReceiver {
|
|
|
|
+
|
|
|
|
+ func incomingWB(roomId: String) {
|
|
|
|
+ print("incoming wb")
|
|
|
|
+ self.wbTimer.invalidate()
|
|
|
|
+ if(wbRoomId.isEmpty){
|
|
|
|
+ print("wbroom empty")
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ self.wbTimer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(self.runTimer), userInfo: nil, repeats: true)
|
|
|
|
+ }
|
|
|
|
+ let me = UserDefaults.standard.string(forKey: "me")!
|
|
|
|
+ var destString = ""
|
|
|
|
+ for d in users{
|
|
|
|
+ if d.pin == roomId.components(separatedBy: "wbvc")[0] {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ if destString.isEmpty{
|
|
|
|
+ destString = d.pin
|
|
|
|
+ } else {
|
|
|
|
+ destString = destString + ",\(d.pin)"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if destString.isEmpty {
|
|
|
|
+ UserDefaults.standard.set("\(roomId.components(separatedBy: "wbvc")[0]),\(me)", forKey: "wb_vc")
|
|
|
|
+ } else {
|
|
|
|
+ UserDefaults.standard.set("\(roomId.components(separatedBy: "wbvc")[0]),\(me),\(destString)", forKey: "wb_vc")
|
|
|
|
+ }
|
|
|
|
+ wbRoomId = roomId
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func cancel(roomId: String) {
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ self.wbTimer.invalidate()
|
|
|
|
+ self.wbBlink = false
|
|
|
|
+ self.buttonWB.backgroundColor = .lightGray
|
|
|
|
+ self.buttonWB.setNeedsDisplay()
|
|
|
|
+ }
|
|
|
|
+ wbRoomId = ""
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @objc func runTimer(){
|
|
|
|
+ DispatchQueue.main.async {
|
|
|
|
+ self.wbBlink = !self.wbBlink
|
|
|
|
+ if(self.wbBlink){
|
|
|
|
+ print("set wb blink on")
|
|
|
|
+ self.buttonWB.backgroundColor = .green
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ print("set wb blink off")
|
|
|
|
+ self.buttonWB.backgroundColor = .lightGray
|
|
|
|
+ }
|
|
|
|
+ self.buttonWB.setNeedsDisplay()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|