@applicaster/quick-brick-native-apple 5.13.1 → 5.13.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": "5.13.1",
3
+ "version": "5.13.4",
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"
19
+ "tag": "@@applicaster/quick-brick-native-apple/5.13.4"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -0,0 +1,58 @@
1
+ //
2
+ // QuickBrickExceptionManager.swift
3
+ // QuickBrickApple
4
+ //
5
+ // Created by Alex Zchut on 02/16/22.
6
+ //
7
+
8
+ import os.log
9
+ import React
10
+ import UIKit
11
+ import XrayLogger
12
+ import ZappCore
13
+
14
+ class QuickBrickExceptionManager: RCTExceptionsManager, RCTExceptionsManagerDelegate {
15
+ public lazy var logger = Logger.getLogger(for: ReactNativeManagerLogs.subsystem)
16
+
17
+ func handleSoftJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber) {
18
+ guard let message = message,
19
+ let stack = stack else {
20
+ return
21
+ }
22
+
23
+ let logOrigin = OSLog(subsystem: "\(Self.self)", category: "handleSoftJSException")
24
+ os_log("handleSoftJSException message: %@, stack: %@",
25
+ log: logOrigin,
26
+ type: .error,
27
+ message, stack)
28
+
29
+ logger?.errorLog(message: ReactNativeManagerLogs.handleSoftJSException.message,
30
+ category: ReactNativeManagerLogs.handleSoftJSException.category,
31
+ data: [
32
+ "message": message,
33
+ "stack": stack,
34
+ "exceptionId": "\(exceptionId)",
35
+ ])
36
+ }
37
+
38
+ func handleFatalJSException(withMessage message: String?, stack: [Any]?, exceptionId: NSNumber) {
39
+ guard let message = message,
40
+ let stack = stack else {
41
+ return
42
+ }
43
+
44
+ let logOrigin = OSLog(subsystem: "\(Self.self)", category: "handleFatalJSException")
45
+ os_log("handleFatalJSException message: %{public}@, stack: %{public}@",
46
+ log: logOrigin,
47
+ type: .error,
48
+ message, stack)
49
+
50
+ logger?.errorLog(message: ReactNativeManagerLogs.handleFatalJSException.message,
51
+ category: ReactNativeManagerLogs.handleFatalJSException.category,
52
+ data: [
53
+ "message": message,
54
+ "stack": stack,
55
+ "exceptionId": "\(exceptionId)",
56
+ ])
57
+ }
58
+ }
@@ -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]?,
@@ -91,9 +94,9 @@ open class ReactNativeManager: NSObject, UserInterfaceLayerProtocol {
91
94
  }
92
95
 
93
96
  #if os(iOS)
94
- public func currentOrientationMask() -> UIInterfaceOrientationMask? {
95
- return rootViewController?.orientationStack.last
96
- }
97
+ public func currentOrientationMask() -> UIInterfaceOrientationMask? {
98
+ return rootViewController?.orientationStack.last
99
+ }
97
100
  #endif
98
101
 
99
102
  // MARK: Public methods
@@ -167,6 +170,15 @@ extension ReactNativeManager: RCTBridgeDelegate {
167
170
  }
168
171
  return nil
169
172
  }
173
+
174
+ #if os(iOS)
175
+ public func extraModules(for bridge: RCTBridge!) -> [RCTBridgeModule]! {
176
+ let qbExceptionManager = QuickBrickExceptionManager()
177
+ let rctException = RCTExceptionsManager(delegate: qbExceptionManager)
178
+
179
+ return [rctException, qbExceptionManager]
180
+ }
181
+ #endif
170
182
  }
171
183
 
172
184
  extension ReactNativeManager: QuickBrickManagerDelegate {
@@ -214,4 +226,4 @@ extension ReactNativeManager: QuickBrickManagerDelegate {
214
226
  public func forceAppReload() {
215
227
  EventsBus.post(EventsBus.Event(type: EventsBusType(.forceAppReload)))
216
228
  }
217
- }
229
+ }
@@ -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",
3
+ "version": "5.13.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"