@applicaster/quick-brick-native-apple 6.14.2 → 6.14.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.14.2",
3
+ "version": "6.14.4",
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.2"
19
+ "tag": "@@applicaster/quick-brick-native-apple/6.14.4"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -12,9 +12,15 @@ import XrayLogger
12
12
  import ZappCore
13
13
 
14
14
  class QuickBrickExceptionManagerDelegate: NSObject, RCTExceptionsManagerDelegate {
15
- public lazy var logger = Logger.getLogger(for: ReactNativeManagerLogs.subsystem)
15
+ public lazy var logger = Logger.getLogger(for: ReactNativeManagerLogs.subsystemExceptions)
16
16
 
17
- func handleSoftJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber, extraDataAsJSON _: String?) {
17
+ enum Params {
18
+ static let message = "message"
19
+ static let extraInfoRawStack = "extraInfo.rawStack"
20
+ static let exceptionId = "exceptionId"
21
+ }
22
+
23
+ func handleSoftJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber, extraDataAsJSON: String?) {
18
24
  guard let message,
19
25
  let stack
20
26
  else {
@@ -30,13 +36,13 @@ class QuickBrickExceptionManagerDelegate: NSObject, RCTExceptionsManagerDelegate
30
36
  logger?.errorLog(message: ReactNativeManagerLogs.handleSoftJSException.message,
31
37
  category: ReactNativeManagerLogs.handleSoftJSException.category,
32
38
  data: [
33
- "message": message,
34
- "stack": stack,
35
- "exceptionId": "\(exceptionId)",
39
+ Params.message: message,
40
+ Params.extraInfoRawStack: extraDataAsJSON ?? "",
41
+ Params.exceptionId: "\(exceptionId)",
36
42
  ])
37
43
  }
38
44
 
39
- func handleFatalJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber, extraDataAsJSON _: String?) {
45
+ func handleFatalJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber, extraDataAsJSON: String?) {
40
46
  guard let message,
41
47
  let stack
42
48
  else {
@@ -49,12 +55,43 @@ class QuickBrickExceptionManagerDelegate: NSObject, RCTExceptionsManagerDelegate
49
55
  type: .error,
50
56
  message, stack)
51
57
 
58
+ let data = [
59
+ Params.message: message,
60
+ Params.extraInfoRawStack: extraDataAsJSON ?? "",
61
+ Params.exceptionId: "\(exceptionId)",
62
+ EventsRelatedKeys.Generic.crashId: (extraDataAsJSON ?? message).md5().lowercased(),
63
+ ]
64
+
65
+ Task { @MainActor in
66
+ storeFatalJSException(message,
67
+ data: data,
68
+ exceptionId: exceptionId,
69
+ extraDataAsJSON: extraDataAsJSON)
70
+ }
71
+
72
+ // try to post exception to the logger
52
73
  logger?.errorLog(message: ReactNativeManagerLogs.handleFatalJSException.message,
53
74
  category: ReactNativeManagerLogs.handleFatalJSException.category,
54
- data: [
55
- "message": message,
56
- "stack": stack,
57
- "exceptionId": "\(exceptionId)",
58
- ])
75
+ data: data)
76
+ }
77
+
78
+ @MainActor
79
+ func storeFatalJSException(_ message: String,
80
+ data: [String: Any],
81
+ exceptionId _: NSNumber,
82
+ extraDataAsJSON _: String?) {
83
+ let isDebugEnvironment = FacadeConnector.instance?.applicationData?.isDebugEnvironment() ?? false
84
+ guard !isDebugEnvironment else {
85
+ return
86
+ }
87
+
88
+ let event = logger?.getEvent(message: ReactNativeManagerLogs.handleFatalJSException.message,
89
+ category: ReactNativeManagerLogs.handleFatalJSException.category,
90
+ data: data,
91
+ logLevel: .error)
92
+ if let dict = event?.toDictionary() {
93
+ UserDefaults.standard.setValue(dict,
94
+ forKey: EventsRelatedKeys.UserDefaults.lastFatalJsException)
95
+ }
59
96
  }
60
97
  }
@@ -253,49 +253,9 @@ public class FocusableGroupView: RCTTVView {
253
253
  isFocusDisabled == false
254
254
  }
255
255
 
256
- // This was added because on fast scroll preferred focus was not called,
257
- // that cause to select wrong item. On future must be removed if resolved
258
- private func needsFocusUpdateDueToWrongFocus(context: UIFocusUpdateContext,
259
- with coordinator: UIFocusAnimationCoordinator) -> Bool {
260
- guard
261
- let preferredFocusedItem = preferredFocusEnvironments.first as? FocusableView,
262
- let nextFocusedItem = context.nextFocusedItem as? FocusableView,
263
- let previouslyFocusedItem = context.previouslyFocusedItem as? FocusableView else { return false }
264
-
265
- let previousFocusedItemNotFromSameGroup = previouslyFocusedItem.groupId != nextFocusedItem.groupId
266
- let nextFocusedBelongsToCurrentGroup = nextFocusedItem.groupId == itemId
267
- let nextFocusItemNotPreferredFocusedItem = nextFocusedItem.itemId != preferredFocusedItem.itemId
268
-
269
- guard previousFocusedItemNotFromSameGroup,
270
- nextFocusedBelongsToCurrentGroup,
271
- nextFocusItemNotPreferredFocusedItem else {
272
- return false
273
- }
274
-
275
- coordinator.addCoordinatedAnimations({
276
- let duration: TimeInterval = UIView.inheritedAnimationDuration
277
- UIView.animate(withDuration: duration,
278
- delay: 0.0,
279
- options: [],
280
- animations: {
281
- self.setNeedsFocusUpdate()
282
- DispatchQueue.main.async {
283
- self.updateFocusIfNeeded()
284
- }
285
- }, completion: nil)
286
- }, completion: nil)
287
-
288
- return true
289
- }
290
-
291
- override public func didUpdateFocus(in context: UIFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
256
+ override public func didUpdateFocus(in context: UIFocusUpdateContext, with _: UIFocusAnimationCoordinator) {
292
257
  guard isFocusDisabled == false else { return }
293
258
 
294
- guard needsFocusUpdateDueToWrongFocus(context: context,
295
- with: coordinator) == false else {
296
- return
297
- }
298
-
299
259
  if isPreferredFocusDisabled == false {
300
260
  updatePreferredFocusView(nextFocusItem: context.nextFocusedItem)
301
261
  }
@@ -30,7 +30,7 @@ RCT_EXTERN_METHOD(setAppLanguage:(NSString *)language
30
30
 
31
31
  @interface RCT_EXTERN_MODULE (AnalyticsBridge, NSObject)
32
32
  RCT_EXTERN_METHOD(postEvent:(NSString *)event
33
- payload:(NSDictionary *)payload);
33
+ payload:(NSDictionary *)payload);
34
34
  RCT_EXTERN_METHOD(postTimedEvent:(NSString *)event
35
35
  payload:(NSDictionary *)payload);
36
36
  RCT_EXTERN_METHOD(endTimedEvent:(NSString *)event
@@ -12,12 +12,13 @@ import ZappCore
12
12
 
13
13
  public struct ReactNativeManagerLogs: XrayLoggerTemplateProtocol {
14
14
  public static var subsystem: String = "\(kNativeSubsystemPath)/react_native_manager"
15
+ public static var subsystemExceptions: String = "\(kNativeSubsystemPath)/react_native_manager/exceptions"
15
16
 
16
17
  public static var mountingReactApp = LogTemplate(message: "Mounting React App")
17
18
  public static var noReactBridge = LogTemplate(message: "No React Bridge")
18
19
  public static var presentingReactViewController = LogTemplate(message: "Presenting React ViewController")
19
20
  public static var setRightToLeftFlagError = LogTemplate(message: "Error setting RTL")
20
21
  public static var failedToLoadJson = LogTemplate(message: "Failed to load json")
21
- public static var handleSoftJSException = LogTemplate(message: "Soft JS Exception")
22
- public static var handleFatalJSException = LogTemplate(message: "Fatal JS Exception")
22
+ public static var handleSoftJSException = LogTemplate(message: "Soft JS Exception", category: EventsRelatedKeys.CrashType.jsSoft.rawValue)
23
+ public static var handleFatalJSException = LogTemplate(message: "Fatal JS Exception", category: EventsRelatedKeys.CrashType.jsFatal.rawValue)
23
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-native-apple",
3
- "version": "6.14.2",
3
+ "version": "6.14.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"