join from the watch!

This commit is contained in:
Saúl Ibarra Corretgé 2017-09-28 13:04:56 +02:00
parent b4f236b433
commit d183d41fdf
4 changed files with 38 additions and 12 deletions

View File

@ -26,7 +26,7 @@
</label> </label>
</items> </items>
<connections> <connections>
<segue destination="9RD-qP-1Z0" kind="modal" id="Boa-6E-eZs"/> <segue destination="9RD-qP-1Z0" kind="push" id="Boa-6E-eZs"/>
</connections> </connections>
</group> </group>
<connections> <connections>
@ -44,24 +44,32 @@
</objects> </objects>
<point key="canvasLocation" x="-99" y="117"/> <point key="canvasLocation" x="-99" y="117"/>
</scene> </scene>
<!--Close--> <!--Meetings-->
<scene sceneID="ns4-Kh-qqU"> <scene sceneID="ns4-Kh-qqU">
<objects> <objects>
<controller identifier="InCallController" title="Close" hidesWhenLoading="NO" id="9RD-qP-1Z0" customClass="InCallController" customModule="JitsiMeetCompanion" customModuleProvider="target"> <controller identifier="InCallController" title="Meetings" hidesWhenLoading="NO" id="9RD-qP-1Z0" customClass="InCallController" customModule="JitsiMeetCompanion" customModuleProvider="target">
<items> <items>
<label alignment="left" text="Label" id="vFt-lL-SNY"/> <label alignment="center" text="Label" id="vFt-lL-SNY"/>
<button width="1" alignment="left" title="Hangup" id="8jF-SI-UHz"> <timer alignment="center" textAlignment="center" previewedSeconds="0" id="W8S-uZ-MPm">
<color key="textColor" red="0.024725984125768763" green="1" blue="0.24241188365329402" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="font" style="UICTFontTextStyleHeadline"/>
</timer>
<button width="1" alignment="left" verticalAlignment="bottom" title="Hangup" id="8jF-SI-UHz">
<color key="backgroundColor" red="1" green="0.13972080801548914" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="0.13972080801548914" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections> <connections>
<action selector="hangupClicked" destination="9RD-qP-1Z0" id="cXK-lw-tsd"/> <action selector="hangupClicked" destination="9RD-qP-1Z0" id="cXK-lw-tsd"/>
</connections> </connections>
</button> </button>
<button width="1" alignment="left" title="Toggle mute" id="LmN-FI-aQq"> <button width="1" alignment="left" verticalAlignment="bottom" title="Toggle mute" id="LmN-FI-aQq">
<connections> <connections>
<action selector="muteClicked" destination="9RD-qP-1Z0" id="dJg-kV-cqH"/> <action selector="muteClicked" destination="9RD-qP-1Z0" id="dJg-kV-cqH"/>
</connections> </connections>
</button> </button>
</items> </items>
<connections>
<outlet property="roomLabel" destination="vFt-lL-SNY" id="cYB-Tf-Efz"/>
<outlet property="timer" destination="W8S-uZ-MPm" id="r7T-j1-9VJ"/>
</connections>
</controller> </controller>
</objects> </objects>
<point key="canvasLocation" x="213" y="117"/> <point key="canvasLocation" x="213" y="117"/>

View File

@ -20,10 +20,12 @@ import Foundation
class InCallController: WKInterfaceController { class InCallController: WKInterfaceController {
@IBOutlet var roomLabel: WKInterfaceLabel!
@IBOutlet var timer: WKInterfaceTimer!
@IBAction func hangupClicked() { @IBAction func hangupClicked() {
sendMessage(["command": "hangup"]) sendMessage(["command": "hangup"])
dismiss() popToRootController()
} }
@IBAction func muteClicked() { @IBAction func muteClicked() {
@ -40,7 +42,10 @@ class InCallController: WKInterfaceController {
override func awake(withContext context: Any?) { override func awake(withContext context: Any?) {
super.awake(withContext: context) super.awake(withContext: context)
// Configure interface objects here. if let data = context as? [String : String] {
sendMessage(["command": "joinConference", "data" : data["roomUrl"]!])
roomLabel.setText(data["room"]!)
}
} }
override func willActivate() { override func willActivate() {
@ -48,6 +53,12 @@ class InCallController: WKInterfaceController {
super.willActivate() super.willActivate()
} }
override func didAppear() {
super.didAppear()
timer.start()
}
override func didDeactivate() { override func didDeactivate() {
// This method is called when watch view controller is no longer visible // This method is called when watch view controller is no longer visible
super.didDeactivate() super.didDeactivate()

View File

@ -41,6 +41,8 @@ class InterfaceController: WKInterfaceController {
// Update row controller // Update row controller
let controller = table.rowController(at: index) as! MeetingRowController let controller = table.rowController(at: index) as! MeetingRowController
controller.room = room
controller.roomUrl = roomURL as String!
controller.roomLabel.setText(room) controller.roomLabel.setText(room)
controller.timeLabel.setText(strDate) controller.timeLabel.setText(strDate)
} }
@ -60,4 +62,8 @@ class InterfaceController: WKInterfaceController {
super.didDeactivate() super.didDeactivate()
} }
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]
}
} }

View File

@ -17,8 +17,9 @@
import WatchKit import WatchKit
class MeetingRowController: NSObject { class MeetingRowController: NSObject {
@IBOutlet var roomLabel: WKInterfaceLabel! @IBOutlet var roomLabel: WKInterfaceLabel!
@IBOutlet var timeLabel: WKInterfaceLabel! @IBOutlet var timeLabel: WKInterfaceLabel!
var room: String!
var roomUrl: String!
} }