diff --git a/ios/app/watchos/app/Base.lproj/Interface.storyboard b/ios/app/watchos/app/Base.lproj/Interface.storyboard index 485997460..cda5e041e 100644 --- a/ios/app/watchos/app/Base.lproj/Interface.storyboard +++ b/ios/app/watchos/app/Base.lproj/Interface.storyboard @@ -15,12 +15,25 @@ + + + diff --git a/ios/app/watchos/extension/InterfaceController.swift b/ios/app/watchos/extension/InterfaceController.swift index 4f6b6b9a9..97a079262 100644 --- a/ios/app/watchos/extension/InterfaceController.swift +++ b/ios/app/watchos/extension/InterfaceController.swift @@ -12,13 +12,27 @@ import Foundation class InterfaceController: WKInterfaceController { - @IBAction func testClicked() { - if WCSession.isSupported() { - let session = WCSession.default - session.sendMessage(["conference": "https://meet.jit.si/WatchyMcWatchFace"], replyHandler: nil, errorHandler: nil) - } + @IBOutlet var muteButton: WKInterfaceButton! + + @IBAction func muteClicked() { + sendMessage(["command": "toggleMute"]) + } + + @IBAction func hangupClicked() { + sendMessage(["command": "hangup"]) + } + + @IBAction func testClicked() { + sendMessage(["command" : "joinConference", "data" : "https://meet.jit.si/notrolex"]) + } + + func sendMessage(_ message: [String : Any]) { + if WCSession.isSupported() { + let session = WCSession.default + session.sendMessage(message, replyHandler: nil, errorHandler: nil) } - + } + override func awake(withContext context: Any?) { super.awake(withContext: context) diff --git a/react/features/mobile/watchos/middleware.js b/react/features/mobile/watchos/middleware.js index 8eecef79c..d1716d26a 100644 --- a/react/features/mobile/watchos/middleware.js +++ b/react/features/mobile/watchos/middleware.js @@ -7,8 +7,11 @@ import { APP_WILL_MOUNT, APP_WILL_UNMOUNT, appNavigate } from '../../app'; import { CONFERENCE_FAILED, CONFERENCE_LEFT, - CONFERENCE_WILL_JOIN, + CONFERENCE_WILL_JOIN } from '../../base/conference'; +import { + toggleAudioMuted +} from '../../base/media'; import { MiddlewareRegistry } from '../../base/redux'; @@ -37,16 +40,24 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { } }); - watch.subscribeToMessages((err, message, reply) => { - if (!err) { - if (message.conference) { - dispatch(appNavigate(message.conference)); - } - //reply({text: "message received!"}); - } else { + watch.subscribeToMessages((err, message) => { + if (err) { console.log('ERROR getting watch message'); + } else { + switch (message.command) { + case 'joinConference': + dispatch(appNavigate(message.data)); + break; + case 'toggleMute': + dispatch(toggleAudioMuted()); + break; + case 'hangup': + dispatch(appNavigate(undefined)); + break; + } } }); + break; } case APP_WILL_UNMOUNT: