Sfoglia il codice sorgente

ios: update sample PiP app

- Xcode 10.2 + Swift 5
- Latest SDK API
- Fix warnings
j8
Saúl Ibarra Corretgé 6 anni fa
parent
commit
f26c5570df

+ 9
- 3
ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj Vedi File

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

+ 6
- 6
ios/example-pip-app/src/AppDelegate.swift Vedi File

22
     var window: UIWindow?
22
     var window: UIWindow?
23
 
23
 
24
     func application(_ application: UIApplication,
24
     func application(_ application: UIApplication,
25
-                     didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
25
+                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
26
         guard let launchOptions = launchOptions else { return false }
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
     // MARK: - Linking delegate methods
30
     // MARK: - Linking delegate methods
31
 
31
 
32
     func application(_ application: UIApplication,
32
     func application(_ application: UIApplication,
33
                      continue userActivity: NSUserActivity,
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 Vedi File

2
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
2
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
 <plist version="1.0">
3
 <plist version="1.0">
4
 <dict>
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
 	<key>CFBundleDevelopmentRegion</key>
9
 	<key>CFBundleDevelopmentRegion</key>
6
 	<string>$(DEVELOPMENT_LANGUAGE)</string>
10
 	<string>$(DEVELOPMENT_LANGUAGE)</string>
7
 	<key>CFBundleExecutable</key>
11
 	<key>CFBundleExecutable</key>

+ 12
- 19
ios/example-pip-app/src/ViewController.swift Vedi File

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
  * Licensed under the Apache License, Version 2.0 (the "License");
5
  * Licensed under the Apache License, Version 2.0 (the "License");
5
  * you may not use this file except in compliance with the License.
6
  * you may not use this file except in compliance with the License.
43
 
44
 
44
         // create and configure jitsimeet view
45
         // create and configure jitsimeet view
45
         let jitsiMeetView = JitsiMeetView()
46
         let jitsiMeetView = JitsiMeetView()
46
-        jitsiMeetView.welcomePageEnabled = true
47
-        jitsiMeetView.pictureInPictureEnabled = true
48
-        jitsiMeetView.load(nil)
49
         jitsiMeetView.delegate = self
47
         jitsiMeetView.delegate = self
50
         self.jitsiMeetView = jitsiMeetView
48
         self.jitsiMeetView = jitsiMeetView
49
+        let options = JitsiMeetConferenceOptions.fromBuilder { (builder) in
50
+            builder.welcomePageEnabled = true
51
+        }
52
+        jitsiMeetView.join(options)
51
 
53
 
52
         // Enable jitsimeet view to be a view that can be displayed
54
         // Enable jitsimeet view to be a view that can be displayed
53
         // on top of all the things, and let the coordinator to manage
55
         // on top of all the things, and let the coordinator to manage
68
 }
70
 }
69
 
71
 
70
 extension ViewController: JitsiMeetViewDelegate {
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
         DispatchQueue.main.async {
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
         DispatchQueue.main.async {
82
         DispatchQueue.main.async {
88
-            self.pipViewCoordinator?.hide() { _ in
89
-                self.cleanUp()
90
-            }
83
+            self.pipViewCoordinator?.enterPictureInPicture()
91
         }
84
         }
92
     }
85
     }
93
 }
86
 }

Loading…
Annulla
Salva