react-native-firework-sdk 2.7.0 → 2.7.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,30 +6,30 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64_x86_64-simulator</string>
9
+ <string>ios-arm64</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>FireworkVideoUI.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
- <string>x86_64</string>
16
15
  </array>
17
16
  <key>SupportedPlatform</key>
18
17
  <string>ios</string>
19
- <key>SupportedPlatformVariant</key>
20
- <string>simulator</string>
21
18
  </dict>
22
19
  <dict>
23
20
  <key>LibraryIdentifier</key>
24
- <string>ios-arm64</string>
21
+ <string>ios-arm64_x86_64-simulator</string>
25
22
  <key>LibraryPath</key>
26
23
  <string>FireworkVideoUI.framework</string>
27
24
  <key>SupportedArchitectures</key>
28
25
  <array>
29
26
  <string>arm64</string>
27
+ <string>x86_64</string>
30
28
  </array>
31
29
  <key>SupportedPlatform</key>
32
30
  <string>ios</string>
31
+ <key>SupportedPlatformVariant</key>
32
+ <string>simulator</string>
33
33
  </dict>
34
34
  </array>
35
35
  <key>CFBundlePackageType</key>
@@ -14,7 +14,7 @@
14
14
  </data>
15
15
  <key>Info.plist</key>
16
16
  <data>
17
- xSys4PQnG8lKSIv1Abhys20ti8o=
17
+ sp8HZ2jIRptrAIYXFhCi1ECJ82M=
18
18
  </data>
19
19
  <key>Modules/FireworkVideoUI.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
20
  <data>
@@ -6,7 +6,7 @@ target 'FireworkVideoUI' do
6
6
  use_frameworks!
7
7
 
8
8
  # Pods for FireworkVideoUI
9
- pod 'FireworkVideo', '1.13.0'
9
+ pod 'FireworkVideo', '1.14.0'
10
10
 
11
11
  target 'FireworkVideoUITests' do
12
12
  # Pods for testing
@@ -1,16 +1,16 @@
1
1
  PODS:
2
- - FireworkVideo (1.13.0)
2
+ - FireworkVideo (1.14.0)
3
3
 
4
4
  DEPENDENCIES:
5
- - FireworkVideo (= 1.13.0)
5
+ - FireworkVideo (= 1.14.0)
6
6
 
7
7
  SPEC REPOS:
8
8
  trunk:
9
9
  - FireworkVideo
10
10
 
11
11
  SPEC CHECKSUMS:
12
- FireworkVideo: 97ef1b615991fe967bd3ed6a7380a250fb02f403
12
+ FireworkVideo: c8af446a350e2486e86c0a789ecfd4a57ce6facc
13
13
 
14
- PODFILE CHECKSUM: c22dec34b8972d810f5d4e1c0347d4da880ffd0f
14
+ PODFILE CHECKSUM: 880bd5c72a5a81b620b803189a6ec208e8481116
15
15
 
16
16
  COCOAPODS: 1.12.1
@@ -8,6 +8,20 @@
8
8
  import UIKit
9
9
  import FireworkVideo
10
10
 
11
+ private class RCTRootViewPlaceholder: UIView {
12
+ weak var reactViewController: UIViewController?
13
+ }
14
+
15
+ private struct RCTRootViewResult {
16
+ weak var viewController: UIViewController?
17
+ weak var view: RCTRootView?
18
+ }
19
+
20
+ private struct RCTRootViewPlaceholderResult {
21
+ weak var viewController: UIViewController?
22
+ weak var view: RCTRootViewPlaceholder?
23
+ }
24
+
11
25
  private struct PlayerExitButtonInfo {
12
26
  enum ExitButtonType: Int {
13
27
  case close, floating
@@ -162,8 +176,10 @@ class FWNavigatorModule: RCTEventEmitter {
162
176
  let containerViewController = FWRNPresentContainerViewController()
163
177
  containerViewController.modalPresentationStyle = .fullScreen
164
178
 
165
- guard let window = UIApplication.shared.delegate?.window as? UIWindow,
166
- let rootView = window.rootViewController?.view as? RCTRootView else {
179
+ guard let rootVC = RCTKeyWindow()?.rootViewController,
180
+ let rootViewResult = FWNavigatorModule.findRCTRootViewResult(rootVC),
181
+ let rootViewVC = rootViewResult.viewController,
182
+ let rootView = rootViewResult.view else {
167
183
  resolver(false)
168
184
  return
169
185
  }
@@ -176,10 +192,17 @@ class FWNavigatorModule: RCTEventEmitter {
176
192
  containerViewController.addChild(detachedController)
177
193
  detachedController.didMove(toParent: containerViewController)
178
194
  }
195
+
179
196
  rootView.removeFromSuperview()
180
- window.rootViewController?.view = UIView()
197
+ let placeholderView = RCTRootViewPlaceholder()
198
+ rootViewVC.view = placeholderView
181
199
  containerViewController.rootView = rootView
182
200
  presentedVC.present(containerViewController, animated: true) {
201
+ if rootView.reactViewController() != containerViewController {
202
+ // Save previous reactViewController
203
+ placeholderView.reactViewController = rootView.reactViewController()
204
+ rootView.setReactViewController(containerViewController)
205
+ }
183
206
  resolver(true)
184
207
  }
185
208
  }
@@ -191,22 +214,30 @@ class FWNavigatorModule: RCTEventEmitter {
191
214
  if let containerVC = RCTPresentedViewController() as? FWRNPresentContainerViewController,
192
215
  let rootView = containerVC.rootView,
193
216
  containerVC.presentingViewController != nil {
194
- guard let window = UIApplication.shared.delegate?.window as? UIWindow,
195
- let rootViewController = window.rootViewController else {
217
+ guard let rootVC = RCTKeyWindow()?.rootViewController,
218
+ let rootViewPlaceholderResult = FWNavigatorModule.findRCTRootViewPlaceholderResult(rootVC),
219
+ let rootViewPlaceholderVC = rootViewPlaceholderResult.viewController,
220
+ let rootViewPlaceholder = rootViewPlaceholderResult.view else {
196
221
  resolver(false)
197
222
  return
198
223
  }
224
+
199
225
  let childViewControllers = rootView.reactViewController()?.children
200
226
  containerVC.dismiss(animated: true) {
201
227
  childViewControllers?.forEach { (childViewController) in
202
228
  let detachedController = childViewController
203
229
  detachedController.willMove(toParent: nil)
204
230
  detachedController.removeFromParent()
205
- rootViewController.addChild(detachedController)
206
- detachedController.didMove(toParent: rootViewController)
231
+ rootViewPlaceholderVC.addChild(detachedController)
232
+ detachedController.didMove(toParent: rootViewPlaceholderVC)
207
233
  }
208
234
  rootView.removeFromSuperview()
209
- rootViewController.view = rootView
235
+ rootViewPlaceholderVC.view = rootView
236
+
237
+ if let reactViewController = rootViewPlaceholder.reactViewController {
238
+ // Restore previous reactViewController
239
+ rootView.setReactViewController(reactViewController)
240
+ }
210
241
  resolver(true)
211
242
  }
212
243
  } else {
@@ -272,6 +303,36 @@ extension FWNavigatorModule {
272
303
 
273
304
  return isIOSSDKViewController(controller.parent)
274
305
  }
306
+
307
+ private static func findRCTRootViewResult(_ viewController: UIViewController) -> RCTRootViewResult? {
308
+ if let rootView = viewController.view as? RCTRootView {
309
+ return RCTRootViewResult(viewController: viewController, view: rootView)
310
+ }
311
+
312
+ for childVC in viewController.children {
313
+ if let result = findRCTRootViewResult(childVC) {
314
+ return result
315
+ }
316
+ }
317
+
318
+ return nil
319
+ }
320
+
321
+ private static func findRCTRootViewPlaceholderResult(
322
+ _ viewController: UIViewController
323
+ ) -> RCTRootViewPlaceholderResult? {
324
+ if let rootViewPlaceholder = viewController.view as? RCTRootViewPlaceholder {
325
+ return RCTRootViewPlaceholderResult(viewController: viewController, view: rootViewPlaceholder)
326
+ }
327
+
328
+ for childVC in viewController.children {
329
+ if let result = findRCTRootViewPlaceholderResult(childVC) {
330
+ return result
331
+ }
332
+ }
333
+
334
+ return nil
335
+ }
275
336
  }
276
337
 
277
338
  extension FWNavigatorModule {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-firework-sdk",
3
- "version": "2.7.0",
3
+ "version": "2.7.2-beta.1",
4
4
  "description": "Firework React Native SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -35,5 +35,5 @@ fi
35
35
 
36
36
  s.static_framework = true
37
37
  s.dependency 'React-Core'
38
- s.dependency 'FireworkVideo', '1.13.0'
38
+ s.dependency 'FireworkVideo', '1.14.0'
39
39
  end