@applicaster/quick-brick-native-apple 5.13.1-alpha.1 → 5.13.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": "5.13.1-alpha.1",
3
+ "version": "5.13.3",
4
4
  "platforms": {
5
5
  "ios": "12.0",
6
6
  "tvos": "12.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/5.13.1-alpha.1"
19
+ "tag": "@@applicaster/quick-brick-native-apple/5.13.3"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -6,6 +6,7 @@
6
6
  // Copyright © 2018 Applicaster LTD. All rights reserved.
7
7
  //
8
8
 
9
+ import os.log
9
10
  import React
10
11
  import UIKit
11
12
  import XrayLogger
@@ -15,12 +16,9 @@ public let kQBModuleName = "QuickBrickApp"
15
16
  public let suspendApp = "suspend"
16
17
 
17
18
  /// React Native Manager class for Quick Brick
18
- open class ReactNativeManager: NSObject, UserInterfaceLayerProtocol {
19
+ open class ReactNativeManager: NSObject, UserInterfaceLayerProtocol, UserInterfaceLayerDelegate {
19
20
  lazy var logger = Logger.getLogger(for: ReactNativeManagerLogs.subsystem)
20
21
 
21
- public var applicationDelegate: UIApplicationDelegate?
22
- public var userNotificationCenterDelegate: UNUserNotificationCenterDelegate?
23
-
24
22
  static var applicationData: [String: Any] = [:]
25
23
 
26
24
  var launchOptions: [UIApplication.LaunchOptionsKey: Any]?
@@ -67,6 +65,11 @@ open class ReactNativeManager: NSObject, UserInterfaceLayerProtocol {
67
65
  return retVal
68
66
  }
69
67
 
68
+ // MARK: UserInterfaceLayerDelegate
69
+
70
+ public var applicationDelegate: UIApplicationDelegate?
71
+ public var userNotificationCenterDelegate: UNUserNotificationCenterDelegate?
72
+
70
73
  // MARK: UserInterfaceLayerProtocol
71
74
 
72
75
  public required init(launchOptions: [UIApplication.LaunchOptionsKey: Any]?,
@@ -90,9 +93,11 @@ open class ReactNativeManager: NSObject, UserInterfaceLayerProtocol {
90
93
  }
91
94
  }
92
95
 
93
- public func currentOrientationMask() -> UIInterfaceOrientationMask? {
94
- return rootViewController?.orientationStack.last
95
- }
96
+ #if os(iOS)
97
+ public func currentOrientationMask() -> UIInterfaceOrientationMask? {
98
+ return rootViewController?.orientationStack.last
99
+ }
100
+ #endif
96
101
 
97
102
  // MARK: Public methods
98
103
 
@@ -165,6 +170,13 @@ extension ReactNativeManager: RCTBridgeDelegate {
165
170
  }
166
171
  return nil
167
172
  }
173
+
174
+ public func extraModules(for bridge: RCTBridge!) -> [RCTBridgeModule]! {
175
+ let qbExceptionManager = QBExceptionManager()
176
+ let rctException = RCTExceptionsManager(delegate: qbExceptionManager)
177
+
178
+ return [rctException, qbExceptionManager]
179
+ }
168
180
  }
169
181
 
170
182
  extension ReactNativeManager: QuickBrickManagerDelegate {
@@ -213,3 +225,49 @@ extension ReactNativeManager: QuickBrickManagerDelegate {
213
225
  EventsBus.post(EventsBus.Event(type: EventsBusType(.forceAppReload)))
214
226
  }
215
227
  }
228
+
229
+ class QBExceptionManager: RCTExceptionsManager, RCTExceptionsManagerDelegate {
230
+ public lazy var logger = Logger.getLogger(for: ReactNativeManagerLogs.subsystem)
231
+
232
+ func handleSoftJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber) {
233
+ guard let message = message,
234
+ let stack = stack else {
235
+ return
236
+ }
237
+
238
+ let logOrigin = OSLog(subsystem: "\(Self.self)", category: "handleSoftJSException")
239
+ os_log("handleSoftJSException message: %@, stack: %@",
240
+ log: logOrigin,
241
+ type: .error,
242
+ message, stack)
243
+
244
+ logger?.errorLog(message: ReactNativeManagerLogs.handleSoftJSException.message,
245
+ category: ReactNativeManagerLogs.handleSoftJSException.category,
246
+ data: [
247
+ "message": message,
248
+ "stack": stack,
249
+ "exceptionId": "\(exceptionId)",
250
+ ])
251
+ }
252
+
253
+ func handleFatalJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber) {
254
+ guard let message = message,
255
+ let stack = stack else {
256
+ return
257
+ }
258
+
259
+ let logOrigin = OSLog(subsystem: "\(Self.self)", category: "handleFatalJSException")
260
+ os_log("handleFatalJSException message: %{public}@, stack: %{public}@",
261
+ log: logOrigin,
262
+ type: .error,
263
+ message, stack)
264
+
265
+ logger?.errorLog(message: ReactNativeManagerLogs.handleFatalJSException.message,
266
+ category: ReactNativeManagerLogs.handleFatalJSException.category,
267
+ data: [
268
+ "message": message,
269
+ "stack": stack,
270
+ "exceptionId": "\(exceptionId)",
271
+ ])
272
+ }
273
+ }
@@ -19,4 +19,6 @@ public struct ReactNativeManagerLogs: XrayLoggerTemplateProtocol {
19
19
  public static var presentingReactViewController = LogTemplate(message: "Presenting React ViewController")
20
20
  public static var setRightToLeftFlagError = LogTemplate(message: "Error setting RTL")
21
21
  public static var failedToLoadJson = LogTemplate(message: "Failed to load json")
22
+ public static var handleSoftJSException = LogTemplate(message: "Soft JS Exception")
23
+ public static var handleFatalJSException = LogTemplate(message: "Fatal JS Exception")
22
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-native-apple",
3
- "version": "5.13.1-alpha.1",
3
+ "version": "5.13.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"