@applicaster/quick-brick-native-apple 6.2.3 → 6.2.5

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.
Files changed (24) hide show
  1. package/apple/QuickBrickApple.podspec.json +2 -2
  2. package/apple/ios/Extensions/ReactNativeOrientation+Extensions.swift +18 -18
  3. package/apple/ios/Extensions/UIInterfaceOrientationMask+ReactNative.swift +9 -9
  4. package/apple/ios/LocalNotifications/ReactNativeManager+UNUserNotificationCenterDelegate.swift +2 -4
  5. package/apple/ios/ReactNative/ReactNativeManageriOS+UIApplicationDelegate.swift +2 -3
  6. package/apple/tvos/LocalNotifications/ReactNativeManager+UNUserNotificationCenterDelegate.swift +1 -2
  7. package/apple/tvos/Views/FocusableGroupView/FocusableGroupView.swift +8 -9
  8. package/apple/tvos/Views/FocusableView/FocusableView.swift +1 -1
  9. package/apple/tvos/Views/ParallaxView/Extensions/ParallaxableView+Extensions.swift +1 -2
  10. package/apple/tvos/Views/ParallaxView/Extensions/UIView+ParallaxEffect.swift +4 -6
  11. package/apple/tvos/Views/ParallaxView/Other/ParallaxEffectOptions.swift +1 -1
  12. package/apple/tvos/Views/ParallaxView/Other/SubviewsParallaxMode.swift +1 -1
  13. package/apple/tvos/Views/ParallaxView/ParallaxCollectionViewCell.swift +1 -1
  14. package/apple/tvos/Views/ParallaxView/ParallaxView.swift +2 -2
  15. package/apple/universal/ReactNative/AirplayButton/AirPlayButtonModule.swift +1 -1
  16. package/apple/universal/ReactNative/AppLoaderBridge.swift +1 -1
  17. package/apple/universal/ReactNative/LocalNotification/LocalNotificationBridge.swift +1 -1
  18. package/apple/universal/ReactNative/PluginsManagerBridge.swift +1 -1
  19. package/apple/universal/ReactNative/ReactNativeManager+UIApplicationDelegate.swift +2 -3
  20. package/apple/universal/ReactNative/ReactNativeModulesExports.m +7 -0
  21. package/apple/universal/Storages/SessionStorage/SessionStorageBridge.swift +1 -1
  22. package/apple/universal/Views/TrackedView.swift +68 -0
  23. package/apple/universal/Views/TrackedViewModule.swift +25 -0
  24. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "QuickBrickApple",
3
- "version": "6.2.3",
3
+ "version": "6.2.5",
4
4
  "platforms": {
5
5
  "ios": "14.0",
6
6
  "tvos": "14.0"
@@ -16,7 +16,7 @@
16
16
  "authors": "Applicaster LTD.",
17
17
  "source": {
18
18
  "git": "https://github.com/applicaster/Zapp-Frameworks.git",
19
- "tag": "@@applicaster/quick-brick-native-apple/6.2.3"
19
+ "tag": "@@applicaster/quick-brick-native-apple/6.2.5"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -12,51 +12,51 @@ public extension ReactNativeOrientation {
12
12
  static func fromInterfaceOrientation(orientation: UIInterfaceOrientation) -> ReactNativeOrientation {
13
13
  switch orientation {
14
14
  case .portrait:
15
- return .portrait
15
+ .portrait
16
16
  case .landscapeLeft:
17
- return .landscapeLeft
17
+ .landscapeLeft
18
18
  case .landscapeRight:
19
- return .landscapeRight
19
+ .landscapeRight
20
20
  case .portraitUpsideDown:
21
- return .portraitUpsideDown
21
+ .portraitUpsideDown
22
22
  default:
23
- return .unknown
23
+ .unknown
24
24
  }
25
25
  }
26
26
 
27
27
  static func fromDeviceOrientation(orientation: UIDeviceOrientation) -> ReactNativeOrientation {
28
28
  switch orientation {
29
29
  case .portrait:
30
- return .portrait
30
+ .portrait
31
31
  case .landscapeLeft:
32
- return .landscapeRight
32
+ .landscapeRight
33
33
  case .landscapeRight:
34
- return .landscapeLeft
34
+ .landscapeLeft
35
35
  case .portraitUpsideDown:
36
- return .portraitUpsideDown
36
+ .portraitUpsideDown
37
37
  default:
38
- return .unknown
38
+ .unknown
39
39
  }
40
40
  }
41
41
 
42
42
  func toInterfaceOrientationMask() -> UIInterfaceOrientationMask {
43
43
  switch self {
44
44
  case .portrait:
45
- return .portrait
45
+ .portrait
46
46
  case .landscapeLeft:
47
- return .landscapeLeft
47
+ .landscapeLeft
48
48
  case .landscapeRight:
49
- return .landscapeRight
49
+ .landscapeRight
50
50
  case .landscape:
51
- return .landscape
51
+ .landscape
52
52
  case .portraitUpsideDown:
53
- return .portraitUpsideDown
53
+ .portraitUpsideDown
54
54
  case .all:
55
- return .all
55
+ .all
56
56
  case .allButUpsideDown:
57
- return .allButUpsideDown
57
+ .allButUpsideDown
58
58
  default:
59
- return .portrait
59
+ .portrait
60
60
  }
61
61
  }
62
62
  }
@@ -11,23 +11,23 @@ extension UIInterfaceOrientationMask {
11
11
  func toString() -> String {
12
12
  switch self {
13
13
  case .portrait:
14
- return "portrait"
14
+ "portrait"
15
15
  case .landscapeRight:
16
- return "landscapeRight"
16
+ "landscapeRight"
17
17
  case .landscapeLeft:
18
- return "landscapeLeft"
18
+ "landscapeLeft"
19
19
  case .landscape:
20
- return "landscape"
20
+ "landscape"
21
21
  case .portraitUpsideDown:
22
- return "portraitUpsideDown"
22
+ "portraitUpsideDown"
23
23
  case .portrait:
24
- return "portrait"
24
+ "portrait"
25
25
  case .all:
26
- return "all"
26
+ "all"
27
27
  case .allButUpsideDown:
28
- return "allButUpsideDown"
28
+ "allButUpsideDown"
29
29
  default:
30
- return "all"
30
+ "all"
31
31
  }
32
32
  }
33
33
  }
@@ -12,15 +12,13 @@ import ZappCore
12
12
  extension ReactNativeManager: UNUserNotificationCenterDelegate {
13
13
  public func userNotificationCenter(_: UNUserNotificationCenter,
14
14
  willPresent _: UNNotification,
15
- withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
16
- {
15
+ withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
17
16
  completionHandler([.alert, .sound])
18
17
  }
19
18
 
20
19
  public func userNotificationCenter(_: UNUserNotificationCenter,
21
20
  didReceive response: UNNotificationResponse,
22
- withCompletionHandler completionHandler: @escaping () -> Void)
23
- {
21
+ withCompletionHandler completionHandler: @escaping () -> Void) {
24
22
  guard let url = LocalNotificationResponseParser.urlFromLocalNotification(response: response) else {
25
23
  completionHandler()
26
24
  return
@@ -1,5 +1,5 @@
1
1
  //
2
- // ReactNativeManager+UserInterfaceLayerApplicationDelegate.swift
2
+ // ReactNativeManageriOS+UIApplicationDelegate.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Anton Kononenko on 12/24/19.
@@ -26,8 +26,7 @@ public extension ReactNativeManager {
26
26
 
27
27
  func application(_: UIApplication,
28
28
  didReceiveRemoteNotification userInfo: [AnyHashable: Any],
29
- fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)
30
- {
29
+ fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
31
30
  let userInfo = userInfo
32
31
  if let urlString = getLink(userInfo: userInfo),
33
32
  let url = URL(string: urlString) {
@@ -12,8 +12,7 @@ import ZappCore
12
12
  extension ReactNativeManager: UNUserNotificationCenterDelegate {
13
13
  public func userNotificationCenter(_: UNUserNotificationCenter,
14
14
  willPresent _: UNNotification,
15
- withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
16
- {
15
+ withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
17
16
  completionHandler([.alert, .sound])
18
17
  }
19
18
  }
@@ -61,8 +61,7 @@ public class FocusableGroupView: RCTTVView {
61
61
  rootView = superView
62
62
  if let superFocusGroup = rootView as? FocusableGroupView {
63
63
  if let newFocusData = customPrefferedFocusEnvironment as? [FocusableView],
64
- let superFocusGroupFocusEnvironment = superFocusGroup.customPrefferedFocusEnvironment as? [FocusableView]
65
- {
64
+ let superFocusGroupFocusEnvironment = superFocusGroup.customPrefferedFocusEnvironment as? [FocusableView] {
66
65
  let groupIdsToStay = newFocusData.map(\.groupId)
67
66
  let filteredGroups = superFocusGroupFocusEnvironment.filter { !groupIdsToStay.contains($0.groupId) }
68
67
  superFocusGroup.customPrefferedFocusEnvironment = filteredGroups + newFocusData
@@ -287,19 +286,19 @@ public class FocusableGroupView: RCTTVView {
287
286
  func focusHeadingToString(focusHeading: UIFocusHeading) -> String {
288
287
  switch focusHeading {
289
288
  case UIFocusHeading.up:
290
- return FocusHeadingTextValues.up
289
+ FocusHeadingTextValues.up
291
290
  case UIFocusHeading.down:
292
- return FocusHeadingTextValues.down
291
+ FocusHeadingTextValues.down
293
292
  case UIFocusHeading.left:
294
- return FocusHeadingTextValues.left
293
+ FocusHeadingTextValues.left
295
294
  case UIFocusHeading.right:
296
- return FocusHeadingTextValues.right
295
+ FocusHeadingTextValues.right
297
296
  case UIFocusHeading.next:
298
- return FocusHeadingTextValues.next
297
+ FocusHeadingTextValues.next
299
298
  case UIFocusHeading.previous:
300
- return FocusHeadingTextValues.previous
299
+ FocusHeadingTextValues.previous
301
300
  default:
302
- return FocusHeadingTextValues.manualUpdate
301
+ FocusHeadingTextValues.manualUpdate
303
302
  }
304
303
  }
305
304
 
@@ -1,5 +1,5 @@
1
1
  //
2
- // FocusableChildView.swift
2
+ // FocusableView.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Anton Kononenko on 4/17/19.
@@ -113,8 +113,7 @@ public extension ParallaxableView where Self: UIView {
113
113
  func getGlowImageView() -> UIImageView? {
114
114
  parallaxEffectOptions.glowContainerView?.subviews.filter { view -> Bool in
115
115
  if let glowImageView = view as? UIImageView,
116
- let glowImage = glowImageView.image, glowImage.accessibilityIdentifier == glowImageAccessibilityIdentifier
117
- {
116
+ let glowImage = glowImageView.image, glowImage.accessibilityIdentifier == glowImageAccessibilityIdentifier {
118
117
  return true
119
118
  }
120
119
  return false
@@ -90,15 +90,13 @@ extension UIView: AnyParallaxableView {
90
90
  subviews.filter { $0 !== options.glowContainerView }
91
91
  .enumerated()
92
92
  .forEach { (index: Int, subview: UIView) in
93
- let relativePanValue: Double
94
-
95
- switch options.subviewsParallaxMode {
93
+ let relativePanValue: Double = switch options.subviewsParallaxMode {
96
94
  case let .basedOnHierarchyInParallaxView(maxOffset, multipler):
97
- relativePanValue = maxOffset / Double(index + 1) * (multipler ?? 1.0)
95
+ maxOffset / Double(index + 1) * (multipler ?? 1.0)
98
96
  case .basedOnTag:
99
- relativePanValue = Double(subview.tag)
97
+ Double(subview.tag)
100
98
  default:
101
- relativePanValue = 0.0
99
+ 0.0
102
100
  }
103
101
 
104
102
  let verticalSubviewEffect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis)
@@ -42,7 +42,7 @@ public struct ParallaxEffectOptions {
42
42
  }
43
43
  }
44
44
 
45
- internal let glowImageAccessibilityIdentifier = "com.applicaster"
45
+ let glowImageAccessibilityIdentifier = "com.applicaster"
46
46
 
47
47
  extension ParallaxEffectOptions {
48
48
  static func defaultGlowImageView() -> UIImageView {
@@ -1,5 +1,5 @@
1
1
  //
2
- // SubviewsParallaxType.swift
2
+ // SubviewsParallaxMode.swift
3
3
  //
4
4
  // Created by Łukasz Śliwiński on 10/05/16.
5
5
  // Copyright © 2016 Łukasz Śliwiński. All rights reserved.
@@ -29,7 +29,7 @@ open class ParallaxCollectionViewCell: UICollectionViewCell, ParallaxableView {
29
29
  parallaxViewActions.setupUnfocusedState?(self)
30
30
  }
31
31
 
32
- internal func commonInit() {
32
+ func commonInit() {
33
33
  layer.shadowOpacity = 0.0
34
34
  layer.shadowColor = UIColor.black.cgColor
35
35
  layer.shadowOpacity = 0.35
@@ -1,5 +1,5 @@
1
1
  //
2
- // ParallaxCollectionViewCell.swift
2
+ // ParallaxView.swift
3
3
  //
4
4
  // Created by Łukasz Śliwiński on 20/04/16.
5
5
  // Copyright © 2016 Łukasz Śliwiński. All rights reserved.
@@ -33,7 +33,7 @@ open class ParallaxView: RCTView, ParallaxableView {
33
33
  parallaxViewActions.setupUnfocusedState?(self)
34
34
  }
35
35
 
36
- internal func commonInit() {
36
+ func commonInit() {
37
37
  if parallaxEffectOptions.glowContainerView == nil {
38
38
  let view = UIView(frame: bounds)
39
39
  addSubview(view)
@@ -1,5 +1,5 @@
1
1
  //
2
- // RCTMyCustomViewManager.swift
2
+ // AirPlayButtonModule.swift
3
3
  // DefaultPlayer
4
4
  //
5
5
  // Created by Anna Bauza on 22/06/2020.
@@ -1,5 +1,5 @@
1
1
  //
2
- // AnalyticsBridge.swift
2
+ // AppLoaderBridge.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Avi Levin on 09/5/2022.
@@ -1,5 +1,5 @@
1
1
  //
2
- // PluginsManager.swift
2
+ // LocalNotificationBridge.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Anton Kononenko on 1/27/20.
@@ -1,5 +1,5 @@
1
1
  //
2
- // PluginsManager.swift
2
+ // PluginsManagerBridge.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Anton Kononenko on 1/27/20.
@@ -1,5 +1,5 @@
1
1
  //
2
- // ReactNativeManager+UserInterfaceLayerApplicationDelegate.swift
2
+ // ReactNativeManager+UIApplicationDelegate.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Anton Kononenko on 12/24/19.
@@ -20,8 +20,7 @@ extension ReactNativeManager: UIApplicationDelegate {
20
20
 
21
21
  public func application(_ application: UIApplication,
22
22
  continue userActivity: NSUserActivity,
23
- restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool
24
- {
23
+ restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
25
24
  RCTLinkingManager.application(application,
26
25
  continue: userActivity,
27
26
  restorationHandler: restorationHandler)
@@ -10,6 +10,13 @@
10
10
  #import <AVFoundation/AVFoundation.h>
11
11
  #import <React/RCTViewManager.h>
12
12
 
13
+ @interface RCT_EXTERN_MODULE (TrackedView, RCTViewManager)
14
+
15
+ RCT_EXPORT_VIEW_PROPERTY(groupId, NSString);
16
+ RCT_EXPORT_VIEW_PROPERTY(onPositionUpdated, RCTBubblingEventBlock);
17
+
18
+ @end
19
+
13
20
  @interface RCT_EXTERN_MODULE (QuickBrickCommunicationModule, NSObject)
14
21
 
15
22
  RCT_EXTERN_METHOD(quickBrickEvent:(NSString *)eventName
@@ -1,5 +1,5 @@
1
1
  //
2
- // ZappSessionStorageBridge.swift
2
+ // SessionStorageBridge.swift
3
3
  // QuickBrickApple
4
4
  //
5
5
  // Created by Anton Kononenko on 5/9/19.
@@ -0,0 +1,68 @@
1
+ //
2
+ // TrackedView.swift
3
+ // AccordionSwift
4
+ //
5
+ // Created by Anton Kononenko on 9/1/23.
6
+ //
7
+
8
+ import Foundation
9
+ import React
10
+
11
+ public class TrackedComponentView: RCTView {
12
+ @objc public var onPositionUpdated: RCTBubblingEventBlock?
13
+
14
+ /// Convert the view frame to the window's coordinate system
15
+ private func getViewFrameInWindow() -> CGRect {
16
+ convert(bounds, to: window)
17
+ }
18
+
19
+ // Check if the view is completely within the window's bounds
20
+ private var isCompletelyVisibleOnScreen: Bool {
21
+ guard let window else { return false }
22
+ return window.bounds.contains(getViewFrameInWindow())
23
+ }
24
+
25
+ deinit {
26
+ stopObserver()
27
+ }
28
+
29
+ override public init(frame: CGRect) {
30
+ super.init(frame: frame)
31
+ startObserver()
32
+ }
33
+
34
+ @available(*, unavailable)
35
+ required init?(coder _: NSCoder) {
36
+ fatalError("init(coder:) has not been implemented")
37
+ }
38
+
39
+ var previousState: CGRect?
40
+ var timer: Timer?
41
+ func createReactEvent(rect: CGRect) -> [String: CGFloat] {
42
+ ["left": rect.minX,
43
+ "right": rect.maxX,
44
+ "top": rect.minY,
45
+ "bottom": rect.maxY]
46
+ }
47
+
48
+ func startObserver() {
49
+ timer = Timer.scheduledTimer(withTimeInterval: 1.0,
50
+ repeats: true) { [weak self] _ in
51
+ guard let self else { return }
52
+ let viewFrameInWindow = getViewFrameInWindow()
53
+
54
+ if previousState != viewFrameInWindow {
55
+ previousState = viewFrameInWindow
56
+
57
+ onPositionUpdated?(isCompletelyVisibleOnScreen ?
58
+ ["rect": createReactEvent(rect: viewFrameInWindow)] :
59
+ nil)
60
+ }
61
+ }
62
+ }
63
+
64
+ func stopObserver() {
65
+ timer?.invalidate()
66
+ timer = nil
67
+ }
68
+ }
@@ -0,0 +1,25 @@
1
+ //
2
+ // TrackedViewModule.swift
3
+ // QuickBrickApple
4
+ //
5
+ // Created by Anton Kononenko on 9/1/23.
6
+ //
7
+
8
+ import AVFoundation
9
+ import Foundation
10
+ import React
11
+
12
+ @objc(TrackedView)
13
+ public class TrackedView: RCTViewManager {
14
+ override public static func moduleName() -> String? {
15
+ "TrackedView"
16
+ }
17
+
18
+ override public static func requiresMainQueueSetup() -> Bool {
19
+ true
20
+ }
21
+
22
+ override public func view() -> UIView! {
23
+ TrackedComponentView()
24
+ }
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-native-apple",
3
- "version": "6.2.3",
3
+ "version": "6.2.5",
4
4
  "description": "iOS and tvOS native code for QuickBrick applications. This package is used to provide native logic for QuickBrick",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"