@applicaster/quick-brick-native-apple 6.14.1 → 6.14.3

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.14.1",
3
+ "version": "6.14.3",
4
4
  "platforms": {
5
5
  "ios": "16.0",
6
6
  "tvos": "16.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.14.1"
19
+ "tag": "@@applicaster/quick-brick-native-apple/6.14.3"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -154,7 +154,7 @@ public class FocusableGroupView: RCTTVView {
154
154
 
155
155
  params[GroupViewUpdateEvents.previouslyFocusedItem] = dataForFocusItem(focusItem: context.previouslyFocusedView)
156
156
  params[GroupViewUpdateEvents.nextFocusedItem] = dataForFocusItem(focusItem: context.nextFocusedView)
157
- params[GroupViewUpdateEvents.preferredFocusEnvironment] = dataForFocusItem(focusItem: customPreferredFocusEnvironment?.first)
157
+ params[GroupViewUpdateEvents.preferredFocusEnvironment] = dataForFocusItem(focusItem: preferredFocusEnvironments.first)
158
158
  params[GroupViewUpdateEvents.groupId] = groupId
159
159
  params[GroupViewUpdateEvents.isActive] = isActive
160
160
  params[GroupViewUpdateEvents.isFocusDisabled] = isFocusDisabled
@@ -179,12 +179,16 @@ public class FocusableGroupView: RCTTVView {
179
179
  /// - Returns: dictionary instance in case data exists, otherwise nil
180
180
  private func dataForFocusItem(focusItem: Any?) -> [String: Any]? {
181
181
  var retVal = [String: Any]()
182
- if let focusedView = focusItem as? RCTTVView {
182
+ if let focusedView = focusItem as? FocusableView {
183
183
  retVal[FocusItemDataKeys.describingView] = String(describing: focusedView)
184
184
  if let reactTag = focusedView.reactTag?.stringValue {
185
185
  retVal[FocusItemDataKeys.reactTag] = reactTag
186
186
  }
187
187
  retVal[FocusItemDataKeys.isDescendant] = focusedView.isDescendant(of: self)
188
+ retVal[FocusItemDataKeys.itemId] = focusedView.itemId ?? "NO_ID"
189
+ retVal[FocusItemDataKeys.groupId] = focusedView.groupId ?? "NO_GROUP"
190
+ retVal[FocusItemDataKeys.preferredFocus] = focusedView.preferredFocus
191
+ retVal[FocusItemDataKeys.forceFocus] = focusedView.forceFocus
188
192
  }
189
193
  return retVal.keys.count == 0 ? nil : retVal
190
194
  }
@@ -249,49 +253,9 @@ public class FocusableGroupView: RCTTVView {
249
253
  isFocusDisabled == false
250
254
  }
251
255
 
252
- // This was added because on fast scroll preferred focus was not called,
253
- // that cause to select wrong item. On future must be removed if resolved
254
- private func needsFocusUpdateDueToWrongFocus(context: UIFocusUpdateContext,
255
- with coordinator: UIFocusAnimationCoordinator) -> Bool {
256
- guard
257
- let preferredFocusedItem = preferredFocusEnvironments.first as? FocusableView,
258
- let nextFocusedItem = context.nextFocusedItem as? FocusableView,
259
- let previouslyFocusedItem = context.previouslyFocusedItem as? FocusableView else { return false }
260
-
261
- let previousFocusedItemNotFromSameGroup = previouslyFocusedItem.groupId != nextFocusedItem.groupId
262
- let nextFocusedBelongsToCurrentGroup = nextFocusedItem.groupId == itemId
263
- let nextFocusItemNotPreferredFocusedItem = nextFocusedItem.itemId != preferredFocusedItem.itemId
264
-
265
- guard previousFocusedItemNotFromSameGroup,
266
- nextFocusedBelongsToCurrentGroup,
267
- nextFocusItemNotPreferredFocusedItem else {
268
- return false
269
- }
270
-
271
- coordinator.addCoordinatedAnimations({
272
- let duration: TimeInterval = UIView.inheritedAnimationDuration
273
- UIView.animate(withDuration: duration,
274
- delay: 0.0,
275
- options: [],
276
- animations: {
277
- self.setNeedsFocusUpdate()
278
- DispatchQueue.main.async {
279
- self.updateFocusIfNeeded()
280
- }
281
- }, completion: nil)
282
- }, completion: nil)
283
-
284
- return true
285
- }
286
-
287
- override public func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
256
+ override public func didUpdateFocus(in context: UIFocusUpdateContext, with _: UIFocusAnimationCoordinator) {
288
257
  guard isFocusDisabled == false else { return }
289
258
 
290
- guard needsFocusUpdateDueToWrongFocus(context: context,
291
- with: coordinator) == false else {
292
- return
293
- }
294
-
295
259
  if isPreferredFocusDisabled == false {
296
260
  updatePreferredFocusView(nextFocusItem: context.nextFocusedItem)
297
261
  }
@@ -35,4 +35,8 @@ public enum FocusItemDataKeys {
35
35
  static let describingView = "describingView"
36
36
  static let reactTag = "reactTag"
37
37
  static let isDescendant = "isDescendant"
38
+ static let groupId = "groupId"
39
+ static let itemId = "itemId"
40
+ static let preferredFocus = "preferredFocus"
41
+ static let forceFocus = "forceFocus"
38
42
  }
@@ -40,6 +40,8 @@ extension FocusableView: ParallaxViewDelegate {
40
40
  var retVal: [String: Any] = [:]
41
41
  retVal["tag"] = reactTag
42
42
  retVal["itemID"] = itemId
43
+ retVal["groupId"] = groupId
44
+ retVal["preferred"] = preferredFocus
43
45
  return retVal
44
46
  }
45
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-native-apple",
3
- "version": "6.14.1",
3
+ "version": "6.14.3",
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"