Browse Source

Addressing feedback from PR

master
Daniel Ornelas 7 years ago
parent
commit
5858859838

+ 3
- 3
ios/app/src/Info.plist View File

@@ -55,14 +55,14 @@
55 55
 			</dict>
56 56
 		</dict>
57 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 60
 	<key>NSCameraUsageDescription</key>
61 61
 	<string>Participate in conferences with video.</string>
62 62
 	<key>NSLocationWhenInUseUsageDescription</key>
63 63
 	<string></string>
64 64
 	<key>NSMicrophoneUsageDescription</key>
65
-	<string>Participate in conferences with audio.</string>
65
+	<string>Participate in conferences with voice.</string>
66 66
 	<key>UIBackgroundModes</key>
67 67
 	<array>
68 68
 		<string>audio</string>

ios/example-pip-app/PiPApp.xcodeproj/project.pbxproj → ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj View File

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

+ 15
- 9
ios/example-pip-app/src/AppDelegate.swift View File

@@ -1,10 +1,18 @@
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 17
 import JitsiMeet
10 18
 
@@ -30,6 +38,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
30 38
     func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
31 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 View File

@@ -13,17 +13,17 @@
13 13
         <!--View Controller-->
14 14
         <scene sceneID="tne-QT-ifu">
15 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 17
                     <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
18 18
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
19 19
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
20 20
                         <subviews>
21 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 23
                                 <fontDescription key="fontDescription" type="system" pointSize="21"/>
24
-                                <state key="normal" title="Start Jitsi"/>
24
+                                <state key="normal" title="Open Jitsi Meet"/>
25 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 27
                                 </connections>
28 28
                             </button>
29 29
                         </subviews>

+ 22
- 15
ios/example-pip-app/src/ViewController.swift View File

@@ -1,10 +1,18 @@
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 17
 import UIKit
10 18
 import JitsiMeet
@@ -13,7 +21,7 @@ class ViewController: UIViewController {
13 21
 
14 22
     @IBOutlet weak var videoButton: UIButton?
15 23
     
16
-    private var jitsiMeetManager: JitsiMeetManager?
24
+    private var jitsiMeetCoordinator: JitsiMeetPresentationCoordinator?
17 25
     
18 26
     override func viewDidLoad() {
19 27
         super.viewDidLoad()
@@ -21,12 +29,11 @@ class ViewController: UIViewController {
21 29
     
22 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 View File

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

+ 10
- 18
ios/sdk/sdk.xcodeproj/project.pbxproj View File

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

+ 0
- 101
ios/sdk/src/JitsiMeetManager/JitsiMeetManager.swift View File

@@ -1,101 +0,0 @@
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 View File

@@ -1,4 +1,18 @@
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 17
 final class DragGestureController {
4 18
     
@@ -7,7 +21,8 @@ final class DragGestureController {
7 21
     private var frameBeforeDragging: CGRect = CGRect.zero
8 22
     private weak var view: UIView?
9 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 28
     func startDragListener(inView view: UIView) {
@@ -47,7 +62,8 @@ final class DragGestureController {
47 62
             let distanceMagnitude = magnitude(vector: distance)
48 63
             let velocityMagnitude = magnitude(vector: velocity)
49 64
             let animationDuration = 0.5
50
-            let initialSpringVelocity = velocityMagnitude / distanceMagnitude / CGFloat(animationDuration)
65
+            let initialSpringVelocity =
66
+                velocityMagnitude / distanceMagnitude / CGFloat(animationDuration)
51 67
             
52 68
             frame.origin = CGPoint(x: finalPos.x, y: finalPos.y)
53 69
             
@@ -91,8 +107,14 @@ final class DragGestureController {
91 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 119
         return CGPoint(x: finalPosX, y: finalPosY)
98 120
     }
@@ -101,4 +123,3 @@ final class DragGestureController {
101 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 View File

@@ -0,0 +1,97 @@
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 View File

@@ -1,21 +1,42 @@
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 17
 public enum JitsiMeetPresentationUpdate {
4 18
     
19
+    /// The conference wants to enter Picture-in-Picture
20
+    case enterPictureInPicture
21
+    
5 22
     /// A system traitCollectionChange (usually screen rotation)
6 23
     case traitChange
7
-    /// Meeting wants to enter PiP mode
8
-    case enterPiP
9 24
 }
10 25
 
11 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 30
     /// - Parameter to: The presentation state that will be changed to
16 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 42
 /// Wrapper ViewController of a JitsiMeetView
@@ -52,7 +73,7 @@ extension JitsiMeetViewController: JitsiMeetViewDelegate {
52 73
     
53 74
     open func conferenceJoined(_ data: [AnyHashable : Any]!) {
54 75
         DispatchQueue.main.async {
55
-            self.delegate?.meetingStarted()
76
+            self.delegate?.conferenceStarted()
56 77
         }
57 78
     }
58 79
     
@@ -62,13 +83,13 @@ extension JitsiMeetViewController: JitsiMeetViewDelegate {
62 83
     
63 84
     open func conferenceLeft(_ data: [AnyHashable : Any]!) {
64 85
         DispatchQueue.main.async {
65
-            self.delegate?.meetingEnded(wasFailure: true)
86
+            self.delegate?.conferenceEnded(didFail: true)
66 87
         }
67 88
     }
68 89
     
69 90
     open func conferenceFailed(_ data: [AnyHashable : Any]!) {
70 91
         DispatchQueue.main.async {
71
-            self.delegate?.meetingEnded(wasFailure: true)
92
+            self.delegate?.conferenceEnded(didFail: true)
72 93
         }
73 94
     }
74 95
     
@@ -78,7 +99,7 @@ extension JitsiMeetViewController: JitsiMeetViewDelegate {
78 99
     
79 100
     open func enterPicture(inPicture data: [AnyHashable : Any]!) {
80 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 View File

@@ -1,11 +1,28 @@
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 17
 /// A window that allows its root view controller to be presented
4 18
 /// in full screen or in a custom Picture in Picture mode
5 19
 open class PiPWindow: UIWindow {
6 20
     
7 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 26
         didSet {
10 27
             dragController.insets = dragBoundInsets
11 28
         }
@@ -24,7 +41,8 @@ open class PiPWindow: UIWindow {
24 41
     private var exitPiPButton: UIButton?
25 42
     
26 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 46
         guard let vc = rootViewController else {
29 47
             return super.point(inside: point, with: event)
30 48
         }
@@ -36,35 +54,24 @@ open class PiPWindow: UIWindow {
36 54
         if self.isHidden || self.alpha < 1 {
37 55
             self.isHidden = false
38 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 63
     /// animate out the window
52 64
     open func hide() {
53 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 73
     /// Resize the root view to PiP mode
67
-    open func goToPiP() {
74
+    open func enterPictureInPicture() {
68 75
         guard let view = rootViewController?.view else { return }
69 76
         isInPiP = true
70 77
         animateRootViewChange()
@@ -72,13 +79,15 @@ open class PiPWindow: UIWindow {
72 79
         dragController.insets = dragBoundInsets
73 80
         
74 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 85
         self.tapGestureRecognizer = tapGestureRecognizer
77 86
         view.addGestureRecognizer(tapGestureRecognizer)
78 87
     }
79 88
     
80 89
     /// Resize the root view to full screen
81
-    open func goToFullScreen() {
90
+    open func exitPictureInPicture() {
82 91
         isInPiP = false
83 92
         animateRootViewChange()
84 93
         dragController.stopDragListener()
@@ -88,7 +97,8 @@ open class PiPWindow: UIWindow {
88 97
         exitPiPButton = nil
89 98
         
90 99
         // remove gesture
91
-        tapGestureRecognizer?.removeTarget(self, action: #selector(toggleExitPiP))
100
+        let exitSelector = #selector(toggleExitPiP)
101
+        tapGestureRecognizer?.removeTarget(self, action: exitSelector)
92 102
         tapGestureRecognizer = nil
93 103
     }
94 104
     
@@ -98,8 +108,11 @@ open class PiPWindow: UIWindow {
98 108
     }
99 109
     
100 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 116
         let button = UIButton(type: .custom)
104 117
         let size: CGSize = CGSize(width: 44, height: 44)
105 118
         button.setImage(buttonImage, for: .normal)
@@ -143,7 +156,9 @@ open class PiPWindow: UIWindow {
143 156
         
144 157
         if exitPiPButton == nil {
145 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 162
             view.addSubview(button)
148 163
             exitPiPButton = button
149 164
             
@@ -152,10 +167,19 @@ open class PiPWindow: UIWindow {
152 167
             exitPiPButton?.removeFromSuperview()
153 168
             exitPiPButton = nil
154 169
         }
155
-        
156 170
     }
157 171
     
158 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 View File


ios/sdk/image-resize@3x.png → ios/sdk/src/picture-in-picture/image-resize@3x.png View File


Loading…
Cancel
Save