WIP: buttons!
This commit is contained in:
parent
93aa8c5883
commit
94a26a33c6
|
@ -15,12 +15,25 @@
|
|||
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModule="JitsiMeetCompanion" customModuleProvider="target">
|
||||
<items>
|
||||
<label alignment="center" verticalAlignment="center" text="Hello Jitser!" id="fxp-ol-Hnn"/>
|
||||
<button width="1" alignment="left" verticalAlignment="center" title="Mute" id="cwU-hl-IxP">
|
||||
<connections>
|
||||
<action selector="muteClicked" destination="AgC-eL-Hgc" id="ypa-fw-9o2"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button width="1" alignment="left" verticalAlignment="center" title="Hangup" id="OjW-qU-iJl">
|
||||
<connections>
|
||||
<action selector="hangupClicked" destination="AgC-eL-Hgc" id="G2E-OF-Qls"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button width="1" alignment="left" verticalAlignment="bottom" title="Test" id="oL4-qG-LPp">
|
||||
<connections>
|
||||
<action selector="testClicked" destination="AgC-eL-Hgc" id="xgt-e4-JKG"/>
|
||||
</connections>
|
||||
</button>
|
||||
</items>
|
||||
<connections>
|
||||
<outlet property="muteButton" destination="cwU-hl-IxP" id="uGI-cV-qfG"/>
|
||||
</connections>
|
||||
</controller>
|
||||
</objects>
|
||||
</scene>
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue