react-native-mobile-chat 0.1.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.
Files changed (96) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +235 -0
  3. package/android/build.gradle +77 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +4 -0
  6. package/android/src/main/java/com/appchat/AppChatModule.java +58 -0
  7. package/android/src/main/java/com/appchat/AppChatPackage.java +28 -0
  8. package/ios/AppChat.h +12 -0
  9. package/ios/AppChat.mm +67 -0
  10. package/ios/AppChat.xcodeproj/project.pbxproj +274 -0
  11. package/ios/AppChat.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
  12. package/lib/commonjs/assets/images/arrow_left.png +0 -0
  13. package/lib/commonjs/assets/images/arrow_left_black.png +0 -0
  14. package/lib/commonjs/common/constants/index.js +20 -0
  15. package/lib/commonjs/common/constants/index.js.map +1 -0
  16. package/lib/commonjs/common/utils/index.js +53 -0
  17. package/lib/commonjs/common/utils/index.js.map +1 -0
  18. package/lib/commonjs/data/local/index.js +28 -0
  19. package/lib/commonjs/data/local/index.js.map +1 -0
  20. package/lib/commonjs/data/remote/index.js +87 -0
  21. package/lib/commonjs/data/remote/index.js.map +1 -0
  22. package/lib/commonjs/data/static/index.js +35 -0
  23. package/lib/commonjs/data/static/index.js.map +1 -0
  24. package/lib/commonjs/index.js +46 -0
  25. package/lib/commonjs/index.js.map +1 -0
  26. package/lib/commonjs/native/component/WebView.js +16 -0
  27. package/lib/commonjs/native/component/WebView.js.map +1 -0
  28. package/lib/commonjs/native/module/index.js +18 -0
  29. package/lib/commonjs/native/module/index.js.map +1 -0
  30. package/lib/commonjs/presentation/component/AppChatComponent.js +236 -0
  31. package/lib/commonjs/presentation/component/AppChatComponent.js.map +1 -0
  32. package/lib/commonjs/presentation/initialization/index.js +148 -0
  33. package/lib/commonjs/presentation/initialization/index.js.map +1 -0
  34. package/lib/commonjs/presentation/notification/index.js +50 -0
  35. package/lib/commonjs/presentation/notification/index.js.map +1 -0
  36. package/lib/module/assets/images/arrow_left.png +0 -0
  37. package/lib/module/assets/images/arrow_left_black.png +0 -0
  38. package/lib/module/common/constants/index.js +13 -0
  39. package/lib/module/common/constants/index.js.map +1 -0
  40. package/lib/module/common/utils/index.js +45 -0
  41. package/lib/module/common/utils/index.js.map +1 -0
  42. package/lib/module/data/local/index.js +20 -0
  43. package/lib/module/data/local/index.js.map +1 -0
  44. package/lib/module/data/remote/index.js +75 -0
  45. package/lib/module/data/remote/index.js.map +1 -0
  46. package/lib/module/data/static/index.js +28 -0
  47. package/lib/module/data/static/index.js.map +1 -0
  48. package/lib/module/index.js +5 -0
  49. package/lib/module/index.js.map +1 -0
  50. package/lib/module/native/component/WebView.js +10 -0
  51. package/lib/module/native/component/WebView.js.map +1 -0
  52. package/lib/module/native/module/index.js +11 -0
  53. package/lib/module/native/module/index.js.map +1 -0
  54. package/lib/module/presentation/component/AppChatComponent.js +227 -0
  55. package/lib/module/presentation/component/AppChatComponent.js.map +1 -0
  56. package/lib/module/presentation/initialization/index.js +141 -0
  57. package/lib/module/presentation/initialization/index.js.map +1 -0
  58. package/lib/module/presentation/notification/index.js +41 -0
  59. package/lib/module/presentation/notification/index.js.map +1 -0
  60. package/lib/typescript/common/constants/index.d.ts +13 -0
  61. package/lib/typescript/common/constants/index.d.ts.map +1 -0
  62. package/lib/typescript/common/utils/index.d.ts +15 -0
  63. package/lib/typescript/common/utils/index.d.ts.map +1 -0
  64. package/lib/typescript/data/local/index.d.ts +4 -0
  65. package/lib/typescript/data/local/index.d.ts.map +1 -0
  66. package/lib/typescript/data/remote/index.d.ts +7 -0
  67. package/lib/typescript/data/remote/index.d.ts.map +1 -0
  68. package/lib/typescript/data/static/index.d.ts +23 -0
  69. package/lib/typescript/data/static/index.d.ts.map +1 -0
  70. package/lib/typescript/index.d.ts +5 -0
  71. package/lib/typescript/index.d.ts.map +1 -0
  72. package/lib/typescript/native/component/WebView.d.ts +8 -0
  73. package/lib/typescript/native/component/WebView.d.ts.map +1 -0
  74. package/lib/typescript/native/module/index.d.ts +2 -0
  75. package/lib/typescript/native/module/index.d.ts.map +1 -0
  76. package/lib/typescript/presentation/component/AppChatComponent.d.ts +22 -0
  77. package/lib/typescript/presentation/component/AppChatComponent.d.ts.map +1 -0
  78. package/lib/typescript/presentation/initialization/index.d.ts +2 -0
  79. package/lib/typescript/presentation/initialization/index.d.ts.map +1 -0
  80. package/lib/typescript/presentation/notification/index.d.ts +5 -0
  81. package/lib/typescript/presentation/notification/index.d.ts.map +1 -0
  82. package/package.json +165 -0
  83. package/react-native-app-chat.podspec +35 -0
  84. package/src/assets/images/arrow_left.png +0 -0
  85. package/src/assets/images/arrow_left_black.png +0 -0
  86. package/src/common/constants/index.tsx +12 -0
  87. package/src/common/utils/index.tsx +58 -0
  88. package/src/data/local/index.tsx +23 -0
  89. package/src/data/remote/index.tsx +80 -0
  90. package/src/data/static/index.tsx +28 -0
  91. package/src/index.tsx +11 -0
  92. package/src/native/component/WebView.tsx +10 -0
  93. package/src/native/module/index.tsx +18 -0
  94. package/src/presentation/component/AppChatComponent.tsx +154 -0
  95. package/src/presentation/initialization/index.tsx +149 -0
  96. package/src/presentation/notification/index.tsx +45 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Shalahudin Ayyub
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,235 @@
1
+ # react-native-mobile-chat
2
+
3
+ React Native Mobile Chat help you to manage customer relationship with customer conversation feature inside your react native app.
4
+
5
+ ## Installation
6
+
7
+ ### 1. Pre-installation
8
+
9
+ a. Your app using Firebase Cloud Messaging
10
+
11
+ b. You have created mobile chat channel integration in [mobile chat integration page](https://chat.qontak.com/integrations/mobilechat) and make sure you have done on the following step
12
+ - Add package name or bundle id of your app
13
+ - Fill server key form from your console firebase (Project settings -> Cloud Messaging -> Cloud Messaging API (Legacy) -> Token)
14
+
15
+ ### 2. Install dependency
16
+ This package have dependency with [React Native WebView](https://github.com/react-native-webview/react-native-webview), so you have to install it first by command line below, skip this step if you have already installed (listed on package.json dependenies)
17
+
18
+ ```sh
19
+ npm install --save react-native-webview
20
+ ```
21
+
22
+ ### 3. Install React Native Mobile Chat
23
+ ```sh
24
+ npm install --save react-native-mobile-chat
25
+ ```
26
+
27
+ ### 4. Add permissions
28
+ #### Info.plist in iOS project
29
+ Add ``NSMicrophoneUsageDescription`` and ``NSCameraUsageDescription`` to Info.plist file
30
+
31
+ #### AndroidManifest.xml in Android project
32
+ Add permission below
33
+ ```xml
34
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
35
+ <uses-permission android:name="android.permission.INTERNET" />
36
+ <uses-permission android:name="android.permission.CAMERA" />
37
+ ```
38
+
39
+
40
+
41
+ ## Usage
42
+
43
+ ### Initialization
44
+ Implement this initialization function as early as possible in your app
45
+ ```js
46
+ initMobileChat(
47
+ appId: string,
48
+ clientId: string,
49
+ clientSecret: string,
50
+ externalId: string,
51
+ fullName: string
52
+ ) : string
53
+ ```
54
+ Parameter ``appId``, ``clientId``, ``clientSecret`` can be found in integration page. Parameter``externalId`` is your customer unique identifier and ``fullName`` is your customer full name "Subagya Irianto".
55
+
56
+ Example initialization with customer unique id "MY_EXT_ID" and customer full name
57
+ ```js
58
+
59
+ //...
60
+ import { initMobileChat } from 'react-native-mobile-chat';
61
+ import {APP_ID, CLIENT_ID, CLIENT_SECRET} from '../your-constant-directory'
62
+
63
+ class RootApp extends Component {
64
+ componentDidMount() {
65
+ //...
66
+
67
+ initMobileChat(
68
+ APP_ID,
69
+ CLIENT_ID,
70
+ CLIENT_SECRET,
71
+ 'MY_EXT_ID',
72
+ 'Subagya Irianto')
73
+
74
+ //...
75
+ }
76
+
77
+ render() {
78
+ //...
79
+ }
80
+ }
81
+ ```
82
+ ### Conversation feature
83
+ ``MobileChatComponent`` used by your customer to make conversation with your agents. This component only have one property to implement, ``onBackButtonTapped``.
84
+
85
+ ```js
86
+ <MobileChatComponent onBackButtonTapped={ //Your back button function } />
87
+ ```
88
+ Example implementation using [React Navigation](https://reactnavigation.org/) :
89
+
90
+ ```js
91
+
92
+ //...
93
+ import { MobileChatComponent } from 'react-native-mobile-chat';
94
+ import { createNativeStackNavigator } from '@react-navigation/native-stack';
95
+ import { NavigationContainer } from '@react-navigation/native';
96
+
97
+ const Stack = createNativeStackNavigator();
98
+
99
+ class HomePage extends Component {
100
+ //..
101
+ render() {
102
+ return (
103
+ //..
104
+ <View>
105
+ <Button title='OPEN Mobile Chat' onPress={() => this.props.navigation.navigate('CustomerCarePage')} />
106
+ </View>
107
+ //..
108
+ )
109
+ }
110
+ }
111
+
112
+ class CustomerCarePage extends Component {
113
+ render() {
114
+ return (
115
+ <View style={{ flexDirection: 'column', flex: 1 }}>
116
+ <MobileChatComponent onBackButtonTapped={() => this.props.navigation.goBack() } />
117
+ </View>
118
+ )
119
+ }
120
+ }
121
+
122
+ class RootApp extends Component {
123
+ //...
124
+
125
+ render() {
126
+ return (
127
+ <NavigationContainer>
128
+ <Stack.Navigator>
129
+ <Stack.Group screenOptions={{ orientation: 'portrait' }}>
130
+ <Stack.Screen key={"HomePage"} name={"HomePage"} component={HomePage} } />
131
+ <Stack.Screen key={"CustomerCarePage"} name={"CustomerCarePage"} component={CustomerCarePage} } />
132
+ //...
133
+ </Stack.Group>
134
+ </Stack.Navigator>
135
+ </NavigationContainer>
136
+ )
137
+ }
138
+ }
139
+ ```
140
+
141
+ ### Notification feature
142
+ Register your customer fcm token to mobile chat server to get notification from agent
143
+
144
+ ```js
145
+ registerMobileChatNotification(fcmToken: string) : string
146
+ ```
147
+
148
+ To distinct mobile chat payload and your own payload, use this function
149
+
150
+ ```js
151
+ isMobileChatPayload() : boolean
152
+ ```
153
+
154
+ To get state of mobile chat component is opened or not
155
+
156
+ ```js
157
+ isMobileChatOpened() : boolean
158
+ ```
159
+
160
+ To stop getting notification, implement function below. This can be used when your customer logout from your app.
161
+ ```js
162
+ revokeNotification() : string
163
+ ```
164
+
165
+ Example implementation of notification feature using [React Native Firebase](https://rnfirebase.io/) :
166
+ ```js
167
+
168
+ //...
169
+ import messaging from '@react-native-firebase/messaging'
170
+ import { isMobileChatOpened, isMobileChatPayload, registerMobileChatNotification } from 'react-native-mobile-chat';
171
+
172
+ class RootApp extends Component {
173
+
174
+ //Register user fcm token to get notification
175
+ getToken = async () => {
176
+ await messaging().registerDeviceForRemoteMessages();
177
+ const fcmToken = await messaging().getToken();
178
+ registerMobileChatNotification(fcmToken)
179
+ }
180
+
181
+ componentDidMount() {
182
+ //...
183
+
184
+ getToken()
185
+
186
+ //Handle notification in foreground
187
+ //Show alert with option : Dismiss and Open Customer Care
188
+ messaging().onMessage(fgPayload => {
189
+ if (!isMobileChatPayload(payload)) {
190
+ if (!isMobileChatOpened()) {
191
+ Alert.alert('Foreground notif',
192
+ `${fgPayload.notification?.title}\n${fgPayload.notification?.body}`, [
193
+ {
194
+ text: 'Dismiss',
195
+ onPress: () => console.log('Dismiss Pressed'),
196
+ style: 'cancel',
197
+ },
198
+ { text: 'Open Customer Care', onPress: () => this.props.navigation.navigate('CustomerCarePage') },
199
+ ]);
200
+ }
201
+ }
202
+ })
203
+
204
+ //Handle notification in background tapped (app isn't killed)
205
+ //When notification tapped -> automatically open CustomerCarePage
206
+ messaging().onNotificationOpenedApp(payload => {
207
+ if (isMobileChatPayload(payload)) {
208
+ this.props.navigation.navigate('CustomerCarePage')
209
+ }
210
+ })
211
+
212
+ //Handle notification in background tapped (app killed)
213
+ //When notification tapped -> automatically open CustomerCarePage
214
+ messaging().getInitialNotification().then(payload => {
215
+ if (payload == null) return
216
+ if (isMobileChatPayload(payload)) {
217
+ this.props.navigation.navigate('CustomerCarePage')
218
+ }
219
+ })
220
+ //...
221
+ }
222
+
223
+ render() {
224
+ //...
225
+ }
226
+ }
227
+ ```
228
+
229
+ ## License
230
+
231
+ MIT
232
+
233
+ ---
234
+
235
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,77 @@
1
+ buildscript {
2
+ repositories {
3
+ google()
4
+ mavenCentral()
5
+ }
6
+
7
+ dependencies {
8
+ classpath "com.android.tools.build:gradle:7.2.1"
9
+ }
10
+ }
11
+
12
+ def isNewArchitectureEnabled() {
13
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
14
+ }
15
+
16
+ apply plugin: "com.android.library"
17
+
18
+
19
+ def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
20
+
21
+ if (isNewArchitectureEnabled()) {
22
+ apply plugin: "com.facebook.react"
23
+ }
24
+
25
+ def getExtOrDefault(name) {
26
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["AppChat_" + name]
27
+ }
28
+
29
+ def getExtOrIntegerDefault(name) {
30
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["AppChat_" + name]).toInteger()
31
+ }
32
+
33
+ android {
34
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
35
+
36
+ defaultConfig {
37
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
38
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
39
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
40
+ }
41
+ buildTypes {
42
+ release {
43
+ minifyEnabled false
44
+ }
45
+ }
46
+
47
+ lintOptions {
48
+ disable "GradleCompatible"
49
+ }
50
+
51
+ compileOptions {
52
+ sourceCompatibility JavaVersion.VERSION_1_8
53
+ targetCompatibility JavaVersion.VERSION_1_8
54
+ }
55
+
56
+ }
57
+
58
+ repositories {
59
+ mavenCentral()
60
+ google()
61
+ }
62
+
63
+
64
+ dependencies {
65
+ // For < 0.71, this will be from the local maven repo
66
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
67
+ //noinspection GradleDynamicVersion
68
+ implementation "com.facebook.react:react-native:+"
69
+ }
70
+
71
+ if (isNewArchitectureEnabled()) {
72
+ react {
73
+ jsRootDir = file("../src/")
74
+ libraryName = "AppChat"
75
+ codegenJavaPackageName = "com.appchat"
76
+ }
77
+ }
@@ -0,0 +1,5 @@
1
+ AppChat_kotlinVersion=1.7.0
2
+ AppChat_minSdkVersion=21
3
+ AppChat_targetSdkVersion=31
4
+ AppChat_compileSdkVersion=31
5
+ AppChat_ndkversion=21.4.7075529
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.appchat">
3
+
4
+ </manifest>
@@ -0,0 +1,58 @@
1
+ package com.appchat;
2
+
3
+ import android.content.Context;
4
+ import android.content.SharedPreferences;
5
+ import android.util.Log;
6
+
7
+ import androidx.annotation.NonNull;
8
+
9
+ import com.facebook.react.bridge.Promise;
10
+ import com.facebook.react.bridge.ReactApplicationContext;
11
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
12
+ import com.facebook.react.bridge.ReactMethod;
13
+ import com.facebook.react.module.annotations.ReactModule;
14
+
15
+ @ReactModule(name = AppChatModule.NAME)
16
+ public class AppChatModule extends ReactContextBaseJavaModule {
17
+ public static final String NAME = "AppChat";
18
+
19
+ public AppChatModule(ReactApplicationContext reactContext) {
20
+ super(reactContext);
21
+ }
22
+
23
+ @Override
24
+ @NonNull
25
+ public String getName() {
26
+ return NAME;
27
+ }
28
+
29
+ @ReactMethod
30
+ public void putString(String key, String value, Promise promise) {
31
+ try {
32
+ SharedPreferences sharedPreferences = getReactApplicationContext().getSharedPreferences("qontak-app-chat", Context.MODE_PRIVATE);
33
+ sharedPreferences.edit().putString(key, value).apply();
34
+ promise.resolve("Success");
35
+ } catch (Exception e){
36
+ promise.reject("Error",e);
37
+ }
38
+ }
39
+
40
+ @ReactMethod
41
+ public void getString(String key, Promise promise) {
42
+ try {
43
+ SharedPreferences sharedPreferences = getReactApplicationContext().getSharedPreferences("qontak-app-chat", Context.MODE_PRIVATE);
44
+ promise.resolve(sharedPreferences.getString(key, "default_value"));
45
+ } catch (Exception e) {
46
+ promise.reject("Error", e);
47
+ }
48
+ }
49
+
50
+ @ReactMethod
51
+ public void getBundleIdOrPackageName(Promise promise) {
52
+ try {
53
+ promise.resolve(getReactApplicationContext().getPackageName());
54
+ } catch (Exception e) {
55
+ promise.reject("Error", e);
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,28 @@
1
+ package com.appchat;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class AppChatPackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ modules.add(new AppChatModule(reactContext));
20
+ return modules;
21
+ }
22
+
23
+ @NonNull
24
+ @Override
25
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
package/ios/AppChat.h ADDED
@@ -0,0 +1,12 @@
1
+
2
+ #ifdef RCT_NEW_ARCH_ENABLED
3
+ #import "RNAppChatSpec.h"
4
+
5
+ @interface AppChat : NSObject <NativeAppChatSpec>
6
+ #else
7
+ #import <React/RCTBridgeModule.h>
8
+
9
+ @interface AppChat : NSObject <RCTBridgeModule>
10
+ #endif
11
+
12
+ @end
package/ios/AppChat.mm ADDED
@@ -0,0 +1,67 @@
1
+ #import "AppChat.h"
2
+
3
+ @implementation AppChat
4
+ RCT_EXPORT_MODULE()
5
+
6
+ RCT_REMAP_METHOD(putString,
7
+ withKey:(NSString*)key withValue:(NSString*)value
8
+ withResolver:(RCTPromiseResolveBlock)resolve
9
+ withRejecter:(RCTPromiseRejectBlock)reject)
10
+ {
11
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
12
+ [preferences setObject:value forKey:key];
13
+
14
+ // Save to disk
15
+ const BOOL didSave = [preferences synchronize];
16
+
17
+ if (!didSave)
18
+ {
19
+ NSError* error;
20
+ reject(@"Error",@"Failed to save",error);
21
+ }
22
+ resolve(@"Success");
23
+ }
24
+
25
+ RCT_REMAP_METHOD(getString,
26
+ withKey:(NSString*)key
27
+ withResolver:(RCTPromiseResolveBlock)resolve
28
+ withRejecter:(RCTPromiseRejectBlock)reject)
29
+ {
30
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
31
+ if ([preferences objectForKey:key] == nil)
32
+ {
33
+ NSError* error;
34
+ reject(@"Error",@"Failed to get item",error);
35
+ }
36
+ else
37
+ {
38
+ resolve([preferences stringForKey:key]);
39
+ }
40
+ }
41
+
42
+ RCT_REMAP_METHOD(getBundleIdOrPackageName,
43
+ withResolver:(RCTPromiseResolveBlock)resolve
44
+ withRejecter:(RCTPromiseRejectBlock)reject)
45
+ {
46
+ NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
47
+ if (bundleIdentifier == nil)
48
+ {
49
+ NSError* error;
50
+ reject(@"Error",@"Failed to get bundle id",error);
51
+ }
52
+ else
53
+ {
54
+ resolve(bundleIdentifier);
55
+ }
56
+ }
57
+
58
+ // Don't compile this code when we build for the old architecture.
59
+ #ifdef RCT_NEW_ARCH_ENABLED
60
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
61
+ (const facebook::react::ObjCTurboModule::InitParams &)params
62
+ {
63
+ return std::make_shared<facebook::react::NativeAppChatSpecJSI>(params);
64
+ }
65
+ #endif
66
+
67
+ @end