@developer_tribe/react-native-comnyx 0.7.6 → 0.9.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.
- package/android/build.gradle +12 -6
- package/android/generated/RCTAppDependencyProvider.h +25 -0
- package/android/generated/RCTAppDependencyProvider.mm +55 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/android/generated/ReactAppDependencyProvider.podspec +34 -0
- package/android/generated/jni/RNComnyxSpec-generated.cpp +1 -11
- package/android/generated/jni/RNComnyxSpec.h +0 -7
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +0 -11
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +0 -52
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +75 -7
- package/android/src/main/java/com/comnyx/ComnyxPackage.kt +0 -3
- package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +1 -9
- package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +105 -8
- package/ios/Comnyx.m +2 -2
- package/ios/Comnyx.swift +83 -20
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNComnyxSpec/RNComnyxSpec-generated.mm +0 -23
- package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +0 -25
- package/ios/generated/RNComnyxSpecJSI-generated.cpp +0 -11
- package/ios/generated/RNComnyxSpecJSI.h +0 -52
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/commonjs/NativeComnyx.js.map +1 -1
- package/lib/commonjs/api/api.js +4 -0
- package/lib/commonjs/api/api.js.map +1 -1
- package/lib/commonjs/components/ChatList.js +100 -106
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/components/CustomerForm.js +173 -179
- package/lib/commonjs/components/CustomerForm.js.map +1 -1
- package/lib/commonjs/components/EmptyList.js +5 -7
- package/lib/commonjs/components/EmptyList.js.map +1 -1
- package/lib/commonjs/constants/translations.js +145 -29
- package/lib/commonjs/constants/translations.js.map +1 -1
- package/lib/commonjs/hooks/useLocalize.js +7 -0
- package/lib/commonjs/hooks/useLocalize.js.map +1 -1
- package/lib/commonjs/notifications/index.js +2 -1
- package/lib/commonjs/notifications/index.js.map +1 -1
- package/lib/commonjs/notifications/initializeNotifications.js +137 -0
- package/lib/commonjs/notifications/initializeNotifications.js.map +1 -0
- package/lib/commonjs/register/login.js +1 -1
- package/lib/commonjs/register/login.js.map +1 -1
- package/lib/commonjs/store/store.js +14 -1
- package/lib/commonjs/store/store.js.map +1 -1
- package/lib/module/NativeComnyx.js.map +1 -1
- package/lib/module/api/api.js +3 -0
- package/lib/module/api/api.js.map +1 -1
- package/lib/module/components/ChatList.js +101 -107
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/components/CustomerForm.js +174 -180
- package/lib/module/components/CustomerForm.js.map +1 -1
- package/lib/module/components/EmptyList.js +6 -8
- package/lib/module/components/EmptyList.js.map +1 -1
- package/lib/module/constants/translations.js +145 -29
- package/lib/module/constants/translations.js.map +1 -1
- package/lib/module/hooks/useLocalize.js +6 -0
- package/lib/module/hooks/useLocalize.js.map +1 -1
- package/lib/module/notifications/index.js +2 -1
- package/lib/module/notifications/index.js.map +1 -1
- package/lib/module/notifications/initializeNotifications.js +133 -0
- package/lib/module/notifications/initializeNotifications.js.map +1 -0
- package/lib/module/register/login.js +1 -1
- package/lib/module/register/login.js.map +1 -1
- package/lib/module/store/store.js +14 -1
- package/lib/module/store/store.js.map +1 -1
- package/lib/typescript/src/NativeComnyx.d.ts +6 -1
- package/lib/typescript/src/NativeComnyx.d.ts.map +1 -1
- package/lib/typescript/src/api/api.d.ts +1 -0
- package/lib/typescript/src/api/api.d.ts.map +1 -1
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
- package/lib/typescript/src/components/EmptyList.d.ts.map +1 -1
- package/lib/typescript/src/constants/translations.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useLocalize.d.ts +1 -0
- package/lib/typescript/src/hooks/useLocalize.d.ts.map +1 -1
- package/lib/typescript/src/notifications/index.d.ts +63 -4
- package/lib/typescript/src/notifications/index.d.ts.map +1 -1
- package/lib/typescript/src/notifications/initializeNotifications.d.ts +7 -0
- package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -0
- package/lib/typescript/src/store/store.d.ts +4 -0
- package/lib/typescript/src/store/store.d.ts.map +1 -1
- package/lib/typescript/src/types/Customer.d.ts +5 -0
- package/lib/typescript/src/types/Customer.d.ts.map +1 -1
- package/lib/typescript/src/types/LocalizationKeys.d.ts +4 -0
- package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/NativeComnyx.ts +6 -1
- package/src/api/api.ts +4 -0
- package/src/components/ChatList.tsx +110 -123
- package/src/components/CustomerForm.tsx +194 -212
- package/src/components/EmptyList.tsx +3 -10
- package/src/constants/translations.ts +145 -0
- package/src/hooks/useLocalize.ts +6 -0
- package/src/notifications/index.ts +69 -5
- package/src/notifications/initializeNotifications.ts +180 -0
- package/src/register/login.ts +1 -1
- package/src/store/store.ts +13 -0
- package/src/types/Customer.ts +5 -0
- package/src/types/LocalizationKeys.ts +4 -0
- package/android/generated/java/com/comnyx/NativeComnyxSpec.java +0 -37
- package/lib/typescript/setup-jest.d.ts +0 -1
- package/lib/typescript/setup-jest.d.ts.map +0 -1
package/ios/Comnyx.swift
CHANGED
|
@@ -12,41 +12,87 @@ import UserNotifications
|
|
|
12
12
|
class Comnyx: RCTEventEmitter {
|
|
13
13
|
private var hasListeners: Bool = false
|
|
14
14
|
var comnyxMessaging: ComnyxMessaging?
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
override init() {
|
|
17
17
|
super.init()
|
|
18
18
|
self.comnyxMessaging = ComnyxMessaging(onNotificationReceived: { notification in
|
|
19
|
-
|
|
19
|
+
let notificationData: [String: Any] = [
|
|
20
|
+
"title": notification.request.content.title,
|
|
21
|
+
"body": notification.request.content.body,
|
|
22
|
+
"subtitle": notification.request.content.subtitle,
|
|
23
|
+
"badge": notification.request.content.badge?.intValue ?? 0,
|
|
24
|
+
"sound": notification.request.content.sound?.debugDescription ?? "",
|
|
25
|
+
"data": notification.request.content.userInfo,
|
|
26
|
+
"raw": [
|
|
27
|
+
"identifier": notification.request.identifier,
|
|
28
|
+
"content": [
|
|
29
|
+
"title": notification.request.content.title,
|
|
30
|
+
"body": notification.request.content.body,
|
|
31
|
+
"subtitle": notification.request.content.subtitle,
|
|
32
|
+
"badge": notification.request.content.badge?.intValue ?? 0,
|
|
33
|
+
"sound": notification.request.content.sound?.debugDescription ?? "",
|
|
34
|
+
"userInfo": notification.request.content.userInfo,
|
|
35
|
+
"categoryIdentifier": notification.request.content.categoryIdentifier,
|
|
36
|
+
"threadIdentifier": notification.request.content.threadIdentifier
|
|
37
|
+
]
|
|
38
|
+
]
|
|
39
|
+
]
|
|
40
|
+
self.sendEvent(withName: "NOTIFICATION_RECEIVED", body: ["notification": notificationData])
|
|
20
41
|
}, onNotificationClicked: { response in
|
|
21
|
-
|
|
42
|
+
let responseData: [String: Any] = [
|
|
43
|
+
"title": response.notification.request.content.title,
|
|
44
|
+
"body": response.notification.request.content.body,
|
|
45
|
+
"subtitle": response.notification.request.content.subtitle,
|
|
46
|
+
"badge": response.notification.request.content.badge?.intValue ?? 0,
|
|
47
|
+
"sound": response.notification.request.content.sound?.debugDescription ?? "",
|
|
48
|
+
"data": response.notification.request.content.userInfo,
|
|
49
|
+
"raw":[
|
|
50
|
+
"actionIdentifier": response.actionIdentifier,
|
|
51
|
+
"request": [
|
|
52
|
+
"identifier": response.notification.request.identifier,
|
|
53
|
+
"content": [
|
|
54
|
+
"title": response.notification.request.content.title,
|
|
55
|
+
"body": response.notification.request.content.body,
|
|
56
|
+
"subtitle": response.notification.request.content.subtitle,
|
|
57
|
+
"badge": response.notification.request.content.badge?.intValue ?? 0,
|
|
58
|
+
"sound": response.notification.request.content.sound?.debugDescription ?? "",
|
|
59
|
+
"userInfo": response.notification.request.content.userInfo,
|
|
60
|
+
"categoryIdentifier": response.notification.request.content.categoryIdentifier,
|
|
61
|
+
"threadIdentifier": response.notification.request.content.threadIdentifier
|
|
62
|
+
]
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
]
|
|
66
|
+
]
|
|
67
|
+
self.sendEvent(withName: "NOTIFICATION_CLICKED", body: ["response": responseData])
|
|
22
68
|
})
|
|
23
69
|
}
|
|
24
|
-
|
|
70
|
+
|
|
25
71
|
deinit {
|
|
26
72
|
}
|
|
27
|
-
|
|
73
|
+
|
|
28
74
|
override static func requiresMainQueueSetup() -> Bool {
|
|
29
75
|
return true
|
|
30
76
|
}
|
|
31
|
-
|
|
77
|
+
|
|
32
78
|
override func supportedEvents() -> [String] {
|
|
33
79
|
return ["TOKEN_INIT", "TOKEN_FAILED", "NOTIFICATION_RECEIVED", "NOTIFICATION_CLICKED"]
|
|
34
80
|
}
|
|
35
|
-
|
|
81
|
+
|
|
36
82
|
override func startObserving() {
|
|
37
83
|
hasListeners = true
|
|
38
|
-
|
|
84
|
+
|
|
39
85
|
}
|
|
40
|
-
|
|
86
|
+
|
|
41
87
|
override func stopObserving() {
|
|
42
88
|
hasListeners = false
|
|
43
89
|
}
|
|
44
|
-
|
|
45
90
|
|
|
46
|
-
|
|
91
|
+
|
|
92
|
+
|
|
47
93
|
|
|
48
94
|
// MARK: - JavaScript Methods
|
|
49
|
-
|
|
95
|
+
|
|
50
96
|
@objc
|
|
51
97
|
func checkOptIn(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
52
98
|
UNUserNotificationCenter.current().getNotificationSettings { settings in
|
|
@@ -64,7 +110,7 @@ class Comnyx: RCTEventEmitter {
|
|
|
64
110
|
}
|
|
65
111
|
}
|
|
66
112
|
}
|
|
67
|
-
|
|
113
|
+
|
|
68
114
|
@objc
|
|
69
115
|
func optIn(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
70
116
|
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
|
|
@@ -73,7 +119,7 @@ class Comnyx: RCTEventEmitter {
|
|
|
73
119
|
reject("ERROR_OPT_IN", error.localizedDescription, error)
|
|
74
120
|
return
|
|
75
121
|
}
|
|
76
|
-
|
|
122
|
+
|
|
77
123
|
if granted {
|
|
78
124
|
resolve("granted")
|
|
79
125
|
} else {
|
|
@@ -83,11 +129,28 @@ class Comnyx: RCTEventEmitter {
|
|
|
83
129
|
}
|
|
84
130
|
}
|
|
85
131
|
}
|
|
86
|
-
|
|
132
|
+
|
|
87
133
|
@objc
|
|
88
|
-
func initialize(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
134
|
+
func initialize(_ resolve: @escaping RCTPromiseResolveBlock, reject reject: @escaping RCTPromiseRejectBlock) {
|
|
89
135
|
self.comnyxMessaging!.initialize(onInitialized: { initialized in
|
|
90
|
-
|
|
136
|
+
|
|
137
|
+
var countryCode = "US"
|
|
138
|
+
var language = "en"
|
|
139
|
+
if #available(iOS 16, *) {
|
|
140
|
+
countryCode = Locale.current.region?.identifier ?? "US"
|
|
141
|
+
language = Locale.current.language.languageCode?.identifier ?? "en"
|
|
142
|
+
} else {
|
|
143
|
+
countryCode = Locale.current.regionCode ?? "US"
|
|
144
|
+
language = Locale.current.languageCode ?? "en"
|
|
145
|
+
}
|
|
146
|
+
let timezone = TimeZone.current.identifier
|
|
147
|
+
|
|
148
|
+
resolve([
|
|
149
|
+
"success": initialized,
|
|
150
|
+
"country": countryCode,
|
|
151
|
+
"timezone": timezone,
|
|
152
|
+
"language": language,
|
|
153
|
+
])
|
|
91
154
|
}, onApnTokenReceived: { type, token in
|
|
92
155
|
if(type == "failed"){
|
|
93
156
|
self.sendEvent(withName: "TOKEN_FAILED", body: ["type": type, "token": nil])
|
|
@@ -96,9 +159,9 @@ class Comnyx: RCTEventEmitter {
|
|
|
96
159
|
}
|
|
97
160
|
})
|
|
98
161
|
}
|
|
99
|
-
|
|
162
|
+
|
|
100
163
|
@objc
|
|
101
|
-
func linkToSettings(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
164
|
+
func linkToSettings(_ resolve: @escaping RCTPromiseResolveBlock, reject reject: @escaping RCTPromiseRejectBlock) {
|
|
102
165
|
if let settingsUrl = URL(string: UIApplication.openSettingsURLString) {
|
|
103
166
|
if UIApplication.shared.canOpenURL(settingsUrl) {
|
|
104
167
|
UIApplication.shared.open(settingsUrl, completionHandler: { success in
|
|
@@ -111,7 +174,7 @@ class Comnyx: RCTEventEmitter {
|
|
|
111
174
|
reject("SETTINGS_ERROR", "Could not create settings URL", nil)
|
|
112
175
|
}
|
|
113
176
|
}
|
|
114
|
-
|
|
177
|
+
|
|
115
178
|
|
|
116
179
|
}
|
|
117
180
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
#if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
|
|
12
|
+
#import <React-RCTAppDelegate/RCTDependencyProvider.h>
|
|
13
|
+
#elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
|
|
14
|
+
#import <React_RCTAppDelegate/RCTDependencyProvider.h>
|
|
15
|
+
#else
|
|
16
|
+
#import "RCTDependencyProvider.h"
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
20
|
+
|
|
21
|
+
@interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
|
|
22
|
+
|
|
23
|
+
@end
|
|
24
|
+
|
|
25
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import "RCTAppDependencyProvider.h"
|
|
9
|
+
#import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
|
|
10
|
+
#import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
|
|
11
|
+
|
|
12
|
+
@implementation RCTAppDependencyProvider {
|
|
13
|
+
NSArray<NSString *> * _URLRequestHandlerClassNames;
|
|
14
|
+
NSArray<NSString *> * _imageDataDecoderClassNames;
|
|
15
|
+
NSArray<NSString *> * _imageURLLoaderClassNames;
|
|
16
|
+
NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
- (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
|
|
20
|
+
static dispatch_once_t requestUrlToken;
|
|
21
|
+
dispatch_once(&requestUrlToken, ^{
|
|
22
|
+
self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return _URLRequestHandlerClassNames;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
- (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
|
|
29
|
+
static dispatch_once_t dataDecoderToken;
|
|
30
|
+
dispatch_once(&dataDecoderToken, ^{
|
|
31
|
+
_imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return _imageDataDecoderClassNames;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
|
|
38
|
+
static dispatch_once_t urlLoaderToken;
|
|
39
|
+
dispatch_once(&urlLoaderToken, ^{
|
|
40
|
+
_imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return _imageURLLoaderClassNames;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
|
|
47
|
+
static dispatch_once_t nativeComponentsToken;
|
|
48
|
+
dispatch_once(&nativeComponentsToken, ^{
|
|
49
|
+
_thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return _thirdPartyFabricComponents;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@interface RCTModulesConformingToProtocolsProvider: NSObject
|
|
11
|
+
|
|
12
|
+
+(NSArray<NSString *> *)imageURLLoaderClassNames;
|
|
13
|
+
|
|
14
|
+
+(NSArray<NSString *> *)imageDataDecoderClassNames;
|
|
15
|
+
|
|
16
|
+
+(NSArray<NSString *> *)URLRequestHandlerClassNames;
|
|
17
|
+
|
|
18
|
+
@end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import "RCTModulesConformingToProtocolsProvider.h"
|
|
9
|
+
|
|
10
|
+
@implementation RCTModulesConformingToProtocolsProvider
|
|
11
|
+
|
|
12
|
+
+(NSArray<NSString *> *)imageURLLoaderClassNames
|
|
13
|
+
{
|
|
14
|
+
return @[
|
|
15
|
+
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
+(NSArray<NSString *> *)imageDataDecoderClassNames
|
|
20
|
+
{
|
|
21
|
+
return @[
|
|
22
|
+
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
+(NSArray<NSString *> *)URLRequestHandlerClassNames
|
|
27
|
+
{
|
|
28
|
+
return @[
|
|
29
|
+
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
|
|
10
|
+
@protocol RCTComponentViewProtocol;
|
|
11
|
+
|
|
12
|
+
@interface RCTThirdPartyComponentsProvider: NSObject
|
|
13
|
+
|
|
14
|
+
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
|
|
15
|
+
|
|
16
|
+
@end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
#import "RCTThirdPartyComponentsProvider.h"
|
|
12
|
+
#import <React/RCTComponentViewProtocol.h>
|
|
13
|
+
|
|
14
|
+
@implementation RCTThirdPartyComponentsProvider
|
|
15
|
+
|
|
16
|
+
+ (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
17
|
+
{
|
|
18
|
+
return @{
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@end
|
|
@@ -14,26 +14,3 @@
|
|
|
14
14
|
#import "RNComnyxSpec.h"
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
@implementation NativeComnyxSpecBase
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
|
|
21
|
-
{
|
|
22
|
-
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
|
|
23
|
-
}
|
|
24
|
-
@end
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
namespace facebook::react {
|
|
28
|
-
|
|
29
|
-
static facebook::jsi::Value __hostFunction_NativeComnyxSpecJSI_multiply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
30
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, NumberKind, "multiply", @selector(multiply:b:), args, count);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
NativeComnyxSpecJSI::NativeComnyxSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
34
|
-
: ObjCTurboModule(params) {
|
|
35
|
-
|
|
36
|
-
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeComnyxSpecJSI_multiply};
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
} // namespace facebook::react
|
|
@@ -33,31 +33,6 @@
|
|
|
33
33
|
|
|
34
34
|
NS_ASSUME_NONNULL_BEGIN
|
|
35
35
|
|
|
36
|
-
@protocol NativeComnyxSpec <RCTBridgeModule, RCTTurboModule>
|
|
37
|
-
|
|
38
|
-
- (NSNumber *)multiply:(double)a
|
|
39
|
-
b:(double)b;
|
|
40
|
-
|
|
41
|
-
@end
|
|
42
|
-
|
|
43
|
-
@interface NativeComnyxSpecBase : NSObject {
|
|
44
|
-
@protected
|
|
45
|
-
facebook::react::EventEmitterCallback _eventEmitterCallback;
|
|
46
|
-
}
|
|
47
|
-
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@end
|
|
51
|
-
|
|
52
|
-
namespace facebook::react {
|
|
53
|
-
/**
|
|
54
|
-
* ObjC++ class for module 'NativeComnyx'
|
|
55
|
-
*/
|
|
56
|
-
class JSI_EXPORT NativeComnyxSpecJSI : public ObjCTurboModule {
|
|
57
|
-
public:
|
|
58
|
-
NativeComnyxSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
59
|
-
};
|
|
60
|
-
} // namespace facebook::react
|
|
61
36
|
|
|
62
37
|
NS_ASSUME_NONNULL_END
|
|
63
38
|
#endif // RNComnyxSpec_H
|
|
@@ -11,18 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
namespace facebook::react {
|
|
13
13
|
|
|
14
|
-
static jsi::Value __hostFunction_NativeComnyxCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
-
return static_cast<NativeComnyxCxxSpecJSI *>(&turboModule)->multiply(
|
|
16
|
-
rt,
|
|
17
|
-
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
|
|
18
|
-
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
14
|
|
|
22
|
-
NativeComnyxCxxSpecJSI::NativeComnyxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
23
|
-
: TurboModule("Comnyx", jsInvoker) {
|
|
24
|
-
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeComnyxCxxSpecJSI_multiply};
|
|
25
|
-
}
|
|
26
15
|
|
|
27
16
|
|
|
28
17
|
} // namespace facebook::react
|
|
@@ -15,57 +15,5 @@
|
|
|
15
15
|
namespace facebook::react {
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
class JSI_EXPORT NativeComnyxCxxSpecJSI : public TurboModule {
|
|
19
|
-
protected:
|
|
20
|
-
NativeComnyxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
-
|
|
22
|
-
public:
|
|
23
|
-
virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
template <typename T>
|
|
28
|
-
class JSI_EXPORT NativeComnyxCxxSpec : public TurboModule {
|
|
29
|
-
public:
|
|
30
|
-
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
31
|
-
return delegate_.create(rt, propName);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
35
|
-
return delegate_.getPropertyNames(runtime);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static constexpr std::string_view kModuleName = "Comnyx";
|
|
39
|
-
|
|
40
|
-
protected:
|
|
41
|
-
NativeComnyxCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
42
|
-
: TurboModule(std::string{NativeComnyxCxxSpec::kModuleName}, jsInvoker),
|
|
43
|
-
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
private:
|
|
47
|
-
class Delegate : public NativeComnyxCxxSpecJSI {
|
|
48
|
-
public:
|
|
49
|
-
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
50
|
-
NativeComnyxCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
double multiply(jsi::Runtime &rt, double a, double b) override {
|
|
55
|
-
static_assert(
|
|
56
|
-
bridging::getParameterCount(&T::multiply) == 3,
|
|
57
|
-
"Expected multiply(...) to have 3 parameters");
|
|
58
|
-
|
|
59
|
-
return bridging::callFromJs<double>(
|
|
60
|
-
rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private:
|
|
64
|
-
friend class NativeComnyxCxxSpec;
|
|
65
|
-
T *instance_;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
Delegate delegate_;
|
|
69
|
-
};
|
|
70
18
|
|
|
71
19
|
} // namespace facebook::react
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
version = "0.78.1"
|
|
7
|
+
source = { :git => 'https://github.com/facebook/react-native.git' }
|
|
8
|
+
if version == '1000.0.0'
|
|
9
|
+
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
|
10
|
+
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
|
|
11
|
+
else
|
|
12
|
+
source[:tag] = "v#{version}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Pod::Spec.new do |s|
|
|
16
|
+
s.name = "ReactAppDependencyProvider"
|
|
17
|
+
s.version = version
|
|
18
|
+
s.summary = "The third party dependency provider for the app"
|
|
19
|
+
s.homepage = "https://reactnative.dev/"
|
|
20
|
+
s.documentation_url = "https://reactnative.dev/"
|
|
21
|
+
s.license = "MIT"
|
|
22
|
+
s.author = "Meta Platforms, Inc. and its affiliates"
|
|
23
|
+
s.platforms = min_supported_versions
|
|
24
|
+
s.source = source
|
|
25
|
+
s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
|
|
26
|
+
|
|
27
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
s.pod_target_xcconfig = {
|
|
29
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
|
|
30
|
+
"DEFINES_MODULE" => "YES"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
s.dependency "ReactCodegen"
|
|
34
|
+
end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","NotificationPermissionStatus","exports","nativeComnyx","NativeModules","Comnyx"],"sourceRoot":"../../src","sources":["NativeComnyx.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAA6C,IAEjCC,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,0BAA5BA,4BAA4B;EAA5BA,4BAA4B;EAA5BA,4BAA4B;EAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","NotificationPermissionStatus","exports","nativeComnyx","NativeModules","Comnyx"],"sourceRoot":"../../src","sources":["NativeComnyx.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAA6C,IAEjCC,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,0BAA5BA,4BAA4B;EAA5BA,4BAA4B;EAA5BA,4BAA4B;EAA5BA,4BAA4B;EAAA,OAA5BA,4BAA4B;AAAA;AAkBjC,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAGC,0BAAa,CAACC,MAAsB","ignoreList":[]}
|
package/lib/commonjs/api/api.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.axiosInstance = void 0;
|
|
7
7
|
exports.initApi = initApi;
|
|
8
8
|
exports.isInitCalled = isInitCalled;
|
|
9
|
+
exports.isLoginCalled = isLoginCalled;
|
|
9
10
|
exports.setLoginForAxios = setLoginForAxios;
|
|
10
11
|
exports.setLogoutForAxios = setLogoutForAxios;
|
|
11
12
|
var _axios = _interopRequireDefault(require("axios"));
|
|
@@ -20,6 +21,9 @@ const axiosInstance = exports.axiosInstance = _axios.default.create({
|
|
|
20
21
|
function isInitCalled() {
|
|
21
22
|
return !!axiosInstance.defaults.headers.common.Authorization;
|
|
22
23
|
}
|
|
24
|
+
function isLoginCalled() {
|
|
25
|
+
return !!axiosInstance.defaults.headers.common['external-id'];
|
|
26
|
+
}
|
|
23
27
|
function initApi(token, baseURL) {
|
|
24
28
|
axiosInstance.defaults.headers.common['Content-Type'] = 'application/json';
|
|
25
29
|
axiosInstance.defaults.headers.common.Authorization = 'Bearer ' + token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_axios","_interopRequireDefault","require","e","__esModule","default","axiosInstance","exports","axios","create","baseURL","headers","timeout","isInitCalled","defaults","common","Authorization","initApi","token","setLoginForAxios","externalId","setLogoutForAxios"],"sourceRoot":"../../../src","sources":["api/api.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_axios","_interopRequireDefault","require","e","__esModule","default","axiosInstance","exports","axios","create","baseURL","headers","timeout","isInitCalled","defaults","common","Authorization","isLoginCalled","initApi","token","setLoginForAxios","externalId","setLogoutForAxios"],"sourceRoot":"../../../src","sources":["api/api.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAC1B,MAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAGE,cAAK,CAACC,MAAM,CAAC;EACjCC,OAAO,EAAE,wBAAwB;EACjCC,OAAO,EAAE;IACP,cAAc,EAAE;EAClB,CAAC;EACDC,OAAO,EAAE;AACX,CAAC,CAAC;AAEK,SAASC,YAAYA,CAAA,EAAG;EAC7B,OAAO,CAAC,CAACP,aAAa,CAACQ,QAAQ,CAACH,OAAO,CAACI,MAAM,CAACC,aAAa;AAC9D;AAEO,SAASC,aAAaA,CAAA,EAAG;EAC9B,OAAO,CAAC,CAACX,aAAa,CAACQ,QAAQ,CAACH,OAAO,CAACI,MAAM,CAAC,aAAa,CAAC;AAC/D;AAEO,SAASG,OAAOA,CAACC,KAAa,EAAET,OAAgB,EAAE;EACvDJ,aAAa,CAACQ,QAAQ,CAACH,OAAO,CAACI,MAAM,CAAC,cAAc,CAAC,GAAG,kBAAkB;EAC1ET,aAAa,CAACQ,QAAQ,CAACH,OAAO,CAACI,MAAM,CAACC,aAAa,GAAG,SAAS,GAAGG,KAAK;EACvEb,aAAa,CAACQ,QAAQ,CAACJ,OAAO,GAAGA,OAAO,IAAIJ,aAAa,CAACQ,QAAQ,CAACJ,OAAO;AAC5E;AAEO,SAASU,gBAAgBA,CAACC,UAAkB,EAAE;EACnDf,aAAa,CAACQ,QAAQ,CAACH,OAAO,CAACI,MAAM,CAAC,aAAa,CAAC,GAAGM,UAAU;AACnE;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClChB,aAAa,CAACQ,QAAQ,CAACH,OAAO,CAACI,MAAM,CAAC,aAAa,CAAC,GAAG,IAAI;AAC7D","ignoreList":[]}
|