@applicaster/quick-brick-native-apple 6.9.0-alpha.0 → 6.9.0-alpha.1

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.9.0-alpha.0",
3
+ "version": "6.9.0-alpha.1",
4
4
  "platforms": {
5
5
  "ios": "14.0",
6
6
  "tvos": "14.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.9.0-alpha.0"
19
+ "tag": "@@applicaster/quick-brick-native-apple/6.9.0-alpha.1"
20
20
  },
21
21
  "requires_arc": true,
22
22
  "source_files": "universal/**/*.{m,swift}",
@@ -10,17 +10,22 @@ import React
10
10
  import ZappCore
11
11
 
12
12
  extension ReactNativeManager: UNUserNotificationCenterDelegate {
13
+ fileprivate enum AnalyticsEvents {
14
+ static let pushNotificationReceived = "push_notification_received"
15
+ static let pushNotificationOpened = "push_notification_opened"
16
+ }
17
+
13
18
  public func userNotificationCenter(_: UNUserNotificationCenter,
14
19
  willPresent notification: UNNotification,
15
20
  withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
16
- sendAnalyticsEventOnPresent(of: notification)
21
+ sendAnalyticsEvent(for: notification, eventName: AnalyticsEvents.pushNotificationReceived)
17
22
  completionHandler([.list, .banner, .sound])
18
23
  }
19
24
 
20
25
  public func userNotificationCenter(_: UNUserNotificationCenter,
21
26
  didReceive response: UNNotificationResponse,
22
27
  withCompletionHandler completionHandler: @escaping () -> Void) {
23
- sendAnalyticsEventOnOpen(of: response.notification)
28
+ sendAnalyticsEvent(for: response.notification, eventName: AnalyticsEvents.pushNotificationOpened)
24
29
  guard let url = LocalNotificationResponseParser.urlFromLocalNotification(response: response) else {
25
30
  completionHandler()
26
31
  return
@@ -30,21 +35,11 @@ extension ReactNativeManager: UNUserNotificationCenterDelegate {
30
35
  }
31
36
  }
32
37
 
33
- func sendAnalyticsEventOnPresent(of notification: UNNotification) {
34
- let event = EventsBus.Event(type: EventsBusType(.analytics(.sendEvent)),
35
- source: logger?.subsystem,
36
- data: [
37
- "name": "push_notification_received",
38
- "parameters": parameters(for: notification),
39
- ])
40
- EventsBus.post(event)
41
- }
42
-
43
- func sendAnalyticsEventOnOpen(of notification: UNNotification) {
38
+ func sendAnalyticsEvent(for notification: UNNotification, eventName: String) {
44
39
  let event = EventsBus.Event(type: EventsBusType(.analytics(.sendEvent)),
45
40
  source: logger?.subsystem,
46
41
  data: [
47
- "name": "push_notification_opened",
42
+ "name": eventName,
48
43
  "parameters": parameters(for: notification),
49
44
  ])
50
45
  EventsBus.post(event)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/quick-brick-native-apple",
3
- "version": "6.9.0-alpha.0",
3
+ "version": "6.9.0-alpha.1",
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"