@applicaster/quick-brick-native-apple 6.9.7 → 6.9.8-patch.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.
- package/apple/QuickBrickApple.podspec.json +2 -2
- package/apple/tvos/Views/FocusableGroupView/FocusableGroupView.swift +3 -0
- package/apple/tvos/Views/FocusableView/FocusableView.swift +3 -0
- package/apple/universal/ReactNative/ReactNativeModulesExports.m +2 -1
- package/apple/universal/Views/TrackedView.swift +27 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "QuickBrickApple",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.8",
|
|
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.9.
|
|
19
|
+
"tag": "@@applicaster/quick-brick-native-apple/6.9.8"
|
|
20
20
|
},
|
|
21
21
|
"requires_arc": true,
|
|
22
22
|
"source_files": "universal/**/*.{m,swift}",
|
|
@@ -150,6 +150,9 @@ public class FocusableView: ParallaxView {
|
|
|
150
150
|
Task {
|
|
151
151
|
await FocusableGroupManager.shared.unregisterItem(withId: itemId, inGroup: groupId)
|
|
152
152
|
}
|
|
153
|
+
|
|
154
|
+
cancellables.forEach { $0.cancel() }
|
|
155
|
+
cancellables.removeAll()
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
private func addFocusGuideIfNeeded(tag: NSNumber?,
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
@interface RCT_EXTERN_MODULE (TrackedView, RCTViewManager)
|
|
14
14
|
|
|
15
15
|
RCT_EXPORT_VIEW_PROPERTY(groupId, NSString);
|
|
16
|
-
RCT_EXPORT_VIEW_PROPERTY(onPositionUpdated,
|
|
16
|
+
RCT_EXPORT_VIEW_PROPERTY(onPositionUpdated, RCTDirectEventBlock);
|
|
17
|
+
RCT_EXPORT_VIEW_PROPERTY(clipThreshold, NSNumber);
|
|
17
18
|
|
|
18
19
|
@end
|
|
19
20
|
|
|
@@ -9,17 +9,33 @@ import Foundation
|
|
|
9
9
|
import React
|
|
10
10
|
|
|
11
11
|
public class TrackedComponentView: RCTView {
|
|
12
|
-
@objc public var onPositionUpdated:
|
|
12
|
+
@objc public var onPositionUpdated: RCTDirectEventBlock?
|
|
13
|
+
@objc public var clipThreshold: NSNumber = 0
|
|
13
14
|
|
|
14
15
|
/// Convert the view frame to the window's coordinate system
|
|
15
16
|
private func getViewFrameInWindow() -> CGRect {
|
|
16
17
|
convert(bounds, to: window)
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
// Check if the view is completely within the window's bounds
|
|
20
|
+
// Check if the view is completely within the window's bounds with a threshold
|
|
20
21
|
private var isCompletelyVisibleOnScreen: Bool {
|
|
21
22
|
guard let window else { return false }
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
guard clipThreshold.intValue > 0 else {
|
|
25
|
+
return window.bounds.contains(getViewFrameInWindow())
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let fullRect = getViewFrameInWindow()
|
|
29
|
+
let visibleRect = fullRect.intersection(window.bounds)
|
|
30
|
+
|
|
31
|
+
guard !visibleRect.isNull else { return false }
|
|
32
|
+
|
|
33
|
+
let threshold = CGFloat(truncating: clipThreshold)
|
|
34
|
+
|
|
35
|
+
let clippedWidth = fullRect.width - visibleRect.width
|
|
36
|
+
let clippedHeight = fullRect.height - visibleRect.height
|
|
37
|
+
|
|
38
|
+
return clippedWidth <= threshold && clippedHeight <= threshold
|
|
23
39
|
}
|
|
24
40
|
|
|
25
41
|
deinit {
|
|
@@ -46,8 +62,7 @@ public class TrackedComponentView: RCTView {
|
|
|
46
62
|
}
|
|
47
63
|
|
|
48
64
|
func startObserver() {
|
|
49
|
-
timer = Timer
|
|
50
|
-
repeats: true) { [weak self] _ in
|
|
65
|
+
timer = Timer(timeInterval: 1.0, repeats: true) { [weak self] _ in
|
|
51
66
|
guard let self else { return }
|
|
52
67
|
let viewFrameInWindow = getViewFrameInWindow()
|
|
53
68
|
|
|
@@ -59,6 +74,13 @@ public class TrackedComponentView: RCTView {
|
|
|
59
74
|
nil)
|
|
60
75
|
}
|
|
61
76
|
}
|
|
77
|
+
|
|
78
|
+
// Known limitation using timers is that they won’t fire when the user is interacting with your app.
|
|
79
|
+
// To avoid this we could manually add timer to the run loop in .common mode
|
|
80
|
+
// See this article: https://www.hackingwithswift.com/articles/117/the-ultimate-guide-to-timer#Working%20with%20runloops
|
|
81
|
+
if let timer {
|
|
82
|
+
RunLoop.current.add(timer, forMode: .common)
|
|
83
|
+
}
|
|
62
84
|
}
|
|
63
85
|
|
|
64
86
|
func stopObserver() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-native-apple",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.8-patch.1",
|
|
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"
|