瀏覽代碼

watchos: display a message if the recent list is empty

master
paweldomas 6 年之前
父節點
當前提交
1bc28e4904

+ 2
- 0
ios/app/watchos/app/Base.lproj/Interface.storyboard 查看文件

14
             <objects>
14
             <objects>
15
                 <controller title="Meetings" id="AgC-eL-Hgc" customClass="InterfaceController" customModule="JitsiMeetCompanion" customModuleProvider="target">
15
                 <controller title="Meetings" id="AgC-eL-Hgc" customClass="InterfaceController" customModule="JitsiMeetCompanion" customModuleProvider="target">
16
                     <items>
16
                     <items>
17
+                        <label alignment="left" textAlignment="left" numberOfLines="0" id="OQN-sx-tDt"/>
17
                         <table alignment="left" id="gpO-ql-Xsr">
18
                         <table alignment="left" id="gpO-ql-Xsr">
18
                             <items>
19
                             <items>
19
                                 <tableRow identifier="MeetingRowType" id="GGl-av-xeJ" customClass="MeetingRowController" customModule="JitsiMeetCompanion_Extension">
20
                                 <tableRow identifier="MeetingRowType" id="GGl-av-xeJ" customClass="MeetingRowController" customModule="JitsiMeetCompanion_Extension">
39
                         </table>
40
                         </table>
40
                     </items>
41
                     </items>
41
                     <connections>
42
                     <connections>
43
+                        <outlet property="infoLabel" destination="OQN-sx-tDt" id="Juv-tb-SNj"/>
42
                         <outlet property="table" destination="gpO-ql-Xsr" id="aVV-iZ-z3l"/>
44
                         <outlet property="table" destination="gpO-ql-Xsr" id="aVV-iZ-z3l"/>
43
                     </connections>
45
                     </connections>
44
                 </controller>
46
                 </controller>

+ 18
- 4
ios/app/watchos/extension/InterfaceController.swift 查看文件

16
  */
16
  */
17
 
17
 
18
 import WatchKit
18
 import WatchKit
19
+import WatchConnectivity
19
 import Foundation
20
 import Foundation
20
 
21
 
21
 
22
 
22
 class InterfaceController: WKInterfaceController {
23
 class InterfaceController: WKInterfaceController {
23
 
24
 
25
+    @IBOutlet var infoLabel: WKInterfaceLabel!
24
     @IBOutlet var table: WKInterfaceTable!
26
     @IBOutlet var table: WKInterfaceTable!
25
 
27
 
28
+    override func didAppear(){
29
+        self.updateUI(ExtensionDelegate.currentJitsiMeetContext)
30
+    }
31
+
26
     func updateUI(_ newContext:JitsiMeetContext) {
32
     func updateUI(_ newContext:JitsiMeetContext) {
27
-        if let recentURLsArray = newContext.recentURLs {
28
-            updateRecents(withRecents:  recentURLsArray, currentContext: newContext)
29
-        }
33
+      if (newContext.recentURLs == nil || newContext.recentURLs!.count == 0) {
34
+        infoLabel.setText("There are no recent meetings. Please use the app on the phone to start a new call.")
35
+
36
+        table.setHidden(true)
37
+        infoLabel.setHidden(false)
38
+      } else {
39
+        updateRecents(withRecents: newContext.recentURLs!, currentContext: newContext)
40
+
41
+        table.setHidden(false)
42
+        infoLabel.setHidden(true)
43
+      }
30
     }
44
     }
31
 
45
 
32
     private func updateRecents(withRecents recents: NSArray, currentContext: JitsiMeetContext) {
46
     private func updateRecents(withRecents recents: NSArray, currentContext: JitsiMeetContext) {
68
     override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? {
82
     override func contextForSegue(withIdentifier segueIdentifier: String, in table: WKInterfaceTable, rowIndex: Int) -> Any? {
69
         let controller = table.rowController(at: rowIndex) as! MeetingRowController
83
         let controller = table.rowController(at: rowIndex) as! MeetingRowController
70
         let currentContext = ExtensionDelegate.currentJitsiMeetContext
84
         let currentContext = ExtensionDelegate.currentJitsiMeetContext
71
-      
85
+
72
         // Copy the current context and add the joinConferenceURL to trigger the command when the in-call screen is displayed
86
         // Copy the current context and add the joinConferenceURL to trigger the command when the in-call screen is displayed
73
         let actionContext = JitsiMeetContext(jmContext: currentContext)
87
         let actionContext = JitsiMeetContext(jmContext: currentContext)
74
         actionContext.joinConferenceURL = controller.roomUrl
88
         actionContext.joinConferenceURL = controller.roomUrl

Loading…
取消
儲存