ソースを参照

Codying style: naming, formatting, comments

j8
Lyubo Marinov 7年前
コミット
5e79bbecef

+ 2
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/invite/AddPeopleController.java ファイルの表示

110
 
110
 
111
         if (owner != null) {
111
         if (owner != null) {
112
             WritableArray invitees = new WritableNativeArray();
112
             WritableArray invitees = new WritableNativeArray();
113
-    
113
+
114
             for(int i = 0, size = ids.size(); i < size; i++) {
114
             for(int i = 0, size = ids.size(); i < size; i++) {
115
                 String id = ids.get(i);
115
                 String id = ids.get(i);
116
 
116
 
123
                     // so just skip it.
123
                     // so just skip it.
124
                 }
124
                 }
125
             }
125
             }
126
-    
126
+
127
             owner.invite(this, invitees);
127
             owner.invite(this, invitees);
128
         }
128
         }
129
     }
129
     }

+ 3
- 3
ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj ファイルの表示

79
 			isa = PBXGroup;
79
 			isa = PBXGroup;
80
 			children = (
80
 			children = (
81
 				C6F99C3A204DE6BE0001F710 /* AppDelegate.swift */,
81
 				C6F99C3A204DE6BE0001F710 /* AppDelegate.swift */,
82
-				C6F99C3C204DE6BE0001F710 /* ViewController.swift */,
83
-				C6F99C3E204DE6BE0001F710 /* Main.storyboard */,
84
 				C6F99C41204DE6BE0001F710 /* Assets.xcassets */,
82
 				C6F99C41204DE6BE0001F710 /* Assets.xcassets */,
85
-				C6F99C43204DE6BE0001F710 /* LaunchScreen.storyboard */,
86
 				C6F99C46204DE6BE0001F710 /* Info.plist */,
83
 				C6F99C46204DE6BE0001F710 /* Info.plist */,
84
+				C6F99C43204DE6BE0001F710 /* LaunchScreen.storyboard */,
85
+				C6F99C3E204DE6BE0001F710 /* Main.storyboard */,
86
+				C6F99C3C204DE6BE0001F710 /* ViewController.swift */,
87
 			);
87
 			);
88
 			path = src;
88
 			path = src;
89
 			sourceTree = "<group>";
89
 			sourceTree = "<group>";

+ 4
- 4
ios/example-pip-app/src/AppDelegate.swift ファイルの表示

20
 class AppDelegate: UIResponder, UIApplicationDelegate {
20
 class AppDelegate: UIResponder, UIApplicationDelegate {
21
 
21
 
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: [UIApplicationLaunchOptionsKey : 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 JitsiMeetView.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 {
34
                      restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
35
         return JitsiMeetView.application(application, continue: userActivity, restorationHandler: restorationHandler)
35
         return JitsiMeetView.application(application, continue: userActivity, restorationHandler: restorationHandler)
36
     }
36
     }
37
-    
37
+
38
     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 {
39
         return JitsiMeetView.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
39
         return JitsiMeetView.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
40
     }
40
     }

+ 14
- 14
ios/example-pip-app/src/ViewController.swift ファイルの表示

20
 class ViewController: UIViewController {
20
 class ViewController: UIViewController {
21
 
21
 
22
     @IBOutlet weak var videoButton: UIButton?
22
     @IBOutlet weak var videoButton: UIButton?
23
-    
23
+
24
     fileprivate var pipViewCoordinator: PiPViewCoordinator?
24
     fileprivate var pipViewCoordinator: PiPViewCoordinator?
25
     fileprivate var jitsiMeetView: JitsiMeetView?
25
     fileprivate var jitsiMeetView: JitsiMeetView?
26
-    
26
+
27
     override func viewDidLoad() {
27
     override func viewDidLoad() {
28
         super.viewDidLoad()
28
         super.viewDidLoad()
29
     }
29
     }
30
-    
30
+
31
     override func viewWillTransition(to size: CGSize,
31
     override func viewWillTransition(to size: CGSize,
32
                                      with coordinator: UIViewControllerTransitionCoordinator) {
32
                                      with coordinator: UIViewControllerTransitionCoordinator) {
33
         super.viewWillTransition(to: size, with: coordinator)
33
         super.viewWillTransition(to: size, with: coordinator)
34
-        
34
+
35
         let rect = CGRect(origin: CGPoint.zero, size: size)
35
         let rect = CGRect(origin: CGPoint.zero, size: size)
36
         pipViewCoordinator?.resetBounds(bounds: rect)
36
         pipViewCoordinator?.resetBounds(bounds: rect)
37
     }
37
     }
38
-    
38
+
39
     // MARK: - Actions
39
     // MARK: - Actions
40
-    
40
+
41
     @IBAction func openJitsiMeet(sender: Any?) {
41
     @IBAction func openJitsiMeet(sender: Any?) {
42
         cleanUp()
42
         cleanUp()
43
-        
43
+
44
         // create and configure jitsimeet view
44
         // create and configure jitsimeet view
45
         let jitsiMeetView = JitsiMeetView()
45
         let jitsiMeetView = JitsiMeetView()
46
         jitsiMeetView.welcomePageEnabled = true
46
         jitsiMeetView.welcomePageEnabled = true
48
         jitsiMeetView.load(nil)
48
         jitsiMeetView.load(nil)
49
         jitsiMeetView.delegate = self
49
         jitsiMeetView.delegate = self
50
         self.jitsiMeetView = jitsiMeetView
50
         self.jitsiMeetView = jitsiMeetView
51
-        
51
+
52
         // Enable jitsimeet view to be a view that can be displayed
52
         // Enable jitsimeet view to be a view that can be displayed
53
         // on top of all the things, and let the coordinator to manage
53
         // on top of all the things, and let the coordinator to manage
54
         // the view state and interactions
54
         // the view state and interactions
55
         pipViewCoordinator = PiPViewCoordinator(withView: jitsiMeetView)
55
         pipViewCoordinator = PiPViewCoordinator(withView: jitsiMeetView)
56
         pipViewCoordinator?.configureAsStickyView(withParentView: view)
56
         pipViewCoordinator?.configureAsStickyView(withParentView: view)
57
-        
57
+
58
         // animate in
58
         // animate in
59
         jitsiMeetView.alpha = 0
59
         jitsiMeetView.alpha = 0
60
         pipViewCoordinator?.show()
60
         pipViewCoordinator?.show()
61
     }
61
     }
62
-    
62
+
63
     fileprivate func cleanUp() {
63
     fileprivate func cleanUp() {
64
         jitsiMeetView?.removeFromSuperview()
64
         jitsiMeetView?.removeFromSuperview()
65
         jitsiMeetView = nil
65
         jitsiMeetView = nil
68
 }
68
 }
69
 
69
 
70
 extension ViewController: JitsiMeetViewDelegate {
70
 extension ViewController: JitsiMeetViewDelegate {
71
-    
71
+
72
     func conferenceFailed(_ data: [AnyHashable : Any]!) {
72
     func conferenceFailed(_ data: [AnyHashable : Any]!) {
73
         hideJitsiMeetViewAndCleanUp()
73
         hideJitsiMeetViewAndCleanUp()
74
     }
74
     }
75
-    
75
+
76
     func conferenceLeft(_ data: [AnyHashable : Any]!) {
76
     func conferenceLeft(_ data: [AnyHashable : Any]!) {
77
         hideJitsiMeetViewAndCleanUp()
77
         hideJitsiMeetViewAndCleanUp()
78
     }
78
     }
79
-    
79
+
80
     func enterPicture(inPicture data: [AnyHashable : Any]!) {
80
     func enterPicture(inPicture data: [AnyHashable : Any]!) {
81
         DispatchQueue.main.async {
81
         DispatchQueue.main.async {
82
             self.pipViewCoordinator?.enterPictureInPicture()
82
             self.pipViewCoordinator?.enterPictureInPicture()
83
         }
83
         }
84
     }
84
     }
85
-    
85
+
86
     private func hideJitsiMeetViewAndCleanUp() {
86
     private func hideJitsiMeetViewAndCleanUp() {
87
         DispatchQueue.main.async {
87
         DispatchQueue.main.async {
88
             self.pipViewCoordinator?.hide() { _ in
88
             self.pipViewCoordinator?.hide() { _ in

+ 20
- 20
ios/sdk/sdk.xcodeproj/project.pbxproj ファイルの表示

38
 		B386B85D20981A75000DEF7A /* Invite.m in Sources */ = {isa = PBXBuildFile; fileRef = B386B85620981A75000DEF7A /* Invite.m */; };
38
 		B386B85D20981A75000DEF7A /* Invite.m in Sources */ = {isa = PBXBuildFile; fileRef = B386B85620981A75000DEF7A /* Invite.m */; };
39
 		C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
39
 		C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; };
40
 		C6245F5E2053091D0040BE68 /* image-resize@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5C2053091D0040BE68 /* image-resize@3x.png */; };
40
 		C6245F5E2053091D0040BE68 /* image-resize@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5C2053091D0040BE68 /* image-resize@3x.png */; };
41
-		C69EFA0C209A0F660027712B /* JMCallKitNotifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA09209A0F650027712B /* JMCallKitNotifier.swift */; };
41
+		C69EFA0C209A0F660027712B /* JMCallKitEmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA09209A0F650027712B /* JMCallKitEmitter.swift */; };
42
 		C69EFA0D209A0F660027712B /* JMCallKitProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0A209A0F660027712B /* JMCallKitProxy.swift */; };
42
 		C69EFA0D209A0F660027712B /* JMCallKitProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0A209A0F660027712B /* JMCallKitProxy.swift */; };
43
-		C69EFA0E209A0F660027712B /* JMCallKitEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0B209A0F660027712B /* JMCallKitEventListener.swift */; };
43
+		C69EFA0E209A0F660027712B /* JMCallKitListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0B209A0F660027712B /* JMCallKitListener.swift */; };
44
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
44
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
45
 		C6CC49AF207412CF000DFA42 /* PiPViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */; };
45
 		C6CC49AF207412CF000DFA42 /* PiPViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */; };
46
 		C6F99C15204DB63E0001F710 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */; };
46
 		C6F99C15204DB63E0001F710 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */; };
86
 		B386B85620981A75000DEF7A /* Invite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Invite.m; sourceTree = "<group>"; };
86
 		B386B85620981A75000DEF7A /* Invite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Invite.m; sourceTree = "<group>"; };
87
 		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>"; };
87
 		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>"; };
88
 		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>"; };
88
 		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>"; };
89
-		C69EFA09209A0F650027712B /* JMCallKitNotifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitNotifier.swift; sourceTree = "<group>"; };
89
+		C69EFA09209A0F650027712B /* JMCallKitEmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitEmitter.swift; sourceTree = "<group>"; };
90
 		C69EFA0A209A0F660027712B /* JMCallKitProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitProxy.swift; sourceTree = "<group>"; };
90
 		C69EFA0A209A0F660027712B /* JMCallKitProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitProxy.swift; sourceTree = "<group>"; };
91
-		C69EFA0B209A0F660027712B /* JMCallKitEventListener.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitEventListener.swift; sourceTree = "<group>"; };
91
+		C69EFA0B209A0F660027712B /* JMCallKitListener.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JMCallKitListener.swift; sourceTree = "<group>"; };
92
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
92
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
93
 		C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiPViewCoordinator.swift; sourceTree = "<group>"; };
93
 		C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiPViewCoordinator.swift; sourceTree = "<group>"; };
94
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
94
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
112
 		0BCA49681EC4BBE500B793EE /* Resources */ = {
112
 		0BCA49681EC4BBE500B793EE /* Resources */ = {
113
 			isa = PBXGroup;
113
 			isa = PBXGroup;
114
 			children = (
114
 			children = (
115
-				75635B0820751D6D00F29C9F /* joined.wav */,
116
-				75635B0920751D6D00F29C9F /* left.wav */,
117
 				0BC4B8681F8C01E100CE8B21 /* CallKitIcon.png */,
115
 				0BC4B8681F8C01E100CE8B21 /* CallKitIcon.png */,
118
 				C6245F5B2053091D0040BE68 /* image-resize@2x.png */,
116
 				C6245F5B2053091D0040BE68 /* image-resize@2x.png */,
119
 				C6245F5C2053091D0040BE68 /* image-resize@3x.png */,
117
 				C6245F5C2053091D0040BE68 /* image-resize@3x.png */,
120
 				0BCA496B1EC4BBF900B793EE /* jitsi.ttf */,
118
 				0BCA496B1EC4BBF900B793EE /* jitsi.ttf */,
119
+				75635B0820751D6D00F29C9F /* joined.wav */,
120
+				75635B0920751D6D00F29C9F /* left.wav */,
121
 			);
121
 			);
122
 			name = Resources;
122
 			name = Resources;
123
 			sourceTree = "<group>";
123
 			sourceTree = "<group>";
144
 		0BD906E71EC0C00300C8C18E /* src */ = {
144
 		0BD906E71EC0C00300C8C18E /* src */ = {
145
 			isa = PBXGroup;
145
 			isa = PBXGroup;
146
 			children = (
146
 			children = (
147
-				C69EFA02209A0EFD0027712B /* callkit */,
148
-				B386B84F20981A11000DEF7A /* invite */,
149
-				C6A3426B204F127900E062DD /* picture-in-picture */,
150
-				0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
151
 				0BB9AD7C1F60356D001C08DB /* AppInfo.m */,
147
 				0BB9AD7C1F60356D001C08DB /* AppInfo.m */,
152
-				0BB9AD7A1F5EC8F4001C08DB /* CallKit.m */,
148
+				0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
149
+				C69EFA02209A0EFD0027712B /* callkit */,
153
 				0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
150
 				0BA13D301EE83FF8007BEF7F /* ExternalAPI.m */,
154
 				0BD906E91EC0C00300C8C18E /* Info.plist */,
151
 				0BD906E91EC0C00300C8C18E /* Info.plist */,
155
-				0B7C2CFC200F51D60060D076 /* LaunchOptions.m */,
152
+				B386B84F20981A11000DEF7A /* invite */,
156
 				0BD906E81EC0C00300C8C18E /* JitsiMeet.h */,
153
 				0BD906E81EC0C00300C8C18E /* JitsiMeet.h */,
157
 				0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
154
 				0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
158
 				0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
155
 				0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
159
 				C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */,
156
 				C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */,
160
 				0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */,
157
 				0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */,
158
+				0B7C2CFC200F51D60060D076 /* LaunchOptions.m */,
161
 				0B44A0181F902126009D1D64 /* MPVolumeViewManager.m */,
159
 				0B44A0181F902126009D1D64 /* MPVolumeViewManager.m */,
162
-				0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */,
163
-				0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */,
160
+				C6A3426B204F127900E062DD /* picture-in-picture */,
164
 				0BCA495D1EC4B6C600B793EE /* POSIX.m */,
161
 				0BCA495D1EC4B6C600B793EE /* POSIX.m */,
165
 				0BCA495E1EC4B6C600B793EE /* Proximity.m */,
162
 				0BCA495E1EC4B6C600B793EE /* Proximity.m */,
163
+				0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */,
164
+				0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */,
166
 			);
165
 			);
167
 			path = src;
166
 			path = src;
168
 			sourceTree = "<group>";
167
 			sourceTree = "<group>";
170
 		9C3C6FA2341729836589B856 /* Frameworks */ = {
169
 		9C3C6FA2341729836589B856 /* Frameworks */ = {
171
 			isa = PBXGroup;
170
 			isa = PBXGroup;
172
 			children = (
171
 			children = (
173
-				0BB9AD781F5EC6D7001C08DB /* Intents.framework */,
174
 				0BB9AD761F5EC6CE001C08DB /* CallKit.framework */,
172
 				0BB9AD761F5EC6CE001C08DB /* CallKit.framework */,
175
 				0B93EF7A1EC608550030D24D /* CoreText.framework */,
173
 				0B93EF7A1EC608550030D24D /* CoreText.framework */,
176
-				0BCA49631EC4B76D00B793EE /* WebRTC.framework */,
174
+				0BB9AD781F5EC6D7001C08DB /* Intents.framework */,
177
 				03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */,
175
 				03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */,
176
+				0BCA49631EC4B76D00B793EE /* WebRTC.framework */,
178
 			);
177
 			);
179
 			name = Frameworks;
178
 			name = Frameworks;
180
 			sourceTree = "<group>";
179
 			sourceTree = "<group>";
208
 		C69EFA02209A0EFD0027712B /* callkit */ = {
207
 		C69EFA02209A0EFD0027712B /* callkit */ = {
209
 			isa = PBXGroup;
208
 			isa = PBXGroup;
210
 			children = (
209
 			children = (
211
-				C69EFA0B209A0F660027712B /* JMCallKitEventListener.swift */,
212
-				C69EFA09209A0F650027712B /* JMCallKitNotifier.swift */,
210
+				0BB9AD7A1F5EC8F4001C08DB /* CallKit.m */,
211
+				C69EFA09209A0F650027712B /* JMCallKitEmitter.swift */,
212
+				C69EFA0B209A0F660027712B /* JMCallKitListener.swift */,
213
 				C69EFA0A209A0F660027712B /* JMCallKitProxy.swift */,
213
 				C69EFA0A209A0F660027712B /* JMCallKitProxy.swift */,
214
 			);
214
 			);
215
 			path = callkit;
215
 			path = callkit;
407
 				0BCA495F1EC4B6C600B793EE /* AudioMode.m in Sources */,
407
 				0BCA495F1EC4B6C600B793EE /* AudioMode.m in Sources */,
408
 				0B44A0191F902126009D1D64 /* MPVolumeViewManager.m in Sources */,
408
 				0B44A0191F902126009D1D64 /* MPVolumeViewManager.m in Sources */,
409
 				0BCA49611EC4B6C600B793EE /* Proximity.m in Sources */,
409
 				0BCA49611EC4B6C600B793EE /* Proximity.m in Sources */,
410
-				C69EFA0C209A0F660027712B /* JMCallKitNotifier.swift in Sources */,
410
+				C69EFA0C209A0F660027712B /* JMCallKitEmitter.swift in Sources */,
411
 				C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */,
411
 				C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */,
412
 				C69EFA0D209A0F660027712B /* JMCallKitProxy.swift in Sources */,
412
 				C69EFA0D209A0F660027712B /* JMCallKitProxy.swift in Sources */,
413
-				C69EFA0E209A0F660027712B /* JMCallKitEventListener.swift in Sources */,
413
+				C69EFA0E209A0F660027712B /* JMCallKitListener.swift in Sources */,
414
 				0B412F191EDEC65D00B1A0A6 /* JitsiMeetView.m in Sources */,
414
 				0B412F191EDEC65D00B1A0A6 /* JitsiMeetView.m in Sources */,
415
 			);
415
 			);
416
 			runOnlyForDeploymentPostprocessing = 0;
416
 			runOnlyForDeploymentPostprocessing = 0;

ios/sdk/src/CallKit.m → ios/sdk/src/callkit/CallKit.m ファイルの表示

39
 static NSString * const RNCallKitProviderDidReset
39
 static NSString * const RNCallKitProviderDidReset
40
     = @"providerDidReset";
40
     = @"providerDidReset";
41
 
41
 
42
-@interface RNCallKit : RCTEventEmitter <JMCallKitEventListener>
42
+@interface RNCallKit : RCTEventEmitter <JMCallKitListener>
43
 @end
43
 @end
44
 
44
 
45
 @implementation RNCallKit
45
 @implementation RNCallKit
112
         dictionary);
112
         dictionary);
113
 #endif
113
 #endif
114
 
114
 
115
-    if (![JMCallKitProxy hasProviderBeenConfigurated]) {
115
+    if (![JMCallKitProxy isProviderConfigured]) {
116
         [self configureProviderFromDictionary:dictionary];
116
         [self configureProviderFromDictionary:dictionary];
117
     }
117
     }
118
-    
118
+
119
     // register to receive CallKit proxy events
119
     // register to receive CallKit proxy events
120
-    [JMCallKitProxy addListener: self];
120
+    [JMCallKitProxy addListener:self];
121
 }
121
 }
122
 
122
 
123
 // Start outgoing call
123
 // Start outgoing call
130
     NSLog(@"[RNCallKit][startCall] callUUID = %@", callUUID);
130
     NSLog(@"[RNCallKit][startCall] callUUID = %@", callUUID);
131
 #endif
131
 #endif
132
 
132
 
133
-    NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
134
-    
135
-    // Don't start a call action if there's
136
-    // an active call for this UUID
137
-    // (i.e. JitsiMeetView was configured from an incoming call
133
+    // Don't start a new call if there's an active call for the specified
134
+    // callUUID. JitsiMeetView was configured for an incoming call.
138
     if ([JMCallKitProxy hasActiveCallForUUID:callUUID]) {
135
     if ([JMCallKitProxy hasActiveCallForUUID:callUUID]) {
139
         resolve(nil);
136
         resolve(nil);
140
         return;
137
         return;
141
     }
138
     }
142
-    
139
+
143
     CXHandle *handle_
140
     CXHandle *handle_
144
         = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:handle];
141
         = [[CXHandle alloc] initWithType:CXHandleTypeGeneric value:handle];
142
+    NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
145
     CXStartCallAction *action
143
     CXStartCallAction *action
146
         = [[CXStartCallAction alloc] initWithCallUUID:callUUID_
144
         = [[CXStartCallAction alloc] initWithCallUUID:callUUID_
147
                                                handle:handle_];
145
                                                handle:handle_];
156
                             reject:(RCTPromiseRejectBlock)reject) {
154
                             reject:(RCTPromiseRejectBlock)reject) {
157
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
155
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
158
     [JMCallKitProxy reportCallWith:callUUID_
156
     [JMCallKitProxy reportCallWith:callUUID_
159
-                         endedAt:nil
160
-                          reason:CXCallEndedReasonFailed];
157
+                           endedAt:nil
158
+                            reason:CXCallEndedReasonFailed];
161
     resolve(nil);
159
     resolve(nil);
162
 }
160
 }
163
 
161
 
167
                                        reject:(RCTPromiseRejectBlock)reject) {
165
                                        reject:(RCTPromiseRejectBlock)reject) {
168
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
166
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
169
     [JMCallKitProxy reportOutgoingCallWith:callUUID_
167
     [JMCallKitProxy reportOutgoingCallWith:callUUID_
170
-                             connectedAt:nil];
168
+                               connectedAt:nil];
171
     resolve(nil);
169
     resolve(nil);
172
 }
170
 }
173
 
171
 
186
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
184
     NSUUID *callUUID_ = [[NSUUID alloc] initWithUUIDString:callUUID];
187
     NSString *displayName = options[@"displayName"];
185
     NSString *displayName = options[@"displayName"];
188
     BOOL hasVideo = [(NSNumber*)options[@"hasVideo"] boolValue];
186
     BOOL hasVideo = [(NSNumber*)options[@"hasVideo"] boolValue];
189
-    
187
+
190
     [JMCallKitProxy reportCallUpdateWith:callUUID_
188
     [JMCallKitProxy reportCallUpdateWith:callUUID_
191
-                                handle:nil
192
-                           displayName:displayName
193
-                              hasVideo:hasVideo];
194
-    
189
+                                  handle:nil
190
+                             displayName:displayName
191
+                                hasVideo:hasVideo];
192
+
195
     resolve(nil);
193
     resolve(nil);
196
 }
194
 }
197
 
195
 
228
     }
226
     }
229
 
227
 
230
     NSString *ringtoneSound = dictionary[@"ringtoneSound"];
228
     NSString *ringtoneSound = dictionary[@"ringtoneSound"];
231
-    
232
-    [JMCallKitProxy configureCallKitProviderWithLocalizedName:localizedName
233
-                                              ringtoneSound:ringtoneSound
234
-                                      iconTemplateImageData:iconTemplateImageData];
229
+
230
+    [JMCallKitProxy
231
+        configureProviderWithLocalizedName:localizedName
232
+                             ringtoneSound:ringtoneSound
233
+                     iconTemplateImageData:iconTemplateImageData];
235
 }
234
 }
236
 
235
 
237
 - (void)requestTransaction:(CXTransaction *)transaction
236
 - (void)requestTransaction:(CXTransaction *)transaction
242
 #endif
241
 #endif
243
 
242
 
244
     [JMCallKitProxy request:transaction
243
     [JMCallKitProxy request:transaction
245
-               completion:^(NSError * _Nullable error) {
244
+                 completion:^(NSError * _Nullable error) {
246
         if (error) {
245
         if (error) {
247
             NSLog(
246
             NSLog(
248
                 @"[RNCallKit][requestTransaction] Error requesting transaction (%@): (%@)",
247
                 @"[RNCallKit][requestTransaction] Error requesting transaction (%@): (%@)",
255
     }];
254
     }];
256
 }
255
 }
257
 
256
 
258
-#pragma mark - JitsiMeetCallKitListener
257
+#pragma mark - JMCallKitListener
259
 
258
 
260
 // Called when the provider has been reset. We should terminate all calls.
259
 // Called when the provider has been reset. We should terminate all calls.
261
 - (void)providerDidReset {
260
 - (void)providerDidReset {
307
     NSLog(@"[RNCallKit][CXProviderDelegate][provider:performStartCallAction:]");
306
     NSLog(@"[RNCallKit][CXProviderDelegate][provider:performStartCallAction:]");
308
 #endif
307
 #endif
309
     [JMCallKitProxy reportOutgoingCallWith:UUID
308
     [JMCallKitProxy reportOutgoingCallWith:UUID
310
-                     startedConnectingAt:nil];
309
+                       startedConnectingAt:nil];
311
 }
310
 }
312
 
311
 
313
 // The following just help with debugging:
312
 // The following just help with debugging:

ios/sdk/src/callkit/JMCallKitNotifier.swift → ios/sdk/src/callkit/JMCallKitEmitter.swift ファイルの表示

18
 import CallKit
18
 import CallKit
19
 import Foundation
19
 import Foundation
20
 
20
 
21
-internal final class JMCallKitNotifier: NSObject, CXProviderDelegate {
22
-    
21
+internal final class JMCallKitEmitter: NSObject, CXProviderDelegate {
22
+
23
     private var listeners = Set<JMCallKitEventListenerWrapper>()
23
     private var listeners = Set<JMCallKitEventListenerWrapper>()
24
-    
24
+
25
     internal override init() {}
25
     internal override init() {}
26
-    
26
+
27
     // MARK: - Add/remove listeners
27
     // MARK: - Add/remove listeners
28
-    
29
-    func addListener(_ listener: JMCallKitEventListener) {
28
+
29
+    func addListener(_ listener: JMCallKitListener) {
30
         let wrapper = JMCallKitEventListenerWrapper(listener: listener)
30
         let wrapper = JMCallKitEventListenerWrapper(listener: listener)
31
         objc_sync_enter(listeners)
31
         objc_sync_enter(listeners)
32
         listeners.insert(wrapper)
32
         listeners.insert(wrapper)
33
         objc_sync_exit(listeners)
33
         objc_sync_exit(listeners)
34
     }
34
     }
35
-    
36
-    func removeListener(_ listener: JMCallKitEventListener) {
35
+
36
+    func removeListener(_ listener: JMCallKitListener) {
37
         let wrapper = JMCallKitEventListenerWrapper(listener: listener)
37
         let wrapper = JMCallKitEventListenerWrapper(listener: listener)
38
         objc_sync_enter(listeners)
38
         objc_sync_enter(listeners)
39
         listeners.remove(wrapper)
39
         listeners.remove(wrapper)
40
         objc_sync_exit(listeners)
40
         objc_sync_exit(listeners)
41
     }
41
     }
42
-    
42
+
43
     // MARK: - CXProviderDelegate
43
     // MARK: - CXProviderDelegate
44
-    
44
+
45
     func providerDidReset(_ provider: CXProvider) {
45
     func providerDidReset(_ provider: CXProvider) {
46
         objc_sync_enter(listeners)
46
         objc_sync_enter(listeners)
47
         listeners.forEach { $0.listener?.providerDidReset?() }
47
         listeners.forEach { $0.listener?.providerDidReset?() }
48
         objc_sync_exit(listeners)
48
         objc_sync_exit(listeners)
49
     }
49
     }
50
-    
50
+
51
     func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
51
     func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {
52
         objc_sync_enter(listeners)
52
         objc_sync_enter(listeners)
53
-        listeners.forEach { $0.listener?.performAnswerCall?(UUID: action.callUUID) }
53
+        listeners.forEach {
54
+            $0.listener?.performAnswerCall?(UUID: action.callUUID)
55
+        }
54
         objc_sync_exit(listeners)
56
         objc_sync_exit(listeners)
55
-        
57
+
56
         action.fulfill()
58
         action.fulfill()
57
     }
59
     }
58
-    
60
+
59
     func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
61
     func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
60
         objc_sync_enter(listeners)
62
         objc_sync_enter(listeners)
61
-        listeners.forEach { $0.listener?.performEndCall?(UUID: action.callUUID) }
63
+        listeners.forEach {
64
+            $0.listener?.performEndCall?(UUID: action.callUUID)
65
+        }
62
         objc_sync_exit(listeners)
66
         objc_sync_exit(listeners)
63
-        
67
+
64
         action.fulfill()
68
         action.fulfill()
65
     }
69
     }
66
-    
70
+
67
     func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
71
     func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
68
         objc_sync_enter(listeners)
72
         objc_sync_enter(listeners)
69
         listeners.forEach {
73
         listeners.forEach {
70
             $0.listener?.performSetMutedCall?(UUID: action.callUUID,
74
             $0.listener?.performSetMutedCall?(UUID: action.callUUID,
71
-                                             isMuted: action.isMuted)
75
+                                              isMuted: action.isMuted)
72
         }
76
         }
73
         objc_sync_exit(listeners)
77
         objc_sync_exit(listeners)
74
-        
78
+
75
         action.fulfill()
79
         action.fulfill()
76
     }
80
     }
77
-    
81
+
78
     func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
82
     func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
79
         objc_sync_enter(listeners)
83
         objc_sync_enter(listeners)
80
         listeners.forEach {
84
         listeners.forEach {
81
             $0.listener?.performStartCall?(UUID: action.callUUID,
85
             $0.listener?.performStartCall?(UUID: action.callUUID,
82
-                                          isVideo: action.isVideo)
86
+                                           isVideo: action.isVideo)
83
         }
87
         }
84
         objc_sync_exit(listeners)
88
         objc_sync_exit(listeners)
85
-        
89
+
86
         action.fulfill()
90
         action.fulfill()
87
     }
91
     }
88
-    
89
-    func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
92
+
93
+    func provider(_ provider: CXProvider,
94
+                  didActivate audioSession: AVAudioSession) {
90
         objc_sync_enter(listeners)
95
         objc_sync_enter(listeners)
91
         listeners.forEach {
96
         listeners.forEach {
92
             $0.listener?.providerDidActivateAudioSession?(session: audioSession)
97
             $0.listener?.providerDidActivateAudioSession?(session: audioSession)
93
         }
98
         }
94
         objc_sync_exit(listeners)
99
         objc_sync_exit(listeners)
95
     }
100
     }
96
-    
97
-    func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
101
+
102
+    func provider(_ provider: CXProvider,
103
+                  didDeactivate audioSession: AVAudioSession) {
98
         objc_sync_enter(listeners)
104
         objc_sync_enter(listeners)
99
         listeners.forEach {
105
         listeners.forEach {
100
-            $0.listener?.providerDidDeactivateAudioSession?(session: audioSession)
106
+            $0.listener?.providerDidDeactivateAudioSession?(
107
+                session: audioSession)
101
         }
108
         }
102
         objc_sync_exit(listeners)
109
         objc_sync_exit(listeners)
103
     }
110
     }
104
 }
111
 }
112
+
113
+fileprivate struct JMCallKitEventListenerWrapper: Hashable {
114
+
115
+    public var hashValue: Int
116
+
117
+    internal weak var listener: JMCallKitListener?
118
+
119
+    public init(listener: JMCallKitListener) {
120
+        self.listener = listener
121
+        self.hashValue = listener.hash
122
+    }
123
+
124
+    public static func ==(lhs: JMCallKitEventListenerWrapper,
125
+                          rhs: JMCallKitEventListenerWrapper) -> Bool {
126
+        // XXX We're aware that "[t]wo instances with equal hash values are not
127
+        // necessarily equal to each other."
128
+        return lhs.hashValue == rhs.hashValue
129
+    }
130
+}

ios/sdk/src/callkit/JMCallKitEventListener.swift → ios/sdk/src/callkit/JMCallKitListener.swift ファイルの表示

18
 import CallKit
18
 import CallKit
19
 import Foundation
19
 import Foundation
20
 
20
 
21
-@objc public protocol JMCallKitEventListener: NSObjectProtocol {
22
-    
21
+@objc public protocol JMCallKitListener: NSObjectProtocol {
22
+
23
     @available(iOS 10.0, *)
23
     @available(iOS 10.0, *)
24
     @objc optional func providerDidReset()
24
     @objc optional func providerDidReset()
25
-    
25
+
26
     @available(iOS 10.0, *)
26
     @available(iOS 10.0, *)
27
     @objc optional func performAnswerCall(UUID: UUID)
27
     @objc optional func performAnswerCall(UUID: UUID)
28
-    
28
+
29
     @available(iOS 10.0, *)
29
     @available(iOS 10.0, *)
30
     @objc optional func performEndCall(UUID: UUID)
30
     @objc optional func performEndCall(UUID: UUID)
31
-    
31
+
32
     @available(iOS 10.0, *)
32
     @available(iOS 10.0, *)
33
     @objc optional func performSetMutedCall(UUID: UUID, isMuted: Bool)
33
     @objc optional func performSetMutedCall(UUID: UUID, isMuted: Bool)
34
-    
34
+
35
     @available(iOS 10.0, *)
35
     @available(iOS 10.0, *)
36
     @objc optional func performStartCall(UUID: UUID, isVideo: Bool)
36
     @objc optional func performStartCall(UUID: UUID, isVideo: Bool)
37
-    
37
+
38
     @available(iOS 10.0, *)
38
     @available(iOS 10.0, *)
39
     @objc optional func providerDidActivateAudioSession(session: AVAudioSession)
39
     @objc optional func providerDidActivateAudioSession(session: AVAudioSession)
40
-    
40
+
41
     @available(iOS 10.0, *)
41
     @available(iOS 10.0, *)
42
     @objc optional func providerDidDeactivateAudioSession(session: AVAudioSession)
42
     @objc optional func providerDidDeactivateAudioSession(session: AVAudioSession)
43
-    
43
+
44
     @available(iOS 10.0, *)
44
     @available(iOS 10.0, *)
45
     @objc optional func providerTimedOutPerformingAction(action: CXAction)
45
     @objc optional func providerTimedOutPerformingAction(action: CXAction)
46
 }
46
 }
47
-
48
-internal struct JMCallKitEventListenerWrapper: Hashable {
49
-    
50
-    public var hashValue: Int
51
-    
52
-    internal weak var listener: JMCallKitEventListener?
53
-    
54
-    public init(listener: JMCallKitEventListener) {
55
-        self.listener = listener
56
-        self.hashValue = listener.hash
57
-    }
58
-    
59
-    public static func ==(lhs: JMCallKitEventListenerWrapper,
60
-                          rhs: JMCallKitEventListenerWrapper) -> Bool {
61
-        return lhs.hashValue == rhs.hashValue
62
-    }
63
-}

+ 93
- 90
ios/sdk/src/callkit/JMCallKitProxy.swift ファイルの表示

20
 /// JitsiMeet CallKit proxy
20
 /// JitsiMeet CallKit proxy
21
 @available(iOS 10.0, *)
21
 @available(iOS 10.0, *)
22
 @objc public final class JMCallKitProxy: NSObject {
22
 @objc public final class JMCallKitProxy: NSObject {
23
-    
24
-    override private init() {}
25
-    
23
+
24
+    private override init() {}
25
+
26
     // MARK: - CallKit proxy
26
     // MARK: - CallKit proxy
27
-    
28
-    internal static let cxProvider: CXProvider = {
29
-        let config = CXProviderConfiguration(localizedName: "")
30
-        let provider = CXProvider(configuration: config)
31
-        return provider
32
-    }()
33
-    
34
-    internal static let cxCallController: CXCallController = {
35
-        return CXCallController()
36
-    }()
37
-    
38
-    internal static let callKitNotifier: JMCallKitNotifier = {
39
-        return JMCallKitNotifier()
27
+
28
+    private static let provider: CXProvider = {
29
+        let configuration = CXProviderConfiguration(localizedName: "")
30
+        return CXProvider(configuration: configuration)
40
     }()
31
     }()
41
-    
42
-    internal static var cxProviderConfiguration: CXProviderConfiguration? {
32
+
33
+    private static var providerConfiguration: CXProviderConfiguration? {
43
         didSet {
34
         didSet {
44
-            guard let providerConfiguration = cxProviderConfiguration else { return }
45
-            cxProvider.configuration = providerConfiguration
46
-            cxProvider.setDelegate(callKitNotifier, queue: nil)
35
+            guard let configuration = providerConfiguration else { return }
36
+            provider.configuration = configuration
37
+            provider.setDelegate(emitter, queue: nil)
47
         }
38
         }
48
     }
39
     }
49
-    
50
-    /// Enables the proxy in between callkit and the consumers of the SDK
51
-    /// Default to enabled, set to false when you don't want to use callkit
40
+
41
+    private static let callController: CXCallController = {
42
+        return CXCallController()
43
+    }()
44
+
45
+    private static let emitter: JMCallKitEmitter = {
46
+        return JMCallKitEmitter()
47
+    }()
48
+
49
+    /// Enables the proxy in between CallKit and the consumers of the SDK.
50
+    /// Defaults to enabled, set to false when you don't want to use CallKit.
52
     @objc public static var enabled: Bool = true {
51
     @objc public static var enabled: Bool = true {
53
         didSet {
52
         didSet {
54
             if enabled == false {
53
             if enabled == false {
55
-                cxProvider.setDelegate(nil, queue: nil)
54
+                provider.setDelegate(nil, queue: nil)
56
             }
55
             }
57
         }
56
         }
58
     }
57
     }
59
-    
60
-    @objc public static func hasProviderBeenConfigurated() -> Bool {
61
-        return cxProviderConfiguration != nil
62
-    }
63
-        
64
-    @objc public static func configureCallKitProvider(localizedName: String,
65
-                                                      ringtoneSound: String?,
66
-                                                      iconTemplateImageData: Data?) {
58
+
59
+    @objc public static func configureProvider(localizedName: String,
60
+                                               ringtoneSound: String?,
61
+                                               iconTemplateImageData: Data?) {
67
         let configuration = CXProviderConfiguration(localizedName: localizedName)
62
         let configuration = CXProviderConfiguration(localizedName: localizedName)
68
-        configuration.ringtoneSound = ringtoneSound
69
         configuration.iconTemplateImageData = iconTemplateImageData
63
         configuration.iconTemplateImageData = iconTemplateImageData
70
-        
71
         configuration.maximumCallGroups = 1
64
         configuration.maximumCallGroups = 1
72
         configuration.maximumCallsPerCallGroup = 1
65
         configuration.maximumCallsPerCallGroup = 1
66
+        configuration.ringtoneSound = ringtoneSound
73
         configuration.supportedHandleTypes = [CXHandle.HandleType.generic]
67
         configuration.supportedHandleTypes = [CXHandle.HandleType.generic]
74
         configuration.supportsVideo = true
68
         configuration.supportsVideo = true
75
-        cxProviderConfiguration = configuration
69
+
70
+        providerConfiguration = configuration
76
     }
71
     }
77
-    
78
-    @objc public static func addListener(_ listener: JMCallKitEventListener) {
79
-        callKitNotifier.addListener(listener)
72
+
73
+    @objc public static func isProviderConfigured() -> Bool {
74
+        return providerConfiguration != nil
80
     }
75
     }
81
-    
82
-    @objc public static func removeListener(_ listener: JMCallKitEventListener) {
83
-        callKitNotifier.removeListener(listener)
76
+
77
+    @objc public static func addListener(_ listener: JMCallKitListener) {
78
+        emitter.addListener(listener)
84
     }
79
     }
85
-    
80
+
81
+    @objc public static func removeListener(_ listener: JMCallKitListener) {
82
+        emitter.removeListener(listener)
83
+    }
84
+
86
     @objc public static func hasActiveCallForUUID(_ callUUID: String) -> Bool {
85
     @objc public static func hasActiveCallForUUID(_ callUUID: String) -> Bool {
87
-        let activeCallForUUID = cxCallController.callObserver.calls.first {
86
+        let activeCallForUUID = callController.callObserver.calls.first {
88
             $0.uuid == UUID(uuidString: callUUID)
87
             $0.uuid == UUID(uuidString: callUUID)
89
         }
88
         }
90
         guard activeCallForUUID != nil else { return false }
89
         guard activeCallForUUID != nil else { return false }
91
         return true
90
         return true
92
     }
91
     }
93
-    
94
-    @objc public static func reportNewIncomingCall(UUID: UUID,
95
-                                             handle: String?,
96
-                                             displayName: String?,
97
-                                             hasVideo: Bool,
98
-                                             completion: @escaping (Error?) -> Void) {
92
+
93
+    @objc public static func reportNewIncomingCall(
94
+            UUID: UUID,
95
+            handle: String?,
96
+            displayName: String?,
97
+            hasVideo: Bool,
98
+            completion: @escaping (Error?) -> Void) {
99
         guard enabled else { return }
99
         guard enabled else { return }
100
-        
100
+
101
         let callUpdate = makeCXUpdate(handle: handle,
101
         let callUpdate = makeCXUpdate(handle: handle,
102
                                       displayName: displayName,
102
                                       displayName: displayName,
103
                                       hasVideo: hasVideo)
103
                                       hasVideo: hasVideo)
104
-        cxProvider.reportNewIncomingCall(with: UUID,
105
-                                         update: callUpdate,
106
-                                         completion: completion)
104
+        provider.reportNewIncomingCall(with: UUID,
105
+                                       update: callUpdate,
106
+                                       completion: completion)
107
     }
107
     }
108
-    
108
+
109
     @objc public static func reportCallUpdate(with UUID: UUID,
109
     @objc public static func reportCallUpdate(with UUID: UUID,
110
-                                        handle: String?,
111
-                                        displayName: String?,
112
-                                        hasVideo: Bool) {
110
+                                              handle: String?,
111
+                                              displayName: String?,
112
+                                              hasVideo: Bool) {
113
         guard enabled else { return }
113
         guard enabled else { return }
114
-        
114
+
115
         let callUpdate = makeCXUpdate(handle: handle,
115
         let callUpdate = makeCXUpdate(handle: handle,
116
                                       displayName: displayName,
116
                                       displayName: displayName,
117
                                       hasVideo: hasVideo)
117
                                       hasVideo: hasVideo)
118
-        cxProvider.reportCall(with: UUID, updated: callUpdate)
118
+        provider.reportCall(with: UUID, updated: callUpdate)
119
     }
119
     }
120
-    
121
-    @objc public static func reportCall(with UUID: UUID,
122
-                           endedAt dateEnded: Date?,
123
-                           reason endedReason: CXCallEndedReason) {
120
+
121
+    @objc public static func reportCall(
122
+            with UUID: UUID,
123
+            endedAt dateEnded: Date?,
124
+            reason endedReason: CXCallEndedReason) {
124
         guard enabled else { return }
125
         guard enabled else { return }
125
-        
126
-        cxProvider.reportCall(with: UUID,
127
-                              endedAt: dateEnded,
128
-                              reason: endedReason)
126
+
127
+        provider.reportCall(with: UUID,
128
+                            endedAt: dateEnded,
129
+                            reason: endedReason)
129
     }
130
     }
130
-    
131
-    @objc public static func reportOutgoingCall(with UUID: UUID,
132
-          startedConnectingAt dateStartedConnecting: Date?) {
131
+
132
+    @objc public static func reportOutgoingCall(
133
+            with UUID: UUID,
134
+            startedConnectingAt dateStartedConnecting: Date?) {
133
         guard enabled else { return }
135
         guard enabled else { return }
134
-        
135
-        cxProvider.reportOutgoingCall(with: UUID,
136
-                                      startedConnectingAt: dateStartedConnecting)
136
+
137
+        provider.reportOutgoingCall(with: UUID,
138
+                                    startedConnectingAt: dateStartedConnecting)
137
     }
139
     }
138
-    
139
-    @objc public static func reportOutgoingCall(with UUID: UUID,
140
-                                          connectedAt dateConnected: Date?) {
140
+
141
+    @objc public static func reportOutgoingCall(
142
+            with UUID: UUID,
143
+            connectedAt dateConnected: Date?) {
141
         guard enabled else { return }
144
         guard enabled else { return }
142
-        
143
-        cxProvider.reportOutgoingCall(with: UUID, connectedAt: dateConnected)
145
+
146
+        provider.reportOutgoingCall(with: UUID, connectedAt: dateConnected)
144
     }
147
     }
145
-    
146
-    @objc public static func request(_ transaction: CXTransaction,
147
-                                completion: @escaping (Error?) -> Swift.Void) {
148
+
149
+    @objc public static func request(
150
+            _ transaction: CXTransaction,
151
+            completion: @escaping (Error?) -> Swift.Void) {
148
         guard enabled else { return }
152
         guard enabled else { return }
149
-        
150
-        cxCallController.request(transaction, completion: completion)
153
+
154
+        callController.request(transaction, completion: completion)
151
     }
155
     }
152
-    
156
+
153
     // MARK: - Callkit Proxy helpers
157
     // MARK: - Callkit Proxy helpers
154
-    
158
+
155
     private static func makeCXUpdate(handle: String?,
159
     private static func makeCXUpdate(handle: String?,
156
                                      displayName: String?,
160
                                      displayName: String?,
157
                                      hasVideo: Bool) -> CXCallUpdate {
161
                                      hasVideo: Bool) -> CXCallUpdate {
161
         update.supportsGrouping = false
165
         update.supportsGrouping = false
162
         update.supportsUngrouping = false
166
         update.supportsUngrouping = false
163
         update.hasVideo = hasVideo
167
         update.hasVideo = hasVideo
164
-        
168
+
165
         if let handle = handle {
169
         if let handle = handle {
166
             update.remoteHandle = CXHandle(type: .generic,
170
             update.remoteHandle = CXHandle(type: .generic,
167
                                            value: handle)
171
                                            value: handle)
168
         }
172
         }
169
-        
173
+
170
         if let displayName = displayName {
174
         if let displayName = displayName {
171
             update.localizedCallerName = displayName
175
             update.localizedCallerName = displayName
172
         }
176
         }
173
-        
177
+
174
         return update
178
         return update
175
     }
179
     }
176
-
177
 }
180
 }

+ 20
- 20
ios/sdk/src/picture-in-picture/DragGestureController.swift ファイルの表示

15
  */
15
  */
16
 
16
 
17
 final class DragGestureController {
17
 final class DragGestureController {
18
-    
18
+
19
     var insets: UIEdgeInsets = UIEdgeInsets.zero
19
     var insets: UIEdgeInsets = UIEdgeInsets.zero
20
-    
20
+
21
     private var frameBeforeDragging: CGRect = CGRect.zero
21
     private var frameBeforeDragging: CGRect = CGRect.zero
22
     private weak var view: UIView?
22
     private weak var view: UIView?
23
     private lazy var panGesture: UIPanGestureRecognizer = {
23
     private lazy var panGesture: UIPanGestureRecognizer = {
24
         return UIPanGestureRecognizer(target: self,
24
         return UIPanGestureRecognizer(target: self,
25
                                       action: #selector(handlePan(gesture:)))
25
                                       action: #selector(handlePan(gesture:)))
26
     }()
26
     }()
27
-    
27
+
28
     func startDragListener(inView view: UIView) {
28
     func startDragListener(inView view: UIView) {
29
         self.view = view
29
         self.view = view
30
         view.addGestureRecognizer(panGesture)
30
         view.addGestureRecognizer(panGesture)
31
         panGesture.isEnabled = true
31
         panGesture.isEnabled = true
32
     }
32
     }
33
-    
33
+
34
     func stopDragListener() {
34
     func stopDragListener() {
35
         panGesture.isEnabled = false
35
         panGesture.isEnabled = false
36
         view?.removeGestureRecognizer(panGesture)
36
         view?.removeGestureRecognizer(panGesture)
37
         view = nil
37
         view = nil
38
     }
38
     }
39
-    
39
+
40
     @objc private func handlePan(gesture: UIPanGestureRecognizer) {
40
     @objc private func handlePan(gesture: UIPanGestureRecognizer) {
41
         guard let view = self.view else { return }
41
         guard let view = self.view else { return }
42
-        
42
+
43
         let translation = gesture.translation(in: view.superview)
43
         let translation = gesture.translation(in: view.superview)
44
         let velocity = gesture.velocity(in: view.superview)
44
         let velocity = gesture.velocity(in: view.superview)
45
         var frame = frameBeforeDragging
45
         var frame = frameBeforeDragging
46
-        
46
+
47
         switch gesture.state {
47
         switch gesture.state {
48
         case .began:
48
         case .began:
49
             frameBeforeDragging = view.frame
49
             frameBeforeDragging = view.frame
50
-            
50
+
51
         case .changed:
51
         case .changed:
52
             frame.origin.x = floor(frame.origin.x + translation.x)
52
             frame.origin.x = floor(frame.origin.x + translation.x)
53
             frame.origin.y = floor(frame.origin.y + translation.y)
53
             frame.origin.y = floor(frame.origin.y + translation.y)
54
             view.frame = frame
54
             view.frame = frame
55
-            
55
+
56
         case .ended:
56
         case .ended:
57
             let currentPos = view.frame.origin
57
             let currentPos = view.frame.origin
58
             let finalPos = calculateFinalPosition()
58
             let finalPos = calculateFinalPosition()
59
-            
59
+
60
             let distance = CGPoint(x: currentPos.x - finalPos.x,
60
             let distance = CGPoint(x: currentPos.x - finalPos.x,
61
                                    y: currentPos.y - finalPos.y)
61
                                    y: currentPos.y - finalPos.y)
62
             let distanceMagnitude = magnitude(vector: distance)
62
             let distanceMagnitude = magnitude(vector: distance)
64
             let animationDuration = 0.5
64
             let animationDuration = 0.5
65
             let initialSpringVelocity =
65
             let initialSpringVelocity =
66
                 velocityMagnitude / distanceMagnitude / CGFloat(animationDuration)
66
                 velocityMagnitude / distanceMagnitude / CGFloat(animationDuration)
67
-            
67
+
68
             frame.origin = CGPoint(x: finalPos.x, y: finalPos.y)
68
             frame.origin = CGPoint(x: finalPos.x, y: finalPos.y)
69
-            
69
+
70
             UIView.animate(withDuration: animationDuration,
70
             UIView.animate(withDuration: animationDuration,
71
                            delay: 0,
71
                            delay: 0,
72
                            usingSpringWithDamping: 0.9,
72
                            usingSpringWithDamping: 0.9,
75
                            animations: {
75
                            animations: {
76
                             view.frame = frame
76
                             view.frame = frame
77
             }, completion: nil)
77
             }, completion: nil)
78
-            
78
+
79
         default:
79
         default:
80
             break
80
             break
81
         }
81
         }
82
     }
82
     }
83
-    
83
+
84
     private func calculateFinalPosition() -> CGPoint {
84
     private func calculateFinalPosition() -> CGPoint {
85
         guard
85
         guard
86
             let view = self.view,
86
             let view = self.view,
87
             let bounds = view.superview?.frame
87
             let bounds = view.superview?.frame
88
             else { return CGPoint.zero }
88
             else { return CGPoint.zero }
89
-        
89
+
90
         let currentSize = view.frame.size
90
         let currentSize = view.frame.size
91
         let adjustedBounds = UIEdgeInsetsInsetRect(bounds, insets)
91
         let adjustedBounds = UIEdgeInsetsInsetRect(bounds, insets)
92
         let threshold: CGFloat = 20.0
92
         let threshold: CGFloat = 20.0
93
         let velocity = panGesture.velocity(in: view.superview)
93
         let velocity = panGesture.velocity(in: view.superview)
94
         let location = panGesture.location(in: view.superview)
94
         let location = panGesture.location(in: view.superview)
95
-        
95
+
96
         let goLeft: Bool
96
         let goLeft: Bool
97
         if fabs(velocity.x) > threshold {
97
         if fabs(velocity.x) > threshold {
98
             goLeft = velocity.x < -threshold
98
             goLeft = velocity.x < -threshold
99
         } else {
99
         } else {
100
             goLeft = location.x < bounds.midX
100
             goLeft = location.x < bounds.midX
101
         }
101
         }
102
-        
102
+
103
         let goUp: Bool
103
         let goUp: Bool
104
         if fabs(velocity.y) > threshold {
104
         if fabs(velocity.y) > threshold {
105
             goUp = velocity.y < -threshold
105
             goUp = velocity.y < -threshold
106
         } else {
106
         } else {
107
             goUp = location.y < bounds.midY
107
             goUp = location.y < bounds.midY
108
         }
108
         }
109
-        
109
+
110
         let finalPosX: CGFloat =
110
         let finalPosX: CGFloat =
111
             goLeft
111
             goLeft
112
                 ? adjustedBounds.origin.x
112
                 ? adjustedBounds.origin.x
115
             goUp
115
             goUp
116
                 ? adjustedBounds.origin.y
116
                 ? adjustedBounds.origin.y
117
                 : bounds.size.height - insets.bottom - currentSize.height
117
                 : bounds.size.height - insets.bottom - currentSize.height
118
-        
118
+
119
         return CGPoint(x: finalPosX, y: finalPosY)
119
         return CGPoint(x: finalPosX, y: finalPosY)
120
     }
120
     }
121
-    
121
+
122
     private func magnitude(vector: CGPoint) -> CGFloat {
122
     private func magnitude(vector: CGPoint) -> CGFloat {
123
         return sqrt(pow(vector.x, 2) + pow(vector.y, 2))
123
         return sqrt(pow(vector.x, 2) + pow(vector.y, 2))
124
     }
124
     }

+ 31
- 31
ios/sdk/src/picture-in-picture/PiPViewCoordinator.swift ファイルの表示

21
 /// This object will also provide the drag and tap interactions of the view
21
 /// This object will also provide the drag and tap interactions of the view
22
 /// when is presented in Picure in Picture mode.
22
 /// when is presented in Picure in Picture mode.
23
 public class PiPViewCoordinator {
23
 public class PiPViewCoordinator {
24
-    
24
+
25
     /// Limits the boundries of view position on screen when minimized
25
     /// Limits the boundries of view position on screen when minimized
26
     public var dragBoundInsets: UIEdgeInsets = UIEdgeInsets(top: 25,
26
     public var dragBoundInsets: UIEdgeInsets = UIEdgeInsets(top: 25,
27
                                                             left: 5,
27
                                                             left: 5,
31
             dragController.insets = dragBoundInsets
31
             dragController.insets = dragBoundInsets
32
         }
32
         }
33
     }
33
     }
34
-    
34
+
35
     /// The size ratio of the view when in PiP mode
35
     /// The size ratio of the view when in PiP mode
36
     public var pipSizeRatio: CGFloat = {
36
     public var pipSizeRatio: CGFloat = {
37
         let deviceIdiom = UIScreen.main.traitCollection.userInterfaceIdiom
37
         let deviceIdiom = UIScreen.main.traitCollection.userInterfaceIdiom
44
             return 0.25
44
             return 0.25
45
         }
45
         }
46
     }()
46
     }()
47
-    
47
+
48
     private(set) var isInPiP: Bool = false // true if view is in PiP mode
48
     private(set) var isInPiP: Bool = false // true if view is in PiP mode
49
-    
49
+
50
     private(set) var view: UIView
50
     private(set) var view: UIView
51
     private var currentBounds: CGRect = CGRect.zero
51
     private var currentBounds: CGRect = CGRect.zero
52
-    
52
+
53
     private var tapGestureRecognizer: UITapGestureRecognizer?
53
     private var tapGestureRecognizer: UITapGestureRecognizer?
54
     private var exitPiPButton: UIButton?
54
     private var exitPiPButton: UIButton?
55
-    
55
+
56
     private let dragController: DragGestureController = DragGestureController()
56
     private let dragController: DragGestureController = DragGestureController()
57
-    
57
+
58
     public init(withView view: UIView) {
58
     public init(withView view: UIView) {
59
         self.view = view
59
         self.view = view
60
     }
60
     }
61
-    
61
+
62
     /// Configure the view to be always on top of all the contents
62
     /// Configure the view to be always on top of all the contents
63
     /// of the provided parent view.
63
     /// of the provided parent view.
64
     /// If a parentView is not provided it will try to use the main window
64
     /// If a parentView is not provided it will try to use the main window
66
         guard
66
         guard
67
             let parentView = parentView ?? UIApplication.shared.keyWindow
67
             let parentView = parentView ?? UIApplication.shared.keyWindow
68
             else { return }
68
             else { return }
69
-        
69
+
70
         parentView.addSubview(view)
70
         parentView.addSubview(view)
71
         currentBounds = parentView.bounds
71
         currentBounds = parentView.bounds
72
         view.frame = currentBounds
72
         view.frame = currentBounds
73
         view.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)
73
         view.layer.zPosition = CGFloat(Float.greatestFiniteMagnitude)
74
     }
74
     }
75
-    
75
+
76
     /// Show view with fade in animation
76
     /// Show view with fade in animation
77
     public func show(completion: AnimationCompletion? = nil) {
77
     public func show(completion: AnimationCompletion? = nil) {
78
         if view.isHidden || view.alpha < 1 {
78
         if view.isHidden || view.alpha < 1 {
79
             view.isHidden = false
79
             view.isHidden = false
80
             view.alpha = 0
80
             view.alpha = 0
81
-            
81
+
82
             animateTransition(animations: { [weak self] in
82
             animateTransition(animations: { [weak self] in
83
                 self?.view.alpha = 1
83
                 self?.view.alpha = 1
84
             }, completion: completion)
84
             }, completion: completion)
85
         }
85
         }
86
     }
86
     }
87
-    
87
+
88
     /// Hide view with fade out animation
88
     /// Hide view with fade out animation
89
     public func hide(completion: AnimationCompletion? = nil) {
89
     public func hide(completion: AnimationCompletion? = nil) {
90
         if view.isHidden || view.alpha > 0 {
90
         if view.isHidden || view.alpha > 0 {
94
             }, completion: completion)
94
             }, completion: completion)
95
         }
95
         }
96
     }
96
     }
97
-    
97
+
98
     /// Resize view to and change state to custom PictureInPicture mode
98
     /// Resize view to and change state to custom PictureInPicture mode
99
     /// This will resize view, add a  gesture to enable user to "drag" view
99
     /// This will resize view, add a  gesture to enable user to "drag" view
100
     /// around screen, and add a button of top of the view to be able to exit mode
100
     /// around screen, and add a button of top of the view to be able to exit mode
103
         animateViewChange()
103
         animateViewChange()
104
         dragController.startDragListener(inView: view)
104
         dragController.startDragListener(inView: view)
105
         dragController.insets = dragBoundInsets
105
         dragController.insets = dragBoundInsets
106
-        
106
+
107
         // add single tap gesture recognition for displaying exit PiP UI
107
         // add single tap gesture recognition for displaying exit PiP UI
108
         let exitSelector = #selector(toggleExitPiP)
108
         let exitSelector = #selector(toggleExitPiP)
109
         let tapGestureRecognizer = UITapGestureRecognizer(target: self,
109
         let tapGestureRecognizer = UITapGestureRecognizer(target: self,
111
         self.tapGestureRecognizer = tapGestureRecognizer
111
         self.tapGestureRecognizer = tapGestureRecognizer
112
         view.addGestureRecognizer(tapGestureRecognizer)
112
         view.addGestureRecognizer(tapGestureRecognizer)
113
     }
113
     }
114
-    
114
+
115
     /// Exit Picture in picture mode, this will resize view, remove
115
     /// Exit Picture in picture mode, this will resize view, remove
116
     /// exit pip button, and disable the drag gesture
116
     /// exit pip button, and disable the drag gesture
117
     @objc public func exitPictureInPicture() {
117
     @objc public func exitPictureInPicture() {
118
         isInPiP = false
118
         isInPiP = false
119
         animateViewChange()
119
         animateViewChange()
120
         dragController.stopDragListener()
120
         dragController.stopDragListener()
121
-        
121
+
122
         // hide PiP UI
122
         // hide PiP UI
123
         exitPiPButton?.removeFromSuperview()
123
         exitPiPButton?.removeFromSuperview()
124
         exitPiPButton = nil
124
         exitPiPButton = nil
125
-        
125
+
126
         // remove gesture
126
         // remove gesture
127
         let exitSelector = #selector(toggleExitPiP)
127
         let exitSelector = #selector(toggleExitPiP)
128
         tapGestureRecognizer?.removeTarget(self, action: exitSelector)
128
         tapGestureRecognizer?.removeTarget(self, action: exitSelector)
129
         tapGestureRecognizer = nil
129
         tapGestureRecognizer = nil
130
     }
130
     }
131
-    
131
+
132
     /// Reset view to provide bounds, use this method on rotation or
132
     /// Reset view to provide bounds, use this method on rotation or
133
     /// screen size changes
133
     /// screen size changes
134
     public func resetBounds(bounds: CGRect) {
134
     public func resetBounds(bounds: CGRect) {
135
         currentBounds = bounds
135
         currentBounds = bounds
136
         exitPictureInPicture()
136
         exitPictureInPicture()
137
     }
137
     }
138
-    
138
+
139
     /// Stop the dragging gesture of the root view
139
     /// Stop the dragging gesture of the root view
140
     public func stopDragGesture() {
140
     public func stopDragGesture() {
141
         dragController.stopDragListener()
141
         dragController.stopDragListener()
142
     }
142
     }
143
-    
143
+
144
     /// Customize the presentation of exit pip button
144
     /// Customize the presentation of exit pip button
145
     open func configureExitPiPButton(target: Any,
145
     open func configureExitPiPButton(target: Any,
146
                                      action: Selector) -> UIButton {
146
                                      action: Selector) -> UIButton {
157
         button.addTarget(target, action: action, for: .touchUpInside)
157
         button.addTarget(target, action: action, for: .touchUpInside)
158
         return button
158
         return button
159
     }
159
     }
160
-    
160
+
161
     // MARK: - Interactions
161
     // MARK: - Interactions
162
-    
162
+
163
     @objc private func toggleExitPiP() {
163
     @objc private func toggleExitPiP() {
164
         if exitPiPButton == nil {
164
         if exitPiPButton == nil {
165
             // show button
165
             // show button
168
                                                 action: exitSelector)
168
                                                 action: exitSelector)
169
             view.addSubview(button)
169
             view.addSubview(button)
170
             exitPiPButton = button
170
             exitPiPButton = button
171
-            
171
+
172
         } else {
172
         } else {
173
             // hide button
173
             // hide button
174
             exitPiPButton?.removeFromSuperview()
174
             exitPiPButton?.removeFromSuperview()
175
             exitPiPButton = nil
175
             exitPiPButton = nil
176
         }
176
         }
177
     }
177
     }
178
-    
178
+
179
     // MARK: - Size calculation
179
     // MARK: - Size calculation
180
-    
180
+
181
     private func animateViewChange() {
181
     private func animateViewChange() {
182
         UIView.animate(withDuration: 0.25) {
182
         UIView.animate(withDuration: 0.25) {
183
             self.view.frame = self.changeViewRect()
183
             self.view.frame = self.changeViewRect()
184
             self.view.setNeedsLayout()
184
             self.view.setNeedsLayout()
185
         }
185
         }
186
     }
186
     }
187
-    
187
+
188
     private func changeViewRect() -> CGRect {
188
     private func changeViewRect() -> CGRect {
189
         let bounds = currentBounds
189
         let bounds = currentBounds
190
-        
190
+
191
         guard isInPiP else {
191
         guard isInPiP else {
192
             return bounds
192
             return bounds
193
         }
193
         }
194
-        
194
+
195
         // resize to suggested ratio and position to the bottom right
195
         // resize to suggested ratio and position to the bottom right
196
         let adjustedBounds = UIEdgeInsetsInsetRect(bounds, dragBoundInsets)
196
         let adjustedBounds = UIEdgeInsetsInsetRect(bounds, dragBoundInsets)
197
         let size = CGSize(width: bounds.size.width * pipSizeRatio,
197
         let size = CGSize(width: bounds.size.width * pipSizeRatio,
200
         let y: CGFloat = adjustedBounds.maxY - size.height
200
         let y: CGFloat = adjustedBounds.maxY - size.height
201
         return CGRect(x: x, y: y, width: size.width, height: size.height)
201
         return CGRect(x: x, y: y, width: size.width, height: size.height)
202
     }
202
     }
203
-    
203
+
204
     // MARK: - Animation helpers
204
     // MARK: - Animation helpers
205
-    
205
+
206
     private func animateTransition(animations: @escaping () -> Void,
206
     private func animateTransition(animations: @escaping () -> Void,
207
                                    completion: AnimationCompletion?) {
207
                                    completion: AnimationCompletion?) {
208
         UIView.animate(withDuration: 0.1,
208
         UIView.animate(withDuration: 0.1,
211
                        animations: animations,
211
                        animations: animations,
212
                        completion: completion)
212
                        completion: completion)
213
     }
213
     }
214
-    
214
+
215
 }
215
 }

+ 49
- 54
react/features/mobile/callkit/middleware.js ファイルの表示

2
 
2
 
3
 import uuid from 'uuid';
3
 import uuid from 'uuid';
4
 
4
 
5
-import {
6
-    createTrackMutedEvent,
7
-    sendAnalytics
8
-} from '../../analytics';
5
+import { createTrackMutedEvent, sendAnalytics } from '../../analytics';
9
 import {
6
 import {
10
     APP_WILL_MOUNT,
7
     APP_WILL_MOUNT,
11
     APP_WILL_UNMOUNT,
8
     APP_WILL_UNMOUNT,
29
     setAudioMuted
26
     setAudioMuted
30
 } from '../../base/media';
27
 } from '../../base/media';
31
 import { MiddlewareRegistry } from '../../base/redux';
28
 import { MiddlewareRegistry } from '../../base/redux';
32
-import {
33
-    TRACK_CREATE_ERROR,
34
-    isLocalTrackMuted
35
-} from '../../base/tracks';
29
+import { TRACK_CREATE_ERROR, isLocalTrackMuted } from '../../base/tracks';
36
 
30
 
37
 import { _SET_CALLKIT_SUBSCRIPTIONS } from './actionTypes';
31
 import { _SET_CALLKIT_SUBSCRIPTIONS } from './actionTypes';
38
 import CallKit from './CallKit';
32
 import CallKit from './CallKit';
39
 
33
 
40
 /**
34
 /**
41
- * Middleware that captures several system actions and hooks up CallKit.
35
+ * Middleware that captures system actions and hooks up CallKit.
42
  *
36
  *
43
  * @param {Store} store - The redux store.
37
  * @param {Store} store - The redux store.
44
  * @returns {Function}
38
  * @returns {Function}
84
 });
78
 });
85
 
79
 
86
 /**
80
 /**
87
- * Notifies the feature jwt that the action {@link APP_WILL_MOUNT} is being
81
+ * Notifies the feature callkit that the action {@link APP_WILL_MOUNT} is being
88
  * dispatched within a specific redux {@code store}.
82
  * dispatched within a specific redux {@code store}.
89
  *
83
  *
90
  * @param {Store} store - The redux store in which the specified {@code action}
84
  * @param {Store} store - The redux store in which the specified {@code action}
91
  * is being dispatched.
85
  * is being dispatched.
92
- * @param {Dispatch} next - The redux dispatch function to dispatch the
93
- * specified {@code action} to the specified {@code store}.
86
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
87
+ * specified {@code action} in the specified {@code store}.
94
  * @param {Action} action - The redux action {@code APP_WILL_MOUNT} which is
88
  * @param {Action} action - The redux action {@code APP_WILL_MOUNT} which is
95
  * being dispatched in the specified {@code store}.
89
  * being dispatched in the specified {@code store}.
96
  * @private
90
  * @private
97
- * @returns {*}
91
+ * @returns {*} The value returned by {@code next(action)}.
98
  */
92
  */
99
 function _appWillMount({ dispatch, getState }, next, action) {
93
 function _appWillMount({ dispatch, getState }, next, action) {
100
     const result = next(action);
94
     const result = next(action);
119
             context),
113
             context),
120
 
114
 
121
         // According to CallKit's documentation, when the system resets we
115
         // According to CallKit's documentation, when the system resets we
122
-        // should terminate all calls. Hence, providerDidReset is the same
123
-        // to us as performEndCallAction.
116
+        // should terminate all calls. Hence, providerDidReset is the same to us
117
+        // as performEndCallAction.
124
         CallKit.addListener(
118
         CallKit.addListener(
125
             'providerDidReset',
119
             'providerDidReset',
126
             _onPerformEndCallAction,
120
             _onPerformEndCallAction,
136
 }
130
 }
137
 
131
 
138
 /**
132
 /**
139
- * Notifies the feature jwt that the action {@link CONFERENCE_FAILED} is being
140
- * dispatched within a specific redux {@code store}.
133
+ * Notifies the feature callkit that the action {@link CONFERENCE_FAILED} is
134
+ * being dispatched within a specific redux {@code store}.
141
  *
135
  *
142
  * @param {Store} store - The redux store in which the specified {@code action}
136
  * @param {Store} store - The redux store in which the specified {@code action}
143
  * is being dispatched.
137
  * is being dispatched.
144
- * @param {Dispatch} next - The redux dispatch function to dispatch the
145
- * specified {@code action} to the specified {@code store}.
138
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
139
+ * specified {@code action} in the specified {@code store}.
146
  * @param {Action} action - The redux action {@code CONFERENCE_FAILED} which is
140
  * @param {Action} action - The redux action {@code CONFERENCE_FAILED} which is
147
  * being dispatched in the specified {@code store}.
141
  * being dispatched in the specified {@code store}.
148
  * @private
142
  * @private
149
- * @returns {*}
143
+ * @returns {*} The value returned by {@code next(action)}.
150
  */
144
  */
151
 function _conferenceFailed(store, next, action) {
145
 function _conferenceFailed(store, next, action) {
152
     const result = next(action);
146
     const result = next(action);
166
 }
160
 }
167
 
161
 
168
 /**
162
 /**
169
- * Notifies the feature jwt that the action {@link CONFERENCE_JOINED} is being
170
- * dispatched within a specific redux {@code store}.
163
+ * Notifies the feature callkit that the action {@link CONFERENCE_JOINED} is
164
+ * being dispatched within a specific redux {@code store}.
171
  *
165
  *
172
  * @param {Store} store - The redux store in which the specified {@code action}
166
  * @param {Store} store - The redux store in which the specified {@code action}
173
  * is being dispatched.
167
  * is being dispatched.
174
- * @param {Dispatch} next - The redux dispatch function to dispatch the
175
- * specified {@code action} to the specified {@code store}.
168
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
169
+ * specified {@code action} in the specified {@code store}.
176
  * @param {Action} action - The redux action {@code CONFERENCE_JOINED} which is
170
  * @param {Action} action - The redux action {@code CONFERENCE_JOINED} which is
177
  * being dispatched in the specified {@code store}.
171
  * being dispatched in the specified {@code store}.
178
  * @private
172
  * @private
179
- * @returns {*}
173
+ * @returns {*} The value returned by {@code next(action)}.
180
  */
174
  */
181
 function _conferenceJoined(store, next, action) {
175
 function _conferenceJoined(store, next, action) {
182
     const result = next(action);
176
     const result = next(action);
191
 }
185
 }
192
 
186
 
193
 /**
187
 /**
194
- * Notifies the feature jwt that the action {@link CONFERENCE_LEFT} is being
188
+ * Notifies the feature callkit that the action {@link CONFERENCE_LEFT} is being
195
  * dispatched within a specific redux {@code store}.
189
  * dispatched within a specific redux {@code store}.
196
  *
190
  *
197
  * @param {Store} store - The redux store in which the specified {@code action}
191
  * @param {Store} store - The redux store in which the specified {@code action}
198
  * is being dispatched.
192
  * is being dispatched.
199
- * @param {Dispatch} next - The redux dispatch function to dispatch the
200
- * specified {@code action} to the specified {@code store}.
193
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
194
+ * specified {@code action} in the specified {@code store}.
201
  * @param {Action} action - The redux action {@code CONFERENCE_LEFT} which is
195
  * @param {Action} action - The redux action {@code CONFERENCE_LEFT} which is
202
  * being dispatched in the specified {@code store}.
196
  * being dispatched in the specified {@code store}.
203
  * @private
197
  * @private
204
- * @returns {*}
198
+ * @returns {*} The value returned by {@code next(action)}.
205
  */
199
  */
206
 function _conferenceLeft(store, next, action) {
200
 function _conferenceLeft(store, next, action) {
207
     const result = next(action);
201
     const result = next(action);
216
 }
210
 }
217
 
211
 
218
 /**
212
 /**
219
- * Notifies the feature jwt that the action {@link CONFERENCE_WILL_JOIN} is
213
+ * Notifies the feature callkit that the action {@link CONFERENCE_WILL_JOIN} is
220
  * being dispatched within a specific redux {@code store}.
214
  * being dispatched within a specific redux {@code store}.
221
  *
215
  *
222
  * @param {Store} store - The redux store in which the specified {@code action}
216
  * @param {Store} store - The redux store in which the specified {@code action}
223
  * is being dispatched.
217
  * is being dispatched.
224
- * @param {Dispatch} next - The redux dispatch function to dispatch the
225
- * specified {@code action} to the specified {@code store}.
218
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
219
+ * specified {@code action} in the specified {@code store}.
226
  * @param {Action} action - The redux action {@code CONFERENCE_WILL_JOIN} which
220
  * @param {Action} action - The redux action {@code CONFERENCE_WILL_JOIN} which
227
  * is being dispatched in the specified {@code store}.
221
  * is being dispatched in the specified {@code store}.
228
  * @private
222
  * @private
229
- * @returns {*}
223
+ * @returns {*} The value returned by {@code next(action)}.
230
  */
224
  */
231
 function _conferenceWillJoin({ getState }, next, action) {
225
 function _conferenceWillJoin({ getState }, next, action) {
232
     const result = next(action);
226
     const result = next(action);
233
 
227
 
234
     const { conference } = action;
228
     const { conference } = action;
235
     const state = getState();
229
     const state = getState();
230
+    const { callUUID } = state['features/base/config'];
236
     const url = getInviteURL(state);
231
     const url = getInviteURL(state);
237
     const hasVideo = !isVideoMutedByAudioOnly(state);
232
     const hasVideo = !isVideoMutedByAudioOnly(state);
238
-    const { callUUID } = state['features/base/config'];
239
 
233
 
240
-    // When assigning the call UUID, do so in upper case, since iOS will
241
-    // return it upper cased.
234
+    // When assigning the call UUID, do so in upper case, since iOS will return
235
+    // it upper cased.
242
     conference.callUUID = (callUUID || uuid.v4()).toUpperCase();
236
     conference.callUUID = (callUUID || uuid.v4()).toUpperCase();
243
 
237
 
244
     CallKit.startCall(conference.callUUID, url.toString(), hasVideo)
238
     CallKit.startCall(conference.callUUID, url.toString(), hasVideo)
306
 }
300
 }
307
 
301
 
308
 /**
302
 /**
309
- * Notifies the feature jwt that the action {@link SET_AUDIO_MUTED} is being
303
+ * Notifies the feature callkit that the action {@link SET_AUDIO_MUTED} is being
310
  * dispatched within a specific redux {@code store}.
304
  * dispatched within a specific redux {@code store}.
311
  *
305
  *
312
  * @param {Store} store - The redux store in which the specified {@code action}
306
  * @param {Store} store - The redux store in which the specified {@code action}
313
  * is being dispatched.
307
  * is being dispatched.
314
- * @param {Dispatch} next - The redux dispatch function to dispatch the
315
- * specified {@code action} to the specified {@code store}.
308
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
309
+ * specified {@code action} in the specified {@code store}.
316
  * @param {Action} action - The redux action {@code SET_AUDIO_MUTED} which is
310
  * @param {Action} action - The redux action {@code SET_AUDIO_MUTED} which is
317
  * being dispatched in the specified {@code store}.
311
  * being dispatched in the specified {@code store}.
318
  * @private
312
  * @private
319
- * @returns {*}
313
+ * @returns {*} The value returned by {@code next(action)}.
320
  */
314
  */
321
 function _setAudioMuted({ getState }, next, action) {
315
 function _setAudioMuted({ getState }, next, action) {
322
     const result = next(action);
316
     const result = next(action);
331
 }
325
 }
332
 
326
 
333
 /**
327
 /**
334
- * Notifies the feature jwt that the action {@link _SET_CALLKIT_SUBSCRIPTIONS}
335
- * is being dispatched within a specific redux {@code store}.
328
+ * Notifies the feature callkit that the action
329
+ * {@link _SET_CALLKIT_SUBSCRIPTIONS} is being dispatched within a specific
330
+ * redux {@code store}.
336
  *
331
  *
337
  * @param {Store} store - The redux store in which the specified {@code action}
332
  * @param {Store} store - The redux store in which the specified {@code action}
338
  * is being dispatched.
333
  * is being dispatched.
339
- * @param {Dispatch} next - The redux dispatch function to dispatch the
340
- * specified {@code action} to the specified {@code store}.
334
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
335
+ * specified {@code action} in the specified {@code store}.
341
  * @param {Action} action - The redux action {@code _SET_CALLKIT_SUBSCRIPTIONS}
336
  * @param {Action} action - The redux action {@code _SET_CALLKIT_SUBSCRIPTIONS}
342
  * which is being dispatched in the specified {@code store}.
337
  * which is being dispatched in the specified {@code store}.
343
  * @private
338
  * @private
344
- * @returns {*}
339
+ * @returns {*} The value returned by {@code next(action)}.
345
  */
340
  */
346
 function _setCallKitSubscriptions({ getState }, next, action) {
341
 function _setCallKitSubscriptions({ getState }, next, action) {
347
     const { subscriptions } = getState()['features/callkit'];
342
     const { subscriptions } = getState()['features/callkit'];
356
 }
351
 }
357
 
352
 
358
 /**
353
 /**
359
- * Notifies the feature jwt that the action {@link SET_VIDEO_MUTED} is being
354
+ * Notifies the feature callkit that the action {@link SET_VIDEO_MUTED} is being
360
  * dispatched within a specific redux {@code store}.
355
  * dispatched within a specific redux {@code store}.
361
  *
356
  *
362
  * @param {Store} store - The redux store in which the specified {@code action}
357
  * @param {Store} store - The redux store in which the specified {@code action}
363
  * is being dispatched.
358
  * is being dispatched.
364
- * @param {Dispatch} next - The redux dispatch function to dispatch the
365
- * specified {@code action} to the specified {@code store}.
359
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
360
+ * specified {@code action} in the specified {@code store}.
366
  * @param {Action} action - The redux action {@code SET_VIDEO_MUTED} which is
361
  * @param {Action} action - The redux action {@code SET_VIDEO_MUTED} which is
367
  * being dispatched in the specified {@code store}.
362
  * being dispatched in the specified {@code store}.
368
  * @private
363
  * @private
369
- * @returns {*}
364
+ * @returns {*} The value returned by {@code next(action)}.
370
  */
365
  */
371
 function _setVideoMuted({ getState }, next, action) {
366
 function _setVideoMuted({ getState }, next, action) {
372
     const result = next(action);
367
     const result = next(action);
385
 /**
380
 /**
386
  * Handles a track creation failure. This is relevant to us in the following
381
  * Handles a track creation failure. This is relevant to us in the following
387
  * (corner) case: if the user never gave their permission to use the microphone
382
  * (corner) case: if the user never gave their permission to use the microphone
388
- * and try to unmute from the CallKit interface, this will fail, and we need
389
- * to sync back the CallKit button state.
383
+ * and try to unmute from the CallKit interface, this will fail, and we need to
384
+ * sync back the CallKit button state.
390
  *
385
  *
391
  * @param {Store} store - The redux store in which the specified {@code action}
386
  * @param {Store} store - The redux store in which the specified {@code action}
392
  * is being dispatched.
387
  * is being dispatched.
393
- * @param {Dispatch} next - The redux dispatch function to dispatch the
394
- * specified {@code action} to the specified {@code store}.
388
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
389
+ * specified {@code action} in the specified {@code store}.
395
  * @param {Action} action - The redux action {@code TRACK_CREARE_ERROR} which is
390
  * @param {Action} action - The redux action {@code TRACK_CREARE_ERROR} which is
396
  * being dispatched in the specified {@code store}.
391
  * being dispatched in the specified {@code store}.
397
  * @private
392
  * @private
398
- * @returns {*}
393
+ * @returns {*} The value returned by {@code next(action)}.
399
  */
394
  */
400
 function _trackCreateError({ getState }, next, action) {
395
 function _trackCreateError({ getState }, next, action) {
401
     const result = next(action);
396
     const result = next(action);

読み込み中…
キャンセル
保存