@applicaster/quick-brick-native-apple 6.14.2 → 6.15.0-alpha.0

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.15.0-alpha.0",
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.15.0-alpha.0"
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,34 @@ 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
+ storeFatalJSException(message,
66
+ data: data,
67
+ exceptionId: exceptionId,
68
+ extraDataAsJSON: extraDataAsJSON)
69
+ // try to post exception to the logger
52
70
  logger?.errorLog(message: ReactNativeManagerLogs.handleFatalJSException.message,
53
71
  category: ReactNativeManagerLogs.handleFatalJSException.category,
54
- data: [
55
- "message": message,
56
- "stack": stack,
57
- "exceptionId": "\(exceptionId)",
58
- ])
72
+ data: data)
73
+ }
74
+
75
+ func storeFatalJSException(_ message: String,
76
+ data: [String: Any],
77
+ exceptionId _: NSNumber,
78
+ extraDataAsJSON _: String?) {
79
+ let event = logger?.getEvent(message: ReactNativeManagerLogs.handleFatalJSException.message,
80
+ category: ReactNativeManagerLogs.handleFatalJSException.category,
81
+ data: data,
82
+ logLevel: .error)
83
+ if let dict = event?.toDictionary() {
84
+ UserDefaults.standard.setValue(dict,
85
+ forKey: EventsRelatedKeys.UserDefaults.lastFatalJsException)
86
+ }
59
87
  }
60
88
  }
@@ -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: preferredFocusEnvironments.first)
157
+ params[GroupViewUpdateEvents.preferredFocusEnvironment] = dataForFocusItem(focusItem: customPreferredFocusEnvironment?.first)
158
158
  params[GroupViewUpdateEvents.groupId] = groupId
159
159
  params[GroupViewUpdateEvents.isActive] = isActive
160
160
  params[GroupViewUpdateEvents.isFocusDisabled] = isFocusDisabled
@@ -179,16 +179,12 @@ 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? FocusableView {
182
+ if let focusedView = focusItem as? RCTTVView {
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
192
188
  }
193
189
  return retVal.keys.count == 0 ? nil : retVal
194
190
  }
@@ -35,8 +35,4 @@ 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"
42
38
  }
@@ -40,8 +40,6 @@ 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
45
43
  return retVal
46
44
  }
47
45
  }
@@ -29,8 +29,8 @@ RCT_EXTERN_METHOD(setAppLanguage:(NSString *)language
29
29
  @end
30
30
 
31
31
  @interface RCT_EXTERN_MODULE (AnalyticsBridge, NSObject)
32
- RCT_EXTERN_METHOD(postEvent:(NSString *)event
33
- payload:(NSDictionary *)payload);
32
+ //RCT_EXTERN_METHOD(postEvent:(NSString *)event
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.15.0-alpha.0",
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"