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">
|
<controller id="AgC-eL-Hgc" customClass="InterfaceController" customModule="JitsiMeetCompanion" customModuleProvider="target">
|
||||||
<items>
|
<items>
|
||||||
<label alignment="center" verticalAlignment="center" text="Hello Jitser!" id="fxp-ol-Hnn"/>
|
<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">
|
<button width="1" alignment="left" verticalAlignment="bottom" title="Test" id="oL4-qG-LPp">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="testClicked" destination="AgC-eL-Hgc" id="xgt-e4-JKG"/>
|
<action selector="testClicked" destination="AgC-eL-Hgc" id="xgt-e4-JKG"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
</items>
|
</items>
|
||||||
|
<connections>
|
||||||
|
<outlet property="muteButton" destination="cwU-hl-IxP" id="uGI-cV-qfG"/>
|
||||||
|
</connections>
|
||||||
</controller>
|
</controller>
|
||||||
</objects>
|
</objects>
|
||||||
</scene>
|
</scene>
|
||||||
|
|
|
@ -12,13 +12,27 @@ import Foundation
|
||||||
|
|
||||||
|
|
||||||
class InterfaceController: WKInterfaceController {
|
class InterfaceController: WKInterfaceController {
|
||||||
@IBAction func testClicked() {
|
@IBOutlet var muteButton: WKInterfaceButton!
|
||||||
if WCSession.isSupported() {
|
|
||||||
let session = WCSession.default
|
@IBAction func muteClicked() {
|
||||||
session.sendMessage(["conference": "https://meet.jit.si/WatchyMcWatchFace"], replyHandler: nil, errorHandler: nil)
|
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?) {
|
override func awake(withContext context: Any?) {
|
||||||
super.awake(withContext: context)
|
super.awake(withContext: context)
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,11 @@ import { APP_WILL_MOUNT, APP_WILL_UNMOUNT, appNavigate } from '../../app';
|
||||||
import {
|
import {
|
||||||
CONFERENCE_FAILED,
|
CONFERENCE_FAILED,
|
||||||
CONFERENCE_LEFT,
|
CONFERENCE_LEFT,
|
||||||
CONFERENCE_WILL_JOIN,
|
CONFERENCE_WILL_JOIN
|
||||||
} from '../../base/conference';
|
} from '../../base/conference';
|
||||||
|
import {
|
||||||
|
toggleAudioMuted
|
||||||
|
} from '../../base/media';
|
||||||
import { MiddlewareRegistry } from '../../base/redux';
|
import { MiddlewareRegistry } from '../../base/redux';
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,16 +40,24 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch.subscribeToMessages((err, message, reply) => {
|
watch.subscribeToMessages((err, message) => {
|
||||||
if (!err) {
|
if (err) {
|
||||||
if (message.conference) {
|
|
||||||
dispatch(appNavigate(message.conference));
|
|
||||||
}
|
|
||||||
//reply({text: "message received!"});
|
|
||||||
} else {
|
|
||||||
console.log('ERROR getting watch message');
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case APP_WILL_UNMOUNT:
|
case APP_WILL_UNMOUNT:
|
||||||
|
|
Loading…
Reference in New Issue