Procházet zdrojové kódy

ios: update sample PiP app

- Xcode 10.2 + Swift 5
- Latest SDK API
- Fix warnings
j8
Saúl Ibarra Corretgé před 6 roky
rodič
revize
f26c5570df

+ 9
- 3
ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj Zobrazit soubor

@@ -128,7 +128,7 @@
128 128
 			isa = PBXProject;
129 129
 			attributes = {
130 130
 				LastSwiftUpdateCheck = 0920;
131
-				LastUpgradeCheck = 0920;
131
+				LastUpgradeCheck = 1020;
132 132
 				ORGANIZATIONNAME = "Atlassian Inc";
133 133
 				TargetAttributes = {
134 134
 					C6F99C36204DE6BE0001F710 = {
@@ -264,6 +264,7 @@
264 264
 				CLANG_WARN_BOOL_CONVERSION = YES;
265 265
 				CLANG_WARN_COMMA = YES;
266 266
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
267
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
267 268
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
268 269
 				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
269 270
 				CLANG_WARN_EMPTY_BODY = YES;
@@ -271,6 +272,7 @@
271 272
 				CLANG_WARN_INFINITE_RECURSION = YES;
272 273
 				CLANG_WARN_INT_CONVERSION = YES;
273 274
 				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
275
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
274 276
 				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
275 277
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
276 278
 				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -321,6 +323,7 @@
321 323
 				CLANG_WARN_BOOL_CONVERSION = YES;
322 324
 				CLANG_WARN_COMMA = YES;
323 325
 				CLANG_WARN_CONSTANT_CONVERSION = YES;
326
+				CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
324 327
 				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
325 328
 				CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
326 329
 				CLANG_WARN_EMPTY_BODY = YES;
@@ -328,6 +331,7 @@
328 331
 				CLANG_WARN_INFINITE_RECURSION = YES;
329 332
 				CLANG_WARN_INT_CONVERSION = YES;
330 333
 				CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
334
+				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
331 335
 				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
332 336
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
333 337
 				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -360,6 +364,7 @@
360 364
 		C6F99C4A204DE6BE0001F710 /* Debug */ = {
361 365
 			isa = XCBuildConfiguration;
362 366
 			buildSettings = {
367
+				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
363 368
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
364 369
 				CODE_SIGN_STYLE = Automatic;
365 370
 				FRAMEWORK_SEARCH_PATHS = "../../node_modules/react-native-webrtc/ios";
@@ -368,7 +373,7 @@
368 373
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
369 374
 				PRODUCT_BUNDLE_IDENTIFIER = "com.jitsi.example-pip-app";
370 375
 				PRODUCT_NAME = "$(TARGET_NAME)";
371
-				SWIFT_VERSION = 4.0;
376
+				SWIFT_VERSION = 5.0;
372 377
 				TARGETED_DEVICE_FAMILY = "1,2";
373 378
 			};
374 379
 			name = Debug;
@@ -376,6 +381,7 @@
376 381
 		C6F99C4B204DE6BE0001F710 /* Release */ = {
377 382
 			isa = XCBuildConfiguration;
378 383
 			buildSettings = {
384
+				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
379 385
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
380 386
 				CODE_SIGN_STYLE = Automatic;
381 387
 				FRAMEWORK_SEARCH_PATHS = "../../node_modules/react-native-webrtc/ios";
@@ -384,7 +390,7 @@
384 390
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
385 391
 				PRODUCT_BUNDLE_IDENTIFIER = "com.jitsi.example-pip-app";
386 392
 				PRODUCT_NAME = "$(TARGET_NAME)";
387
-				SWIFT_VERSION = 4.0;
393
+				SWIFT_VERSION = 5.0;
388 394
 				TARGETED_DEVICE_FAMILY = "1,2";
389 395
 			};
390 396
 			name = Release;

+ 6
- 6
ios/example-pip-app/src/AppDelegate.swift Zobrazit soubor

@@ -22,20 +22,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
22 22
     var window: UIWindow?
23 23
 
24 24
     func application(_ application: UIApplication,
25
-                     didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
25
+                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
26 26
         guard let launchOptions = launchOptions else { return false }
27
-        return JitsiMeetView.application(application, didFinishLaunchingWithOptions: launchOptions)
27
+        return JitsiMeet.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
28 28
     }
29 29
 
30 30
     // MARK: - Linking delegate methods
31 31
 
32 32
     func application(_ application: UIApplication,
33 33
                      continue userActivity: NSUserActivity,
34
-                     restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
35
-        return JitsiMeetView.application(application, continue: userActivity, restorationHandler: restorationHandler)
34
+                     restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
35
+        return JitsiMeet.sharedInstance().application(application, continue: userActivity, restorationHandler: restorationHandler)
36 36
     }
37 37
 
38
-    func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
39
-        return JitsiMeetView.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
38
+    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
39
+        return JitsiMeet.sharedInstance().application(app, open: url, options: options)
40 40
     }
41 41
 }

+ 4
- 0
ios/example-pip-app/src/Info.plist Zobrazit soubor

@@ -2,6 +2,10 @@
2 2
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 3
 <plist version="1.0">
4 4
 <dict>
5
+	<key>NSMicrophoneUsageDescription</key>
6
+	<string>The microphone is needed for making calls</string>
7
+	<key>NSCameraUsageDescription</key>
8
+	<string>The camera is needed for making calls</string>
5 9
 	<key>CFBundleDevelopmentRegion</key>
6 10
 	<string>$(DEVELOPMENT_LANGUAGE)</string>
7 11
 	<key>CFBundleExecutable</key>

+ 12
- 19
ios/example-pip-app/src/ViewController.swift Zobrazit soubor

@@ -1,5 +1,6 @@
1 1
 /*
2
- * Copyright @ 2017-present Atlassian Pty Ltd
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ * Copyright @ 2017-2018 Atlassian Pty Ltd
3 4
  *
4 5
  * Licensed under the Apache License, Version 2.0 (the "License");
5 6
  * you may not use this file except in compliance with the License.
@@ -43,11 +44,12 @@ class ViewController: UIViewController {
43 44
 
44 45
         // create and configure jitsimeet view
45 46
         let jitsiMeetView = JitsiMeetView()
46
-        jitsiMeetView.welcomePageEnabled = true
47
-        jitsiMeetView.pictureInPictureEnabled = true
48
-        jitsiMeetView.load(nil)
49 47
         jitsiMeetView.delegate = self
50 48
         self.jitsiMeetView = jitsiMeetView
49
+        let options = JitsiMeetConferenceOptions.fromBuilder { (builder) in
50
+            builder.welcomePageEnabled = true
51
+        }
52
+        jitsiMeetView.join(options)
51 53
 
52 54
         // Enable jitsimeet view to be a view that can be displayed
53 55
         // on top of all the things, and let the coordinator to manage
@@ -68,26 +70,17 @@ class ViewController: UIViewController {
68 70
 }
69 71
 
70 72
 extension ViewController: JitsiMeetViewDelegate {
71
-
72
-    func conferenceFailed(_ data: [AnyHashable : Any]!) {
73
-        hideJitsiMeetViewAndCleanUp()
74
-    }
75
-
76
-    func conferenceLeft(_ data: [AnyHashable : Any]!) {
77
-        hideJitsiMeetViewAndCleanUp()
78
-    }
79
-
80
-    func enterPicture(inPicture data: [AnyHashable : Any]!) {
73
+    func conferenceTerminated(_ data: [AnyHashable : Any]!) {
81 74
         DispatchQueue.main.async {
82
-            self.pipViewCoordinator?.enterPictureInPicture()
75
+            self.pipViewCoordinator?.hide() { _ in
76
+                self.cleanUp()
77
+            }
83 78
         }
84 79
     }
85 80
 
86
-    private func hideJitsiMeetViewAndCleanUp() {
81
+    func enterPicture(inPicture data: [AnyHashable : Any]!) {
87 82
         DispatchQueue.main.async {
88
-            self.pipViewCoordinator?.hide() { _ in
89
-                self.cleanUp()
90
-            }
83
+            self.pipViewCoordinator?.enterPictureInPicture()
91 84
         }
92 85
     }
93 86
 }

Načítá se…
Zrušit
Uložit