wire up mute button
This commit is contained in:
parent
0ffeef3ef4
commit
53697f9d7e
|
@ -77,7 +77,7 @@ class ExtensionDelegate: NSObject, WCSessionDelegate, WKExtensionDelegate {
|
|||
let conferenceURL = applicationContext["conferenceURL"] as? NSString ?? "NULL";
|
||||
print("CONFERENCE URL \(conferenceURL)");
|
||||
|
||||
let micMuted = applicationContext["micMuted"] as? NSNumber ?? -1;
|
||||
let micMuted = applicationContext["micMuted"] as? NSNumber ?? 0;
|
||||
print("MIC MUTED \(micMuted)");
|
||||
|
||||
// Update recent URLs
|
||||
|
@ -92,18 +92,22 @@ class ExtensionDelegate: NSObject, WCSessionDelegate, WKExtensionDelegate {
|
|||
if let currentController = WKExtension.shared().visibleInterfaceController as? InterfaceController {
|
||||
if conferenceURL != "NULL" {
|
||||
let room = conferenceURL.components(separatedBy: "/").last
|
||||
let context = ["room" : room, "roomUrl" : conferenceURL as String!, "skipJoin" : "yes"]
|
||||
let context = ["room" : room, "roomUrl" : conferenceURL as String!, "skipJoin" : "true", "muted" : micMuted.boolValue.description ]
|
||||
DispatchQueue.main.async {
|
||||
currentController.pushController(withName: "InCallController", context: context)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// This must be InCallController
|
||||
let controller = WKExtension.shared().visibleInterfaceController as! InCallController
|
||||
if conferenceURL == "NULL" {
|
||||
DispatchQueue.main.async {
|
||||
WKExtension.shared().visibleInterfaceController?.popToRootController()
|
||||
controller.popToRootController()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Update muted state
|
||||
controller.updateMutedButton(withMuted: micMuted.boolValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ class InCallController: WKInterfaceController {
|
|||
|
||||
@IBAction func muteClicked() {
|
||||
sendMessage(["command": "toggleMute"])
|
||||
muted = !muted
|
||||
updateMutedButton()
|
||||
updateMutedButton(withMuted: !muted)
|
||||
}
|
||||
|
||||
func sendMessage(_ message: [String : Any]) {
|
||||
|
@ -44,8 +43,9 @@ class InCallController: WKInterfaceController {
|
|||
}
|
||||
}
|
||||
|
||||
func updateMutedButton() {
|
||||
if muted {
|
||||
func updateMutedButton(withMuted isMuted: Bool) {
|
||||
muted = isMuted
|
||||
if isMuted {
|
||||
mutedButton.setBackgroundImageNamed("mute-on.png")
|
||||
} else {
|
||||
mutedButton.setBackgroundImageNamed("mute-off.png")
|
||||
|
@ -61,10 +61,7 @@ class InCallController: WKInterfaceController {
|
|||
}
|
||||
|
||||
roomLabel.setText(data["room"]!)
|
||||
|
||||
// TODO read from data
|
||||
muted = false;
|
||||
updateMutedButton()
|
||||
updateMutedButton(withMuted: data["muted"] == "true")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,6 @@ class InterfaceController: WKInterfaceController {
|
|||
|
||||
override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? {
|
||||
let controller = table.rowController(at: rowIndex) as! MeetingRowController
|
||||
return ["room" : controller.room, "roomUrl" : controller.roomUrl]
|
||||
return ["room" : controller.room, "roomUrl" : controller.roomUrl, "muted" : "false"]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue