浏览代码

Addressing feedback from PR

master
Daniel Ornelas 7 年前
父节点
当前提交
5858859838

+ 3
- 3
ios/app/src/Info.plist 查看文件

55
 			</dict>
55
 			</dict>
56
 		</dict>
56
 		</dict>
57
 	</dict>
57
 	</dict>
58
-    <key>NSCalendarsUsageDescription</key>
59
-    <string>Displays the user's meetings in the app.</string>
58
+        <key>NSCalendarsUsageDescription</key>
59
+        <string>See your scheduled conferences in the app.</string>
60
 	<key>NSCameraUsageDescription</key>
60
 	<key>NSCameraUsageDescription</key>
61
 	<string>Participate in conferences with video.</string>
61
 	<string>Participate in conferences with video.</string>
62
 	<key>NSLocationWhenInUseUsageDescription</key>
62
 	<key>NSLocationWhenInUseUsageDescription</key>
63
 	<string></string>
63
 	<string></string>
64
 	<key>NSMicrophoneUsageDescription</key>
64
 	<key>NSMicrophoneUsageDescription</key>
65
-	<string>Participate in conferences with audio.</string>
65
+	<string>Participate in conferences with voice.</string>
66
 	<key>UIBackgroundModes</key>
66
 	<key>UIBackgroundModes</key>
67
 	<array>
67
 	<array>
68
 		<string>audio</string>
68
 		<string>audio</string>

ios/example-pip-app/PiPApp.xcodeproj/project.pbxproj → ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj 查看文件

35
 
35
 
36
 /* Begin PBXFileReference section */
36
 /* Begin PBXFileReference section */
37
 		C6A34247204DF18000E062DD /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = "../../node_modules/react-native-webrtc/ios/WebRTC.framework"; sourceTree = "<group>"; };
37
 		C6A34247204DF18000E062DD /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = "../../node_modules/react-native-webrtc/ios/WebRTC.framework"; sourceTree = "<group>"; };
38
-		C6F99C37204DE6BE0001F710 /* PiPApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PiPApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
38
+		C6F99C37204DE6BE0001F710 /* example-pip-app.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example-pip-app.app; sourceTree = BUILT_PRODUCTS_DIR; };
39
 		C6F99C3A204DE6BE0001F710 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
39
 		C6F99C3A204DE6BE0001F710 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
40
 		C6F99C3C204DE6BE0001F710 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
40
 		C6F99C3C204DE6BE0001F710 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
41
 		C6F99C3F204DE6BE0001F710 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
41
 		C6F99C3F204DE6BE0001F710 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
70
 		C6F99C38204DE6BE0001F710 /* Products */ = {
70
 		C6F99C38204DE6BE0001F710 /* Products */ = {
71
 			isa = PBXGroup;
71
 			isa = PBXGroup;
72
 			children = (
72
 			children = (
73
-				C6F99C37204DE6BE0001F710 /* PiPApp.app */,
73
+				C6F99C37204DE6BE0001F710 /* example-pip-app.app */,
74
 			);
74
 			);
75
 			name = Products;
75
 			name = Products;
76
 			sourceTree = "<group>";
76
 			sourceTree = "<group>";
100
 /* End PBXGroup section */
100
 /* End PBXGroup section */
101
 
101
 
102
 /* Begin PBXNativeTarget section */
102
 /* Begin PBXNativeTarget section */
103
-		C6F99C36204DE6BE0001F710 /* PiPApp */ = {
103
+		C6F99C36204DE6BE0001F710 /* example-pip-app */ = {
104
 			isa = PBXNativeTarget;
104
 			isa = PBXNativeTarget;
105
-			buildConfigurationList = C6F99C49204DE6BE0001F710 /* Build configuration list for PBXNativeTarget "PiPApp" */;
105
+			buildConfigurationList = C6F99C49204DE6BE0001F710 /* Build configuration list for PBXNativeTarget "example-pip-app" */;
106
 			buildPhases = (
106
 			buildPhases = (
107
 				C6A3424A204DF91D00E062DD /* Run Adjust ATS for loading JS bundle */,
107
 				C6A3424A204DF91D00E062DD /* Run Adjust ATS for loading JS bundle */,
108
 				C6F99C62204DEFFE0001F710 /* Run React Packager */,
108
 				C6F99C62204DEFFE0001F710 /* Run React Packager */,
116
 			);
116
 			);
117
 			dependencies = (
117
 			dependencies = (
118
 			);
118
 			);
119
-			name = PiPApp;
120
-			productName = ExampleAppUsingJitsiWithPiP;
121
-			productReference = C6F99C37204DE6BE0001F710 /* PiPApp.app */;
119
+			name = example-pip-app;
120
+			productName = example-pip-app;
121
+			productReference = C6F99C37204DE6BE0001F710 /* example-pip-app.app */;
122
 			productType = "com.apple.product-type.application";
122
 			productType = "com.apple.product-type.application";
123
 		};
123
 		};
124
 /* End PBXNativeTarget section */
124
 /* End PBXNativeTarget section */
142
 					};
142
 					};
143
 				};
143
 				};
144
 			};
144
 			};
145
-			buildConfigurationList = C6F99C32204DE6BE0001F710 /* Build configuration list for PBXProject "PiPApp" */;
145
+			buildConfigurationList = C6F99C32204DE6BE0001F710 /* Build configuration list for PBXProject "example-pip-app" */;
146
 			compatibilityVersion = "Xcode 8.0";
146
 			compatibilityVersion = "Xcode 8.0";
147
 			developmentRegion = en;
147
 			developmentRegion = en;
148
 			hasScannedForEncodings = 0;
148
 			hasScannedForEncodings = 0;
155
 			projectDirPath = "";
155
 			projectDirPath = "";
156
 			projectRoot = "";
156
 			projectRoot = "";
157
 			targets = (
157
 			targets = (
158
-				C6F99C36204DE6BE0001F710 /* PiPApp */,
158
+				C6F99C36204DE6BE0001F710 /* example-pip-app */,
159
 			);
159
 			);
160
 		};
160
 		};
161
 /* End PBXProject section */
161
 /* End PBXProject section */
366
 				INFOPLIST_FILE = src/Info.plist;
366
 				INFOPLIST_FILE = src/Info.plist;
367
 				IPHONEOS_DEPLOYMENT_TARGET = 10.3;
367
 				IPHONEOS_DEPLOYMENT_TARGET = 10.3;
368
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
368
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
369
-				PRODUCT_BUNDLE_IDENTIFIER = com.jitsi.PiPApp;
369
+				PRODUCT_BUNDLE_IDENTIFIER = com.jitsi.example-pip-app;
370
 				PRODUCT_NAME = "$(TARGET_NAME)";
370
 				PRODUCT_NAME = "$(TARGET_NAME)";
371
 				SWIFT_VERSION = 4.0;
371
 				SWIFT_VERSION = 4.0;
372
 				TARGETED_DEVICE_FAMILY = "1,2";
372
 				TARGETED_DEVICE_FAMILY = "1,2";
382
 				INFOPLIST_FILE = src/Info.plist;
382
 				INFOPLIST_FILE = src/Info.plist;
383
 				IPHONEOS_DEPLOYMENT_TARGET = 10.3;
383
 				IPHONEOS_DEPLOYMENT_TARGET = 10.3;
384
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
384
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
385
-				PRODUCT_BUNDLE_IDENTIFIER = com.jitsi.PiPApp;
385
+				PRODUCT_BUNDLE_IDENTIFIER = com.jitsi.example-pip-app;
386
 				PRODUCT_NAME = "$(TARGET_NAME)";
386
 				PRODUCT_NAME = "$(TARGET_NAME)";
387
 				SWIFT_VERSION = 4.0;
387
 				SWIFT_VERSION = 4.0;
388
 				TARGETED_DEVICE_FAMILY = "1,2";
388
 				TARGETED_DEVICE_FAMILY = "1,2";
392
 /* End XCBuildConfiguration section */
392
 /* End XCBuildConfiguration section */
393
 
393
 
394
 /* Begin XCConfigurationList section */
394
 /* Begin XCConfigurationList section */
395
-		C6F99C32204DE6BE0001F710 /* Build configuration list for PBXProject "PiPApp" */ = {
395
+		C6F99C32204DE6BE0001F710 /* Build configuration list for PBXProject "example-pip-app" */ = {
396
 			isa = XCConfigurationList;
396
 			isa = XCConfigurationList;
397
 			buildConfigurations = (
397
 			buildConfigurations = (
398
 				C6F99C47204DE6BE0001F710 /* Debug */,
398
 				C6F99C47204DE6BE0001F710 /* Debug */,
401
 			defaultConfigurationIsVisible = 0;
401
 			defaultConfigurationIsVisible = 0;
402
 			defaultConfigurationName = Release;
402
 			defaultConfigurationName = Release;
403
 		};
403
 		};
404
-		C6F99C49204DE6BE0001F710 /* Build configuration list for PBXNativeTarget "PiPApp" */ = {
404
+		C6F99C49204DE6BE0001F710 /* Build configuration list for PBXNativeTarget "example-pip-app" */ = {
405
 			isa = XCConfigurationList;
405
 			isa = XCConfigurationList;
406
 			buildConfigurations = (
406
 			buildConfigurations = (
407
 				C6F99C4A204DE6BE0001F710 /* Debug */,
407
 				C6F99C4A204DE6BE0001F710 /* Debug */,

+ 15
- 9
ios/example-pip-app/src/AppDelegate.swift 查看文件

1
-//
2
-//  AppDelegate.swift
3
-//  ExampleAppUsingJitsiWithPiP
4
-//
5
-//  Created by Daniel Ornelas on 3/5/18.
6
-//  Copyright © 2018 Atlassian Inc. All rights reserved.
7
-//
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * 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 obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
8
 
16
 
9
 import JitsiMeet
17
 import JitsiMeet
10
 
18
 
30
     func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
38
     func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
31
         return JitsiMeetView.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
39
         return JitsiMeetView.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
32
     }
40
     }
33
-
34
 }
41
 }
35
-

+ 4
- 4
ios/example-pip-app/src/Base.lproj/Main.storyboard 查看文件

13
         <!--View Controller-->
13
         <!--View Controller-->
14
         <scene sceneID="tne-QT-ifu">
14
         <scene sceneID="tne-QT-ifu">
15
             <objects>
15
             <objects>
16
-                <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="PiPApp" customModuleProvider="target" sceneMemberID="viewController">
16
+                <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="example-pip-app" customModuleProvider="target" sceneMemberID="viewController">
17
                     <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
17
                     <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
18
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
18
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
19
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
20
                         <subviews>
20
                         <subviews>
21
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QxY-C8-fwD">
21
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="QxY-C8-fwD">
22
-                                <rect key="frame" x="144.5" y="324.5" width="86" height="38"/>
22
+                                <rect key="frame" x="116" y="324.5" width="143" height="38"/>
23
                                 <fontDescription key="fontDescription" type="system" pointSize="21"/>
23
                                 <fontDescription key="fontDescription" type="system" pointSize="21"/>
24
-                                <state key="normal" title="Start Jitsi"/>
24
+                                <state key="normal" title="Open Jitsi Meet"/>
25
                                 <connections>
25
                                 <connections>
26
-                                    <action selector="startMeetingWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="79C-XR-05w"/>
26
+                                    <action selector="openJitsiMeetWithSender:" destination="BYZ-38-t0r" eventType="touchUpInside" id="79C-XR-05w"/>
27
                                 </connections>
27
                                 </connections>
28
                             </button>
28
                             </button>
29
                         </subviews>
29
                         </subviews>

+ 22
- 15
ios/example-pip-app/src/ViewController.swift 查看文件

1
-//
2
-//  ViewController.swift
3
-//  ExampleAppUsingJitsiWithPiP
4
-//
5
-//  Created by Daniel Ornelas on 3/5/18.
6
-//  Copyright © 2018 Atlassian Inc. All rights reserved.
7
-//
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * 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 obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
8
 
16
 
9
 import UIKit
17
 import UIKit
10
 import JitsiMeet
18
 import JitsiMeet
13
 
21
 
14
     @IBOutlet weak var videoButton: UIButton?
22
     @IBOutlet weak var videoButton: UIButton?
15
     
23
     
16
-    private var jitsiMeetManager: JitsiMeetManager?
24
+    private var jitsiMeetCoordinator: JitsiMeetPresentationCoordinator?
17
     
25
     
18
     override func viewDidLoad() {
26
     override func viewDidLoad() {
19
         super.viewDidLoad()
27
         super.viewDidLoad()
21
     
29
     
22
     // MARK: - Actions
30
     // MARK: - Actions
23
     
31
     
24
-    @IBAction func startMeeting(sender: Any?) {
25
-        //let url = URL(string: "")
26
-        self.jitsiMeetManager = JitsiMeetManager()
27
-        jitsiMeetManager?.welcomeScreenEnabled = true
28
-        jitsiMeetManager?.load(withUrl: nil)
32
+    @IBAction func openJitsiMeet(sender: Any?) {
33
+        let jitsiMeetCoordinator = JitsiMeetPresentationCoordinator()
34
+        self.jitsiMeetCoordinator = jitsiMeetCoordinator
35
+        jitsiMeetCoordinator.jitsiMeetView().welcomePageEnabled = true
36
+        jitsiMeetCoordinator.jitsiMeetView().load(nil)
37
+        jitsiMeetCoordinator.show()
29
     }
38
     }
30
-
31
 }
39
 }
32
-

+ 1
- 1
ios/jitsi-meet.xcworkspace/contents.xcworkspacedata 查看文件

2
 <Workspace
2
 <Workspace
3
    version = "1.0">
3
    version = "1.0">
4
    <FileRef
4
    <FileRef
5
-      location = "group:example-pip-app/PiPApp.xcodeproj">
5
+      location = "group:example-pip-app/example-pip-app.xcodeproj">
6
    </FileRef>
6
    </FileRef>
7
    <FileRef
7
    <FileRef
8
       location = "group:app/app.xcodeproj">
8
       location = "group:app/app.xcodeproj">

+ 10
- 18
ios/sdk/sdk.xcodeproj/project.pbxproj 查看文件

30
 		C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
30
 		C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
31
 		C6245F5E2053091D0040BE68 /* image-resize@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5C2053091D0040BE68 /* image-resize@3x.png */; };
31
 		C6245F5E2053091D0040BE68 /* image-resize@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5C2053091D0040BE68 /* image-resize@3x.png */; };
32
 		C6A3425F204EF76800E062DD /* PiPWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425C204EF76800E062DD /* PiPWindow.swift */; };
32
 		C6A3425F204EF76800E062DD /* PiPWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425C204EF76800E062DD /* PiPWindow.swift */; };
33
-		C6A34260204EF76800E062DD /* JitsiMeetManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425D204EF76800E062DD /* JitsiMeetManager.swift */; };
33
+		C6A34260204EF76800E062DD /* JitsiMeetPresentationCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425D204EF76800E062DD /* JitsiMeetPresentationCoordinator.swift */; };
34
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
34
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
35
 		C6A3426D204F1C3300E062DD /* JitsiMeetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3426C204F1C3300E062DD /* JitsiMeetViewController.swift */; };
35
 		C6A3426D204F1C3300E062DD /* JitsiMeetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3426C204F1C3300E062DD /* JitsiMeetViewController.swift */; };
36
 		C6F99C15204DB63E0001F710 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */; };
36
 		C6F99C15204DB63E0001F710 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */; };
62
 		0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
62
 		0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
63
 		98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
63
 		98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
64
 		9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
64
 		9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
65
-		C6245F5B2053091D0040BE68 /* image-resize@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image-resize@2x.png"; sourceTree = "<group>"; };
66
-		C6245F5C2053091D0040BE68 /* image-resize@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "image-resize@3x.png"; sourceTree = "<group>"; };
65
+		C6245F5B2053091D0040BE68 /* image-resize@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "image-resize@2x.png"; path = "src/picture-in-picture/image-resize@2x.png"; sourceTree = "<group>"; };
66
+		C6245F5C2053091D0040BE68 /* image-resize@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "image-resize@3x.png"; path = "src/picture-in-picture/image-resize@3x.png"; sourceTree = "<group>"; };
67
 		C6A3425C204EF76800E062DD /* PiPWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PiPWindow.swift; sourceTree = "<group>"; };
67
 		C6A3425C204EF76800E062DD /* PiPWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PiPWindow.swift; sourceTree = "<group>"; };
68
-		C6A3425D204EF76800E062DD /* JitsiMeetManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JitsiMeetManager.swift; sourceTree = "<group>"; };
68
+		C6A3425D204EF76800E062DD /* JitsiMeetPresentationCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JitsiMeetPresentationCoordinator.swift; sourceTree = "<group>"; };
69
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
69
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
70
 		C6A3426C204F1C3300E062DD /* JitsiMeetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JitsiMeetViewController.swift; sourceTree = "<group>"; };
70
 		C6A3426C204F1C3300E062DD /* JitsiMeetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JitsiMeetViewController.swift; sourceTree = "<group>"; };
71
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
71
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
119
 		0BD906E71EC0C00300C8C18E /* src */ = {
119
 		0BD906E71EC0C00300C8C18E /* src */ = {
120
 			isa = PBXGroup;
120
 			isa = PBXGroup;
121
 			children = (
121
 			children = (
122
-				C6A3426B204F127900E062DD /* JitsiMeetManager */,
122
+				C6A3426B204F127900E062DD /* picture-in-picture */,
123
 				0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
123
 				0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
124
 				0BB9AD7C1F60356D001C08DB /* AppInfo.m */,
124
 				0BB9AD7C1F60356D001C08DB /* AppInfo.m */,
125
 				0BB9AD7A1F5EC8F4001C08DB /* CallKit.m */,
125
 				0BB9AD7A1F5EC8F4001C08DB /* CallKit.m */,
161
 			name = Pods;
161
 			name = Pods;
162
 			sourceTree = "<group>";
162
 			sourceTree = "<group>";
163
 		};
163
 		};
164
-		C6245F5A2052043F0040BE68 /* PiPWindow */ = {
164
+		C6A3426B204F127900E062DD /* picture-in-picture */ = {
165
 			isa = PBXGroup;
165
 			isa = PBXGroup;
166
 			children = (
166
 			children = (
167
 				C6A3425E204EF76800E062DD /* DragGestureController.swift */,
167
 				C6A3425E204EF76800E062DD /* DragGestureController.swift */,
168
-				C6A3425C204EF76800E062DD /* PiPWindow.swift */,
169
-			);
170
-			path = PiPWindow;
171
-			sourceTree = "<group>";
172
-		};
173
-		C6A3426B204F127900E062DD /* JitsiMeetManager */ = {
174
-			isa = PBXGroup;
175
-			children = (
176
-				C6245F5A2052043F0040BE68 /* PiPWindow */,
177
-				C6A3425D204EF76800E062DD /* JitsiMeetManager.swift */,
168
+				C6A3425D204EF76800E062DD /* JitsiMeetPresentationCoordinator.swift */,
178
 				C6A3426C204F1C3300E062DD /* JitsiMeetViewController.swift */,
169
 				C6A3426C204F1C3300E062DD /* JitsiMeetViewController.swift */,
170
+				C6A3425C204EF76800E062DD /* PiPWindow.swift */,
179
 			);
171
 			);
180
-			path = JitsiMeetManager;
172
+			path = "picture-in-picture";
181
 			sourceTree = "<group>";
173
 			sourceTree = "<group>";
182
 		};
174
 		};
183
 /* End PBXGroup section */
175
 /* End PBXGroup section */
345
 			buildActionMask = 2147483647;
337
 			buildActionMask = 2147483647;
346
 			files = (
338
 			files = (
347
 				0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
339
 				0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
348
-				C6A34260204EF76800E062DD /* JitsiMeetManager.swift in Sources */,
340
+				C6A34260204EF76800E062DD /* JitsiMeetPresentationCoordinator.swift in Sources */,
349
 				0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
341
 				0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
350
 				0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */,
342
 				0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */,
351
 				0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */,
343
 				0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */,

+ 0
- 101
ios/sdk/src/JitsiMeetManager/JitsiMeetManager.swift 查看文件

1
-//  Copyright © 2018 Jitsi. All rights reserved.
2
-
3
-import Foundation
4
-
5
-/// Creates and coordinates the presentation of JitsiMeetViewController inside of an external window
6
-/// which can be resized and dragged with custom PiP mode
7
-open class JitsiMeetManager: NSObject {
8
-    
9
-    /// Defines if welcome screen should be on
10
-    public var welcomeScreenEnabled: Bool = false {
11
-        didSet {
12
-            meetViewController?.jitsiMeetView.welcomePageEnabled = welcomeScreenEnabled
13
-        }
14
-    }
15
-    
16
-    private(set) var meetViewController: JitsiMeetViewController?
17
-    private(set) var meetWindow: PiPWindow?
18
-    
19
-    override public init() {
20
-        super.init()
21
-        self.meetViewController = makeMeetViewController()
22
-        self.meetWindow = makeMeetWindow()
23
-    }
24
-    
25
-    public init(meetViewController: JitsiMeetViewController? = nil, meetWindow: PiPWindow? = nil) {
26
-        super.init()
27
-        self.meetViewController = meetViewController ?? makeMeetViewController()
28
-        self.meetWindow = meetWindow ?? makeMeetWindow()
29
-    }
30
-    
31
-    /// Presents and loads a jitsi meet view
32
-    ///
33
-    /// - Parameter url: The url of the presentation
34
-    public func load(withUrl url: URL?) {
35
-        meetWindow?.show()
36
-        meetViewController?.jitsiMeetView.load(url)
37
-    }
38
-    
39
-    /// Presents and loads a jitsi meet view with configuration
40
-    ///
41
-    /// - Parameter urlObject: A dictionary of keys to be used for configuration
42
-    public func load(withUrlObject urlObject: [AnyHashable : Any]?) {
43
-        meetWindow?.show()
44
-        meetViewController?.jitsiMeetView.loadURLObject(urlObject)
45
-    }
46
-    
47
-    deinit {
48
-        cleanUp()
49
-    }
50
-    
51
-    // MARK: - helpers
52
-    
53
-    fileprivate func cleanUp() {
54
-        // TODO: more clean up work on this
55
-        
56
-        meetWindow?.isHidden = true
57
-        meetWindow?.stopDragGesture()
58
-    }
59
-    
60
-    private func makeMeetViewController() -> JitsiMeetViewController {
61
-        let vc = JitsiMeetViewController()
62
-        vc.jitsiMeetView.welcomePageEnabled = self.welcomeScreenEnabled
63
-        vc.jitsiMeetView.pictureInPictureEnabled = true
64
-        vc.delegate = self
65
-        return vc
66
-    }
67
-    
68
-    private func makeMeetWindow() -> PiPWindow {
69
-        let window = PiPWindow(frame: UIScreen.main.bounds)
70
-        window.backgroundColor = .clear
71
-        window.windowLevel = UIWindowLevelStatusBar + 100
72
-        window.rootViewController = self.meetViewController
73
-        return window
74
-    }
75
-}
76
-
77
-extension JitsiMeetManager: JitsiMeetViewControllerDelegate {
78
-    
79
-    open func performPresentationUpdate(to: JitsiMeetPresentationUpdate) {
80
-        guard let meetWindow = self.meetWindow else { return }
81
-        
82
-        switch to {
83
-        case .enterPiP:
84
-            meetWindow.goToPiP()
85
-        case .traitChange:
86
-            // resize to full screen if rotation happens
87
-            if meetWindow.isInPiP {
88
-                meetWindow.goToFullScreen()
89
-            }
90
-        }
91
-    }
92
-    
93
-    open func meetingStarted() {
94
-        // do something
95
-    }
96
-    
97
-    open func meetingEnded(wasFailure: Bool) {
98
-        cleanUp()
99
-    }
100
-}
101
-

ios/sdk/src/JitsiMeetManager/PiPWindow/DragGestureController.swift → ios/sdk/src/picture-in-picture/DragGestureController.swift 查看文件

1
-//  Copyright © 2018 Jitsi. All rights reserved.
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * 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 obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
2
 
16
 
3
 final class DragGestureController {
17
 final class DragGestureController {
4
     
18
     
7
     private var frameBeforeDragging: CGRect = CGRect.zero
21
     private var frameBeforeDragging: CGRect = CGRect.zero
8
     private weak var view: UIView?
22
     private weak var view: UIView?
9
     private lazy var panGesture: UIPanGestureRecognizer = {
23
     private lazy var panGesture: UIPanGestureRecognizer = {
10
-        return UIPanGestureRecognizer(target: self, action: #selector(handlePan(gesture:)))
24
+        return UIPanGestureRecognizer(target: self,
25
+                                      action: #selector(handlePan(gesture:)))
11
     }()
26
     }()
12
     
27
     
13
     func startDragListener(inView view: UIView) {
28
     func startDragListener(inView view: UIView) {
47
             let distanceMagnitude = magnitude(vector: distance)
62
             let distanceMagnitude = magnitude(vector: distance)
48
             let velocityMagnitude = magnitude(vector: velocity)
63
             let velocityMagnitude = magnitude(vector: velocity)
49
             let animationDuration = 0.5
64
             let animationDuration = 0.5
50
-            let initialSpringVelocity = velocityMagnitude / distanceMagnitude / CGFloat(animationDuration)
65
+            let initialSpringVelocity =
66
+                velocityMagnitude / distanceMagnitude / CGFloat(animationDuration)
51
             
67
             
52
             frame.origin = CGPoint(x: finalPos.x, y: finalPos.y)
68
             frame.origin = CGPoint(x: finalPos.x, y: finalPos.y)
53
             
69
             
91
             goUp = location.y < bounds.midY
107
             goUp = location.y < bounds.midY
92
         }
108
         }
93
         
109
         
94
-        let finalPosX: CGFloat = goLeft ? adjustedBounds.origin.x : bounds.size.width - insets.right  - currentSize.width
95
-        let finalPosY: CGFloat = goUp ? adjustedBounds.origin.y : bounds.size.height - insets.bottom - currentSize.height
110
+        let finalPosX: CGFloat =
111
+            goLeft
112
+                ? adjustedBounds.origin.x
113
+                : bounds.size.width - insets.right  - currentSize.width
114
+        let finalPosY: CGFloat =
115
+            goUp
116
+                ? adjustedBounds.origin.y
117
+                : bounds.size.height - insets.bottom - currentSize.height
96
         
118
         
97
         return CGPoint(x: finalPosX, y: finalPosY)
119
         return CGPoint(x: finalPosX, y: finalPosY)
98
     }
120
     }
101
         return sqrt(pow(vector.x, 2) + pow(vector.y, 2))
123
         return sqrt(pow(vector.x, 2) + pow(vector.y, 2))
102
     }
124
     }
103
 }
125
 }
104
-

+ 97
- 0
ios/sdk/src/picture-in-picture/JitsiMeetPresentationCoordinator.swift 查看文件

1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * 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 obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+import Foundation
18
+
19
+/// Coordinates the presentation of JitsiMeetViewController inside of
20
+/// an external window that can be resized and dragged with custom PiP mode
21
+open class JitsiMeetPresentationCoordinator: NSObject {
22
+    
23
+    fileprivate let meetViewController: JitsiMeetViewController
24
+    fileprivate let meetWindow: PiPWindow
25
+    
26
+    public init(meetViewController: JitsiMeetViewController? = nil,
27
+                meetWindow: PiPWindow? = nil) {
28
+        self.meetViewController = meetViewController ?? JitsiMeetViewController()
29
+        self.meetWindow = meetWindow ?? PiPWindow(frame: UIScreen.main.bounds)
30
+        
31
+        super.init()
32
+        
33
+        configureMeetWindow()
34
+        configureMeetViewController()
35
+    }
36
+    
37
+    public func jitsiMeetView() -> JitsiMeetView {
38
+        return meetViewController.jitsiMeetView
39
+    }
40
+    
41
+    public func show() {
42
+        meetWindow.show()
43
+    }
44
+    
45
+    public func hide() {
46
+        meetWindow.hide()
47
+    }
48
+    
49
+    deinit {
50
+        cleanUp()
51
+    }
52
+    
53
+    // MARK: - helpers
54
+    
55
+    fileprivate func cleanUp() {
56
+        // TODO: more clean up work on this
57
+        
58
+        meetWindow.isHidden = true
59
+        meetWindow.stopDragGesture()
60
+    }
61
+    
62
+    private func configureMeetViewController() {
63
+        meetViewController.jitsiMeetView.pictureInPictureEnabled = true
64
+        meetViewController.delegate = self
65
+    }
66
+    
67
+    private func configureMeetWindow() {
68
+        meetWindow.backgroundColor = .clear
69
+        meetWindow.windowLevel = UIWindowLevelStatusBar + 100
70
+        meetWindow.rootViewController = self.meetViewController
71
+    }
72
+}
73
+
74
+extension JitsiMeetPresentationCoordinator: JitsiMeetViewControllerDelegate {
75
+    
76
+    open func performPresentationUpdate(to: JitsiMeetPresentationUpdate) {
77
+        switch to {
78
+        case .enterPictureInPicture:
79
+            meetWindow.enterPictureInPicture()
80
+        case .traitChange:
81
+            // resize to full screen if rotation happens
82
+            if meetWindow.isInPiP {
83
+                meetWindow.exitPictureInPicture()
84
+            }
85
+        }
86
+    }
87
+    
88
+    open func conferenceStarted() {
89
+        if meetWindow.isHidden {
90
+            meetWindow.show()
91
+        }
92
+    }
93
+    
94
+    open func conferenceEnded(didFail: Bool) {
95
+        cleanUp()
96
+    }
97
+}

ios/sdk/src/JitsiMeetManager/JitsiMeetViewController.swift → ios/sdk/src/picture-in-picture/JitsiMeetViewController.swift 查看文件

1
-//  Copyright © 2018 Jitsi. All rights reserved.
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * 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 obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
2
 
16
 
3
 public enum JitsiMeetPresentationUpdate {
17
 public enum JitsiMeetPresentationUpdate {
4
     
18
     
19
+    /// The conference wants to enter Picture-in-Picture
20
+    case enterPictureInPicture
21
+    
5
     /// A system traitCollectionChange (usually screen rotation)
22
     /// A system traitCollectionChange (usually screen rotation)
6
     case traitChange
23
     case traitChange
7
-    /// Meeting wants to enter PiP mode
8
-    case enterPiP
9
 }
24
 }
10
 
25
 
11
 public protocol JitsiMeetViewControllerDelegate: class {
26
 public protocol JitsiMeetViewControllerDelegate: class {
12
     
27
     
13
-    /// Notifies a change of the meeting presentation style.
28
+    /// Notifies a change of the conference presentation style.
14
     ///
29
     ///
15
     /// - Parameter to: The presentation state that will be changed to
30
     /// - Parameter to: The presentation state that will be changed to
16
     func performPresentationUpdate(to: JitsiMeetPresentationUpdate)
31
     func performPresentationUpdate(to: JitsiMeetPresentationUpdate)
17
-    func meetingStarted()
18
-    func meetingEnded(wasFailure: Bool)
32
+    
33
+    /// The conference started
34
+    func conferenceStarted()
35
+    
36
+    /// The conference ended
37
+    ///
38
+    /// - Parameter didFail: The reason of ending the conference
39
+    func conferenceEnded(didFail: Bool)
19
 }
40
 }
20
 
41
 
21
 /// Wrapper ViewController of a JitsiMeetView
42
 /// Wrapper ViewController of a JitsiMeetView
52
     
73
     
53
     open func conferenceJoined(_ data: [AnyHashable : Any]!) {
74
     open func conferenceJoined(_ data: [AnyHashable : Any]!) {
54
         DispatchQueue.main.async {
75
         DispatchQueue.main.async {
55
-            self.delegate?.meetingStarted()
76
+            self.delegate?.conferenceStarted()
56
         }
77
         }
57
     }
78
     }
58
     
79
     
62
     
83
     
63
     open func conferenceLeft(_ data: [AnyHashable : Any]!) {
84
     open func conferenceLeft(_ data: [AnyHashable : Any]!) {
64
         DispatchQueue.main.async {
85
         DispatchQueue.main.async {
65
-            self.delegate?.meetingEnded(wasFailure: true)
86
+            self.delegate?.conferenceEnded(didFail: true)
66
         }
87
         }
67
     }
88
     }
68
     
89
     
69
     open func conferenceFailed(_ data: [AnyHashable : Any]!) {
90
     open func conferenceFailed(_ data: [AnyHashable : Any]!) {
70
         DispatchQueue.main.async {
91
         DispatchQueue.main.async {
71
-            self.delegate?.meetingEnded(wasFailure: true)
92
+            self.delegate?.conferenceEnded(didFail: true)
72
         }
93
         }
73
     }
94
     }
74
     
95
     
78
     
99
     
79
     open func enterPicture(inPicture data: [AnyHashable : Any]!) {
100
     open func enterPicture(inPicture data: [AnyHashable : Any]!) {
80
         DispatchQueue.main.async {
101
         DispatchQueue.main.async {
81
-           self.delegate?.performPresentationUpdate(to: .enterPiP)
102
+           self.delegate?.performPresentationUpdate(to: .enterPictureInPicture)
82
         }
103
         }
83
     }
104
     }
84
 }
105
 }

ios/sdk/src/JitsiMeetManager/PiPWindow/PiPWindow.swift → ios/sdk/src/picture-in-picture/PiPWindow.swift 查看文件

1
-//  Copyright © 2018 Jitsi. All rights reserved.
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * 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 obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
2
 
16
 
3
 /// A window that allows its root view controller to be presented
17
 /// A window that allows its root view controller to be presented
4
 /// in full screen or in a custom Picture in Picture mode
18
 /// in full screen or in a custom Picture in Picture mode
5
 open class PiPWindow: UIWindow {
19
 open class PiPWindow: UIWindow {
6
     
20
     
7
     /// Limits the boundries of root view position on screen when minimized
21
     /// Limits the boundries of root view position on screen when minimized
8
-    public var dragBoundInsets: UIEdgeInsets = UIEdgeInsets(top: 25, left: 5, bottom: 5, right: 5) {
22
+    public var dragBoundInsets: UIEdgeInsets = UIEdgeInsets(top: 25,
23
+                                                            left: 5,
24
+                                                            bottom: 5,
25
+                                                            right: 5) {
9
         didSet {
26
         didSet {
10
             dragController.insets = dragBoundInsets
27
             dragController.insets = dragBoundInsets
11
         }
28
         }
24
     private var exitPiPButton: UIButton?
41
     private var exitPiPButton: UIButton?
25
     
42
     
26
     /// Help out to bubble up the gesture detection outside of the rootVC frame
43
     /// Help out to bubble up the gesture detection outside of the rootVC frame
27
-    open override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
44
+    open override func point(inside point: CGPoint,
45
+                             with event: UIEvent?) -> Bool {
28
         guard let vc = rootViewController else {
46
         guard let vc = rootViewController else {
29
             return super.point(inside: point, with: event)
47
             return super.point(inside: point, with: event)
30
         }
48
         }
36
         if self.isHidden || self.alpha < 1 {
54
         if self.isHidden || self.alpha < 1 {
37
             self.isHidden = false
55
             self.isHidden = false
38
             self.alpha = 0
56
             self.alpha = 0
39
-            
40
-            UIView.animate(
41
-                withDuration: 0.1,
42
-                delay: 0,
43
-                options: .beginFromCurrentState,
44
-                animations: {
45
-                    self.alpha = 1
46
-            },
47
-                completion: nil)
57
+            animateTransition {
58
+                self.alpha = 1
59
+            }
48
         }
60
         }
49
     }
61
     }
50
     
62
     
51
     /// animate out the window
63
     /// animate out the window
52
     open func hide() {
64
     open func hide() {
53
         if !self.isHidden || self.alpha > 0 {
65
         if !self.isHidden || self.alpha > 0 {
54
-            UIView.animate(
55
-                withDuration: 0.1,
56
-                delay: 0,
57
-                options: .beginFromCurrentState,
58
-                animations: {
59
-                    self.alpha = 0
60
-                    self.isHidden = true
61
-            },
62
-                completion: nil)
66
+            animateTransition {
67
+                self.alpha = 0
68
+                self.isHidden = true
69
+            }
63
         }
70
         }
64
     }
71
     }
65
     
72
     
66
     /// Resize the root view to PiP mode
73
     /// Resize the root view to PiP mode
67
-    open func goToPiP() {
74
+    open func enterPictureInPicture() {
68
         guard let view = rootViewController?.view else { return }
75
         guard let view = rootViewController?.view else { return }
69
         isInPiP = true
76
         isInPiP = true
70
         animateRootViewChange()
77
         animateRootViewChange()
72
         dragController.insets = dragBoundInsets
79
         dragController.insets = dragBoundInsets
73
         
80
         
74
         // add single tap gesture recognition for displaying exit PiP UI
81
         // add single tap gesture recognition for displaying exit PiP UI
75
-        let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(toggleExitPiP))
82
+        let exitSelector = #selector(toggleExitPiP)
83
+        let tapGestureRecognizer = UITapGestureRecognizer(target: self,
84
+                                                          action: exitSelector)
76
         self.tapGestureRecognizer = tapGestureRecognizer
85
         self.tapGestureRecognizer = tapGestureRecognizer
77
         view.addGestureRecognizer(tapGestureRecognizer)
86
         view.addGestureRecognizer(tapGestureRecognizer)
78
     }
87
     }
79
     
88
     
80
     /// Resize the root view to full screen
89
     /// Resize the root view to full screen
81
-    open func goToFullScreen() {
90
+    open func exitPictureInPicture() {
82
         isInPiP = false
91
         isInPiP = false
83
         animateRootViewChange()
92
         animateRootViewChange()
84
         dragController.stopDragListener()
93
         dragController.stopDragListener()
88
         exitPiPButton = nil
97
         exitPiPButton = nil
89
         
98
         
90
         // remove gesture
99
         // remove gesture
91
-        tapGestureRecognizer?.removeTarget(self, action: #selector(toggleExitPiP))
100
+        let exitSelector = #selector(toggleExitPiP)
101
+        tapGestureRecognizer?.removeTarget(self, action: exitSelector)
92
         tapGestureRecognizer = nil
102
         tapGestureRecognizer = nil
93
     }
103
     }
94
     
104
     
98
     }
108
     }
99
     
109
     
100
     /// Customize the presentation of exit pip button
110
     /// Customize the presentation of exit pip button
101
-    open func configureExitPiPButton(target: Any, action: Selector) -> UIButton {
102
-        let buttonImage = UIImage.init(named: "image-resize", in: Bundle(for: type(of: self)), compatibleWith: nil)
111
+    open func configureExitPiPButton(target: Any,
112
+                                     action: Selector) -> UIButton {
113
+        let buttonImage = UIImage.init(named: "image-resize",
114
+                                       in: Bundle(for: type(of: self)),
115
+                                       compatibleWith: nil)
103
         let button = UIButton(type: .custom)
116
         let button = UIButton(type: .custom)
104
         let size: CGSize = CGSize(width: 44, height: 44)
117
         let size: CGSize = CGSize(width: 44, height: 44)
105
         button.setImage(buttonImage, for: .normal)
118
         button.setImage(buttonImage, for: .normal)
143
         
156
         
144
         if exitPiPButton == nil {
157
         if exitPiPButton == nil {
145
             // show button
158
             // show button
146
-            let button = configureExitPiPButton(target: self, action: #selector(exitPiP))
159
+            let exitSelector = #selector(exitPictureInPicture)
160
+            let button = configureExitPiPButton(target: self,
161
+                                                action: exitSelector)
147
             view.addSubview(button)
162
             view.addSubview(button)
148
             exitPiPButton = button
163
             exitPiPButton = button
149
             
164
             
152
             exitPiPButton?.removeFromSuperview()
167
             exitPiPButton?.removeFromSuperview()
153
             exitPiPButton = nil
168
             exitPiPButton = nil
154
         }
169
         }
155
-        
156
     }
170
     }
157
     
171
     
158
     @objc private func exitPiP() {
172
     @objc private func exitPiP() {
159
-        goToFullScreen()
173
+        exitPictureInPicture()
174
+    }
175
+    
176
+    // MARK: - Animation transition
177
+    
178
+    private func animateTransition(animations: @escaping () -> Void) {
179
+        UIView.animate(withDuration: 0.1,
180
+                       delay: 0,
181
+                       options: .beginFromCurrentState,
182
+                       animations: animations,
183
+                       completion: nil)
160
     }
184
     }
161
 }
185
 }

ios/sdk/image-resize@2x.png → ios/sdk/src/picture-in-picture/image-resize@2x.png 查看文件


ios/sdk/image-resize@3x.png → ios/sdk/src/picture-in-picture/image-resize@3x.png 查看文件


正在加载...
取消
保存