@applicaster/quick-brick-native-apple 6.2.2 → 6.2.4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "QuickBrickApple",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
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.2"
19
+ "tag": "@@applicaster/quick-brick-native-apple/6.2.4"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -85,6 +85,8 @@ enum Events: String {
85
85
  func setPrefersHomeIndicatorAutoHidden(_ payload: [String: Any])
86
86
 
87
87
  func forceAppReload()
88
+
89
+ func forceAppReloadLanguageSwitch()
88
90
  }
89
91
 
90
92
  @objc(QuickBrickCommunicationModule)
@@ -169,7 +171,7 @@ class ReactNativeCommunicationModule: NSObject, RCTBridgeModule {
169
171
  ReactNativeCommunicationModuleError.unableToSaveToLocalStorage, nil)
170
172
  }
171
173
 
172
- delegateManager.forceAppReload()
174
+ delegateManager.forceAppReloadLanguageSwitch()
173
175
  }
174
176
  }
175
177
  }
@@ -223,4 +223,8 @@ extension ReactNativeManager: QuickBrickManagerDelegate {
223
223
  public func forceAppReload() {
224
224
  EventsBus.post(EventsBus.Event(type: EventsBusType(.forceAppReload)))
225
225
  }
226
+
227
+ public func forceAppReloadLanguageSwitch() {
228
+ EventsBus.post(EventsBus.Event(type: EventsBusType(.forceAppReloadLanguageSwitch)))
229
+ }
226
230
  }
@@ -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
@@ -0,0 +1,68 @@
1
+ //
2
+ // TrackedComponentView.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.2",
3
+ "version": "6.2.4",
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"