|
@@ -25,6 +25,8 @@ class QmeraAudioViewController: UIViewController {
|
|
var user: User?
|
|
var user: User?
|
|
|
|
|
|
var isAddCall = ""
|
|
var isAddCall = ""
|
|
|
|
+
|
|
|
|
+ private var isEndByMe = false
|
|
|
|
|
|
private var users: [User] = [] {
|
|
private var users: [User] = [] {
|
|
didSet {
|
|
didSet {
|
|
@@ -298,7 +300,7 @@ class QmeraAudioViewController: UIViewController {
|
|
view.addSubview(end)
|
|
view.addSubview(end)
|
|
end.anchor(bottom: view.bottomAnchor, paddingBottom: 60, centerX: view.centerXAnchor, width: buttonSize, height: buttonSize)
|
|
end.anchor(bottom: view.bottomAnchor, paddingBottom: 60, centerX: view.centerXAnchor, width: buttonSize, height: buttonSize)
|
|
|
|
|
|
- end.addTarget(self, action: #selector(didEnd(sender:)), for: .touchUpInside)
|
|
|
|
|
|
+ end.addTarget(self, action: #selector(didPressEnd(sender:)), for: .touchUpInside)
|
|
}
|
|
}
|
|
|
|
|
|
private func incomingView() {
|
|
private func incomingView() {
|
|
@@ -331,7 +333,7 @@ class QmeraAudioViewController: UIViewController {
|
|
stack.addArrangedSubview(speaker)
|
|
stack.addArrangedSubview(speaker)
|
|
|
|
|
|
invite.addTarget(self, action: #selector(didInvite(sender:)), for: .touchUpInside)
|
|
invite.addTarget(self, action: #selector(didInvite(sender:)), for: .touchUpInside)
|
|
- end.addTarget(self, action: #selector(didEnd(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)
|
|
|
|
|
|
self.view.addSubview(poweredByView)
|
|
self.view.addSubview(poweredByView)
|
|
@@ -388,6 +390,11 @@ class QmeraAudioViewController: UIViewController {
|
|
present(UINavigationController(rootViewController: controller), animated: true, completion: nil)
|
|
present(UINavigationController(rootViewController: controller), animated: true, completion: nil)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func didPressEnd(sender: Any?) {
|
|
|
|
+ isEndByMe = true
|
|
|
|
+ self.didEnd(sender: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
@objc func didEnd(sender: Any?) {
|
|
@objc func didEnd(sender: Any?) {
|
|
poweredByView.isHidden = true
|
|
poweredByView.isHidden = true
|
|
let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
@@ -478,10 +485,16 @@ class QmeraAudioViewController: UIViewController {
|
|
}))
|
|
}))
|
|
self.present(alert, animated: true, completion: nil)
|
|
self.present(alert, animated: true, completion: nil)
|
|
} else {
|
|
} else {
|
|
- if let user = self.user, let call = Nexilis.shared.callManager.call(with: user.pin) {
|
|
|
|
- Nexilis.shared.callManager.end(call: call)
|
|
|
|
|
|
+ if isEndByMe {
|
|
|
|
+ for i in 0..<Nexilis.shared.callManager.calls.count {
|
|
|
|
+ Nexilis.shared.callManager.end(call: Nexilis.shared.callManager.calls[i])
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- API.terminateCall(sParty: nil)
|
|
|
|
|
|
+ if let user = self.user, let call = Nexilis.shared.callManager.call(with: user.pin) {
|
|
|
|
+ Nexilis.shared.callManager.end(call: call)
|
|
|
|
+ } else {
|
|
|
|
+ API.terminateCall(sParty: nil)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
dismiss(animated: false, completion: nil)
|
|
dismiss(animated: false, completion: nil)
|
|
}
|
|
}
|
|
@@ -621,7 +634,7 @@ class QmeraAudioViewController: UIViewController {
|
|
self.didEnd(sender: true)
|
|
self.didEnd(sender: true)
|
|
}
|
|
}
|
|
return
|
|
return
|
|
- } else {
|
|
|
|
|
|
+ } else if users.count == 0 {
|
|
DispatchQueue.main.async {
|
|
DispatchQueue.main.async {
|
|
self.timer?.invalidate()
|
|
self.timer?.invalidate()
|
|
self.timer = nil
|
|
self.timer = nil
|
|
@@ -634,11 +647,11 @@ class QmeraAudioViewController: UIViewController {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if users.count == 0 {
|
|
|
|
- DispatchQueue.main.async {
|
|
|
|
- self.dismiss(animated: false, completion: nil)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// if users.count == 0 {
|
|
|
|
+// DispatchQueue.main.async {
|
|
|
|
+// self.dismiss(animated: false, completion: nil)
|
|
|
|
+// }
|
|
|
|
+// }
|
|
} else if state == -3 { // Offline
|
|
} else if state == -3 { // Offline
|
|
let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
|
|
if let pin = arrayMessage.first, let index = users.firstIndex(of: User(pin: String(pin))) {
|
|
if let pin = arrayMessage.first, let index = users.firstIndex(of: User(pin: String(pin))) {
|