infobip-mobile-messaging-react-native-plugin 8.4.0 → 9.0.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 +1 -1
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/Configuration.java +24 -14
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/RNMMChatModule.java +5 -1
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/RNMMWebRTCUI.java +56 -13
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ReactNativeMobileMessagingModule.java +6 -0
- package/infobip-mobile-messaging-react-native-plugin-8.4.0.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.podspec +4 -4
- package/ios/MobileMessagingPlugin/RNMMWebRTCUI.swift +37 -7
- package/ios/MobileMessagingPlugin/RNMMWebRTCUIBridge.m +2 -1
- package/ios/MobileMessagingPlugin/RNMobileMessaging.swift +3 -1
- package/ios/MobileMessagingPlugin/RNMobileMessagingConfiguration.swift +1 -1
- package/ios/MobileMessagingPlugin/RNMobileMessagingUtils.swift +2 -1
- package/package.json +1 -1
- package/src/index.d.ts +34 -17
- package/src/index.js +22 -5
- package/infobip-mobile-messaging-react-native-plugin-8.3.0.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
<!-- /Mobile Messaging permissions -->
|
|
20
20
|
|
|
21
21
|
<!-- Infobip rtc ui permissions -->
|
|
22
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
22
23
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
23
24
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
24
25
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
@@ -42,41 +42,51 @@ class Configuration {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
class InAppChatCustomization {
|
|
45
|
+
//common
|
|
45
46
|
String toolbarTitle;
|
|
46
|
-
String toolbarTintColor;
|
|
47
|
-
String toolbarBackgroundColor;
|
|
48
47
|
String toolbarTitleColor;
|
|
48
|
+
String toolbarBackgroundColor;
|
|
49
49
|
String chatBackgroundColor;
|
|
50
50
|
String noConnectionAlertTextColor;
|
|
51
51
|
String noConnectionAlertBackgroundColor;
|
|
52
52
|
String chatInputPlaceholderTextColor;
|
|
53
53
|
String chatInputCursorColor;
|
|
54
|
+
String chatInputBackgroundColor;
|
|
54
55
|
String sendButtonIconUri;
|
|
55
56
|
String attachmentButtonIconUri;
|
|
56
57
|
boolean chatInputSeparatorVisible;
|
|
58
|
+
//android only
|
|
59
|
+
//status bar properties
|
|
60
|
+
boolean statusBarColorLight;
|
|
61
|
+
String statusBarBackgroundColor;
|
|
62
|
+
//toolbar properties
|
|
63
|
+
String navigationIconUri;
|
|
57
64
|
String navigationIconTint;
|
|
65
|
+
String subtitleText;
|
|
58
66
|
String subtitleTextColor;
|
|
59
|
-
String
|
|
67
|
+
String subtitleTextAppearanceRes;
|
|
68
|
+
boolean subtitleCentered;
|
|
69
|
+
String titleTextAppearanceRes;
|
|
70
|
+
boolean titleCentered;
|
|
71
|
+
//chat properties
|
|
60
72
|
String progressBarColor;
|
|
73
|
+
String networkConnectionErrorTextAppearanceRes;
|
|
74
|
+
String networkConnectionErrorText;
|
|
75
|
+
//chat input properties
|
|
76
|
+
String inputTextColor;
|
|
61
77
|
String inputAttachmentIconTint;
|
|
78
|
+
String inputAttachmentBackgroundColor;
|
|
79
|
+
String inputAttachmentBackgroundDrawable;
|
|
62
80
|
String inputSendIconTint;
|
|
81
|
+
String inputSendBackgroundColor;
|
|
82
|
+
String inputSendBackgroundDrawable;
|
|
63
83
|
String inputSeparatorLineColor;
|
|
64
84
|
String inputHintText;
|
|
65
|
-
String subtitleText;
|
|
66
|
-
String subtitleTextAppearanceRes;
|
|
67
|
-
boolean subtitleCentered;
|
|
68
|
-
boolean titleCentered;
|
|
69
85
|
String inputTextAppearance;
|
|
70
|
-
String networkConnectionErrorTextAppearanceRes;
|
|
71
|
-
String networkConnectionErrorText;
|
|
72
|
-
String navigationIconUri;
|
|
73
|
-
boolean statusBarColorLight;
|
|
74
|
-
String titleTextAppearanceRes;
|
|
75
|
-
String statusBarBackgroundColor;
|
|
76
86
|
}
|
|
77
87
|
|
|
78
88
|
class WebRTCUI {
|
|
79
|
-
String
|
|
89
|
+
String configurationId;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
AndroidConfiguration android;
|
|
@@ -184,14 +184,18 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
184
184
|
new InAppChatInputViewStyle(
|
|
185
185
|
getResId(reactContext.getResources(), customisation.inputTextAppearance, reactContext.getPackageName()),
|
|
186
186
|
Color.parseColor(customisation.inputTextColor),
|
|
187
|
-
Color.parseColor(customisation.
|
|
187
|
+
Color.parseColor(customisation.chatInputBackgroundColor),
|
|
188
188
|
customisation.inputHintText,
|
|
189
189
|
null,
|
|
190
190
|
Color.parseColor(customisation.chatInputPlaceholderTextColor),
|
|
191
191
|
loadDrawable(customisation.attachmentButtonIconUri),
|
|
192
192
|
ColorStateList.valueOf(Color.parseColor(customisation.inputAttachmentIconTint)),
|
|
193
|
+
loadDrawable(customisation.inputAttachmentBackgroundDrawable),
|
|
194
|
+
Color.parseColor(customisation.inputAttachmentBackgroundColor),
|
|
193
195
|
loadDrawable(customisation.sendButtonIconUri),
|
|
194
196
|
ColorStateList.valueOf(Color.parseColor(customisation.inputSendIconTint)),
|
|
197
|
+
loadDrawable(customisation.inputSendBackgroundDrawable),
|
|
198
|
+
Color.parseColor(customisation.inputSendBackgroundColor),
|
|
195
199
|
Color.parseColor(customisation.inputSeparatorLineColor),
|
|
196
200
|
customisation.chatInputSeparatorVisible,
|
|
197
201
|
Color.parseColor(customisation.chatInputCursorColor)
|
|
@@ -9,7 +9,8 @@ import com.facebook.react.bridge.Callback;
|
|
|
9
9
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
10
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
11
|
import com.facebook.react.bridge.ReactMethod;
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
import org.infobip.mobile.messaging.util.StringUtils;
|
|
13
14
|
|
|
14
15
|
import java.lang.reflect.Proxy;
|
|
15
16
|
|
|
@@ -18,6 +19,7 @@ public class RNMMWebRTCUI extends ReactContextBaseJavaModule {
|
|
|
18
19
|
|
|
19
20
|
private Class<?> successListenerClass = null;
|
|
20
21
|
private Class<?> errorListenerClass = null;
|
|
22
|
+
private Class<?> listenTypeClass = null;
|
|
21
23
|
|
|
22
24
|
public RNMMWebRTCUI(@Nullable ReactApplicationContext reactContext) {
|
|
23
25
|
super(reactContext);
|
|
@@ -30,23 +32,50 @@ public class RNMMWebRTCUI extends ReactContextBaseJavaModule {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
@ReactMethod
|
|
33
|
-
public void
|
|
35
|
+
public void enableChatCalls(final Callback successCallback, final Callback errorCallback) {
|
|
36
|
+
enableCalls(true, null, successCallback, errorCallback);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
public void enableCalls(String identity, final Callback successCallback, final Callback errorCallback) {
|
|
41
|
+
enableCalls(false, identity, successCallback, errorCallback);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private void enableCalls(Boolean enableChatCalls, String identity, final Callback successCallback, final Callback errorCallback) {
|
|
34
45
|
try {
|
|
35
46
|
final Configuration configuration = ConfigCache.getInstance().getConfiguration();
|
|
36
47
|
if (configuration == null) {
|
|
37
48
|
errorCallback.invoke(Utils.callbackError("Mobile messaging not initialized. Please call mobileMessaging.init().", null));
|
|
38
|
-
} else if (configuration.webRTCUI != null && configuration.webRTCUI.
|
|
49
|
+
} else if (configuration.webRTCUI != null && configuration.webRTCUI.configurationId != null) {
|
|
39
50
|
Class<?> rtcUiBuilderClass = Class.forName("com.infobip.webrtc.ui.InfobipRtcUi$Builder");
|
|
51
|
+
Class<?> rtcUiBuilderFinalStepClass = Class.forName("com.infobip.webrtc.ui.InfobipRtcUi$BuilderFinalStep");
|
|
40
52
|
Object rtcUiBuilder = rtcUiBuilderClass.getDeclaredConstructor(Context.class).newInstance(getReactApplicationContext());
|
|
41
53
|
Object successListener = successListenerProxy(successCallback);
|
|
42
|
-
Object errorListener =
|
|
43
|
-
rtcUiBuilderClass.getMethod("
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
Object errorListener = errorListenerProxy(errorCallback);
|
|
55
|
+
rtcUiBuilderClass.getMethod("withConfigurationId", String.class).invoke(rtcUiBuilder, configuration.webRTCUI.configurationId);
|
|
56
|
+
Object rtcUiBuilderFinalStep;
|
|
57
|
+
if (enableChatCalls) {
|
|
58
|
+
rtcUiBuilderFinalStep = rtcUiBuilderClass.getMethod("withInAppChatCalls", getSuccessListenerClass(), getErrorListenerClass()).invoke(
|
|
59
|
+
rtcUiBuilder,
|
|
60
|
+
successListener,
|
|
61
|
+
errorListener
|
|
62
|
+
);
|
|
63
|
+
} else if (!StringUtils.isBlank(identity)) {
|
|
64
|
+
rtcUiBuilderFinalStep = rtcUiBuilderClass.getMethod("withCalls", String.class, getListenTypeClass(), getSuccessListenerClass(), getErrorListenerClass()).invoke(
|
|
65
|
+
rtcUiBuilder,
|
|
66
|
+
identity,
|
|
67
|
+
pushListenType(),
|
|
68
|
+
successListener,
|
|
69
|
+
errorListener
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
rtcUiBuilderFinalStep = rtcUiBuilderClass.getMethod("withCalls", getSuccessListenerClass(), getErrorListenerClass()).invoke(
|
|
73
|
+
rtcUiBuilder,
|
|
74
|
+
successListener,
|
|
75
|
+
errorListener
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
infobipRtcUiInstance = rtcUiBuilderFinalStepClass.getMethod("build").invoke(rtcUiBuilderFinalStep);
|
|
50
79
|
} else {
|
|
51
80
|
errorCallback.invoke(Utils.callbackError("Configuration does not contain webRTCUI data.", null));
|
|
52
81
|
}
|
|
@@ -73,9 +102,16 @@ public class RNMMWebRTCUI extends ReactContextBaseJavaModule {
|
|
|
73
102
|
return errorListenerClass;
|
|
74
103
|
}
|
|
75
104
|
|
|
105
|
+
@NonNull
|
|
106
|
+
private Class<?> getListenTypeClass() throws ClassNotFoundException {
|
|
107
|
+
if (listenTypeClass == null)
|
|
108
|
+
listenTypeClass = Class.forName("com.infobip.webrtc.ui.model.ListenType");
|
|
109
|
+
return listenTypeClass;
|
|
110
|
+
}
|
|
111
|
+
|
|
76
112
|
@SuppressWarnings("SuspiciousInvocationHandlerImplementation")
|
|
77
113
|
@NonNull
|
|
78
|
-
private Object
|
|
114
|
+
private Object errorListenerProxy(Callback errorCallback) throws ClassNotFoundException {
|
|
79
115
|
return Proxy.newProxyInstance(
|
|
80
116
|
getClass().getClassLoader(),
|
|
81
117
|
new Class[]{getErrorListenerClass()},
|
|
@@ -104,6 +140,13 @@ public class RNMMWebRTCUI extends ReactContextBaseJavaModule {
|
|
|
104
140
|
);
|
|
105
141
|
}
|
|
106
142
|
|
|
143
|
+
/** @noinspection rawtypes*/
|
|
144
|
+
@SuppressWarnings("unchecked")
|
|
145
|
+
@NonNull
|
|
146
|
+
private Object pushListenType() throws ClassNotFoundException {
|
|
147
|
+
return Enum.valueOf((Class<? extends Enum>)Class.forName("com.infobip.webrtc.ui.model.ListenType"), "PUSH");
|
|
148
|
+
}
|
|
149
|
+
|
|
107
150
|
@ReactMethod
|
|
108
151
|
public void disableCalls(final Callback successCallback, final Callback errorCallback) {
|
|
109
152
|
if (infobipRtcUiInstance == null) {
|
|
@@ -115,7 +158,7 @@ public class RNMMWebRTCUI extends ReactContextBaseJavaModule {
|
|
|
115
158
|
.invoke(
|
|
116
159
|
infobipRtcUiInstance,
|
|
117
160
|
successListenerProxy(successCallback),
|
|
118
|
-
|
|
161
|
+
errorListenerProxy(errorCallback)
|
|
119
162
|
);
|
|
120
163
|
} catch (ClassNotFoundException e) {
|
|
121
164
|
errorCallback.invoke(Utils.callbackError("Android WebRtcUi not enabled. Please set flag buildscript {ext { withWebRTCUI = true } } in your build.gradle.", null));
|
|
@@ -159,6 +159,8 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
159
159
|
|
|
160
160
|
private static final String EVENT_INAPPCHAT_UNREAD_MESSAGES_COUNT_UPDATED = "inAppChat.unreadMessageCounterUpdated";
|
|
161
161
|
private static final String EVENT_INAPPCHAT_VIEW_STATE_CHANGED = "inAppChat.viewStateChanged";
|
|
162
|
+
private static final String EVENT_INAPPCHAT_CONFIGURATION_SYNCED = "inAppChat.configurationSynced";
|
|
163
|
+
private static final String EVENT_INAPPCHAT_LIVECHAT_REGISTRATION_ID_UPDATED = "inAppChat.livechatRegistrationIdUpdated";
|
|
162
164
|
//endregion
|
|
163
165
|
|
|
164
166
|
//region MessageStorageBroadcastReceiver
|
|
@@ -282,6 +284,8 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
282
284
|
put(Event.DEPERSONALIZED.getKey(), EVENT_DEPERSONALIZED);
|
|
283
285
|
put(GeoEvent.GEOFENCE_AREA_ENTERED.getKey(), EVENT_GEOFENCE_ENTERED);
|
|
284
286
|
put(InAppChatEvent.CHAT_VIEW_CHANGED.getKey(), EVENT_INAPPCHAT_VIEW_STATE_CHANGED);
|
|
287
|
+
put(InAppChatEvent.CHAT_CONFIGURATION_SYNCED.getKey(), EVENT_INAPPCHAT_CONFIGURATION_SYNCED);
|
|
288
|
+
put(InAppChatEvent.LIVECHAT_REGISTRATION_ID_UPDATED.getKey(), EVENT_INAPPCHAT_LIVECHAT_REGISTRATION_ID_UPDATED);
|
|
285
289
|
}};
|
|
286
290
|
|
|
287
291
|
private final BroadcastReceiver commonLibraryBroadcastReceiver = new BroadcastReceiver() {
|
|
@@ -325,6 +329,8 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
325
329
|
data = intent.getStringExtra(BroadcastParameter.EXTRA_INFOBIP_ID);
|
|
326
330
|
} else if (InAppChatEvent.CHAT_VIEW_CHANGED.getKey().equals(intent.getAction())) {
|
|
327
331
|
data = intent.getStringExtra(BroadcastParameter.EXTRA_CHAT_VIEW);
|
|
332
|
+
} else if (InAppChatEvent.LIVECHAT_REGISTRATION_ID_UPDATED.getKey().equals(intent.getAction())) {
|
|
333
|
+
data = intent.getStringExtra(BroadcastParameter.EXTRA_LIVECHAT_REGISTRATION_ID);
|
|
328
334
|
}
|
|
329
335
|
|
|
330
336
|
if (data == null) {
|
|
Binary file
|
|
@@ -19,10 +19,10 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.requires_arc = true
|
|
20
20
|
|
|
21
21
|
s.dependency "React-Core"
|
|
22
|
-
s.dependency "MobileMessaging/Core", "
|
|
23
|
-
s.dependency "MobileMessaging/Geofencing", "
|
|
24
|
-
s.dependency "MobileMessaging/InAppChat", "
|
|
22
|
+
s.dependency "MobileMessaging/Core", "12.0.0"
|
|
23
|
+
s.dependency "MobileMessaging/Geofencing", "12.0.0"
|
|
24
|
+
s.dependency "MobileMessaging/InAppChat", "12.0.0"
|
|
25
25
|
if defined?($WebRTCUIEnabled)
|
|
26
|
-
s.dependency "MobileMessaging/WebRTCUI", "
|
|
26
|
+
s.dependency "MobileMessaging/WebRTCUI", "12.0.0"
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -11,14 +11,18 @@ import MobileMessaging
|
|
|
11
11
|
@objc(RNMMWebRTCUI)
|
|
12
12
|
class RNMMWebRTCUI: NSObject {
|
|
13
13
|
|
|
14
|
-
@objc(enableCalls:onError:)
|
|
15
|
-
func enableCalls(onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
|
|
16
14
|
#if WEBRTCUI_ENABLED
|
|
15
|
+
private func handleCalls(
|
|
16
|
+
_ identity: MMWebRTCIdentityMode,
|
|
17
|
+
onSuccess: @escaping RCTResponseSenderBlock,
|
|
18
|
+
onError: @escaping RCTResponseSenderBlock)
|
|
19
|
+
{
|
|
17
20
|
if let cachedConfigDict = RNMobileMessagingConfiguration.getRawConfigFromDefaults(),
|
|
18
21
|
let configuration = RNMobileMessagingConfiguration(rawConfig: cachedConfigDict),
|
|
19
22
|
let webRTCUI = configuration.webRTCUI,
|
|
20
|
-
let webRTCId = webRTCUI[RNMobileMessagingConfiguration.Keys.
|
|
21
|
-
MobileMessaging.webRTCService?.
|
|
23
|
+
let webRTCId = webRTCUI[RNMobileMessagingConfiguration.Keys.configurationId] as? String {
|
|
24
|
+
MobileMessaging.webRTCService?.configurationId = webRTCId
|
|
25
|
+
MobileMessaging.webRTCService?.identityMode = identity
|
|
22
26
|
MobileMessaging.webRTCService?.start({ result in
|
|
23
27
|
switch result {
|
|
24
28
|
case true:
|
|
@@ -30,10 +34,34 @@ class RNMMWebRTCUI: NSObject {
|
|
|
30
34
|
}
|
|
31
35
|
})
|
|
32
36
|
} else {
|
|
33
|
-
MMLogDebug("[WebRTCUI] WebRTC's
|
|
37
|
+
MMLogDebug("[WebRTCUI] WebRTC's configurationId not defined in the configuration, calls were not enabled.")
|
|
34
38
|
onError([NSError(type: .InvalidArguments).reactNativeObject])
|
|
35
39
|
}
|
|
40
|
+
}
|
|
41
|
+
#endif
|
|
36
42
|
|
|
43
|
+
@objc(enableCalls:onSuccess:onError:)
|
|
44
|
+
func enableCalls(
|
|
45
|
+
identity: String,
|
|
46
|
+
onSuccess: @escaping RCTResponseSenderBlock,
|
|
47
|
+
onError: @escaping RCTResponseSenderBlock)
|
|
48
|
+
{
|
|
49
|
+
#if WEBRTCUI_ENABLED
|
|
50
|
+
let identityMode: MMWebRTCIdentityMode = identity.isEmpty ? .default : .custom(identity)
|
|
51
|
+
handleCalls(identityMode, onSuccess: onSuccess, onError: onError)
|
|
52
|
+
#else
|
|
53
|
+
MMLogDebug("[WebRTCUI] Not imported properly in podfile: library cannot be used.")
|
|
54
|
+
onError([NSError(type: .NotSupported).reactNativeObject])
|
|
55
|
+
#endif
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@objc(enableChatCalls:onError:)
|
|
59
|
+
func enableChatCalls(
|
|
60
|
+
onSuccess: @escaping RCTResponseSenderBlock,
|
|
61
|
+
onError: @escaping RCTResponseSenderBlock)
|
|
62
|
+
{
|
|
63
|
+
#if WEBRTCUI_ENABLED
|
|
64
|
+
handleCalls(.inAppChat, onSuccess: onSuccess, onError: onError)
|
|
37
65
|
#else
|
|
38
66
|
MMLogDebug("[WebRTCUI] Not imported properly in podfile: library cannot be used.")
|
|
39
67
|
onError([NSError(type: .NotSupported).reactNativeObject])
|
|
@@ -41,7 +69,10 @@ class RNMMWebRTCUI: NSObject {
|
|
|
41
69
|
}
|
|
42
70
|
|
|
43
71
|
@objc(disableCalls:onError:)
|
|
44
|
-
func disableCalls(
|
|
72
|
+
func disableCalls(
|
|
73
|
+
onSuccess: @escaping RCTResponseSenderBlock,
|
|
74
|
+
onError: @escaping RCTResponseSenderBlock)
|
|
75
|
+
{
|
|
45
76
|
#if WEBRTCUI_ENABLED
|
|
46
77
|
MobileMessaging.webRTCService?.stopService({ result in
|
|
47
78
|
switch result {
|
|
@@ -58,5 +89,4 @@ class RNMMWebRTCUI: NSObject {
|
|
|
58
89
|
onError([NSError(type: .NotSupported).reactNativeObject])
|
|
59
90
|
#endif
|
|
60
91
|
}
|
|
61
|
-
|
|
62
92
|
}
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
@implementation RNMMWebRTCUI (RCTExternModule)
|
|
18
18
|
RCT_EXPORT_MODULE_NO_LOAD(RNMMWebRTCUI, RNMMWebRTCUI)
|
|
19
|
-
RCT_EXTERN_METHOD(enableCalls:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
19
|
+
RCT_EXTERN_METHOD(enableCalls:(NSString *)identity onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
20
|
+
RCT_EXTERN_METHOD(enableChatCalls:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
20
21
|
RCT_EXTERN_METHOD(disableCalls:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
21
22
|
|
|
22
23
|
|
|
@@ -38,7 +38,9 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
38
38
|
EventName.messageStorage_findAll,
|
|
39
39
|
EventName.inAppChat_availabilityUpdated,
|
|
40
40
|
EventName.inAppChat_unreadMessageCounterUpdated,
|
|
41
|
-
EventName.inAppChat_viewStateChanged
|
|
41
|
+
EventName.inAppChat_viewStateChanged,
|
|
42
|
+
EventName.inAppChat_configurationSynced,
|
|
43
|
+
EventName.inAppChat_registrationIdUpdated
|
|
42
44
|
]
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -20,7 +20,7 @@ class RNMobileMessagingConfiguration {
|
|
|
20
20
|
static let geofencingEnabled = "geofencingEnabled"
|
|
21
21
|
static let applicationCode = "applicationCode"
|
|
22
22
|
static let webRTCUI = "webRTCUI"
|
|
23
|
-
static let
|
|
23
|
+
static let configurationId = "configurationId"
|
|
24
24
|
static let logging = "logging"
|
|
25
25
|
static let defaultMessageStorage = "defaultMessageStorage"
|
|
26
26
|
static let notificationTypes = "notificationTypes"
|
|
@@ -118,7 +118,8 @@ struct EventName {
|
|
|
118
118
|
static let inAppChat_availabilityUpdated = "inAppChat.availabilityUpdated"
|
|
119
119
|
static let inAppChat_unreadMessageCounterUpdated = "inAppChat.unreadMessageCounterUpdated"
|
|
120
120
|
static let inAppChat_viewStateChanged = "inAppChat.viewStateChanged"
|
|
121
|
-
|
|
121
|
+
static let inAppChat_configurationSynced = "inAppChat.configurationSynced"
|
|
122
|
+
static let inAppChat_registrationIdUpdated = "inAppChat.livechatRegistrationIdUpdated"
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
extension UIApplication {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infobip-mobile-messaging-react-native-plugin",
|
|
3
3
|
"title": "Infobip Mobile Messaging React Native Plugin",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.0",
|
|
5
5
|
"description": "Infobip Mobile Messaging React Native Plugin",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"scripts": {
|
package/src/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare namespace MobileMessagingReactNative {
|
|
|
24
24
|
*/
|
|
25
25
|
applicationCode: string;
|
|
26
26
|
webRTCUI?: {
|
|
27
|
-
|
|
27
|
+
configurationId: string;
|
|
28
28
|
} | undefined;
|
|
29
29
|
geofencingEnabled?: boolean | undefined;
|
|
30
30
|
inAppChatEnabled?: boolean | undefined;
|
|
@@ -222,7 +222,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
222
222
|
|
|
223
223
|
export interface ChatCustomizationConfiguration {
|
|
224
224
|
toolbarTitle: string;
|
|
225
|
-
|
|
226
225
|
toolbarTintColor: string;
|
|
227
226
|
toolbarBackgroundColor: string;
|
|
228
227
|
toolbarTitleColor: string;
|
|
@@ -231,10 +230,9 @@ declare namespace MobileMessagingReactNative {
|
|
|
231
230
|
noConnectionAlertBackgroundColor: string;
|
|
232
231
|
chatInputPlaceholderTextColor: string;
|
|
233
232
|
chatInputCursorColor: string;
|
|
234
|
-
|
|
233
|
+
chatInputBackgroundColor: string;
|
|
235
234
|
sendButtonIconUri: string;
|
|
236
235
|
attachmentButtonIconUri: string;
|
|
237
|
-
|
|
238
236
|
chatInputSeparatorVisible: boolean;
|
|
239
237
|
// iOS only properties
|
|
240
238
|
attachmentPreviewBarsColor: string;
|
|
@@ -254,25 +252,33 @@ declare namespace MobileMessagingReactNative {
|
|
|
254
252
|
mainFont: string;
|
|
255
253
|
charCountFont: string;
|
|
256
254
|
//android only properties
|
|
255
|
+
//status bar properties
|
|
256
|
+
statusBarColorLight: boolean;
|
|
257
|
+
statusBarBackgroundColor: string;
|
|
258
|
+
//toolbar properties
|
|
259
|
+
navigationIconUri: string;
|
|
257
260
|
navigationIconTint: string;
|
|
261
|
+
subtitleText: string;
|
|
258
262
|
subtitleTextColor: string;
|
|
259
|
-
|
|
263
|
+
subtitleTextAppearanceRes: string;
|
|
264
|
+
subtitleCentered: boolean;
|
|
265
|
+
titleTextAppearanceRes: string;
|
|
266
|
+
titleCentered: boolean;
|
|
267
|
+
//chat properties
|
|
260
268
|
progressBarColor: string;
|
|
269
|
+
networkConnectionErrorTextAppearanceRes: string;
|
|
270
|
+
networkConnectionErrorText: string;
|
|
271
|
+
//chat input properties
|
|
272
|
+
inputTextColor: string;
|
|
261
273
|
inputAttachmentIconTint: string;
|
|
274
|
+
inputAttachmentBackgroundColor: string;
|
|
275
|
+
inputAttachmentBackgroundDrawable: string;
|
|
262
276
|
inputSendIconTint: string;
|
|
277
|
+
inputSendBackgroundColor: string;
|
|
278
|
+
inputSendBackgroundDrawable: string;
|
|
263
279
|
inputSeparatorLineColor: string;
|
|
264
280
|
inputHintText: string;
|
|
265
|
-
subtitleText: string;
|
|
266
|
-
subtitleTextAppearanceRes: string;
|
|
267
|
-
subtitleCentered: boolean;
|
|
268
|
-
titleCentered: boolean;
|
|
269
281
|
inputTextAppearance: string;
|
|
270
|
-
networkConnectionErrorTextAppearanceRes: string;
|
|
271
|
-
networkConnectionErrorText: string;
|
|
272
|
-
navigationIconUri: string;
|
|
273
|
-
statusBarColorLight: boolean;
|
|
274
|
-
titleTextAppearanceRes: string;
|
|
275
|
-
statusBarBackgroundColor: string;
|
|
276
282
|
}
|
|
277
283
|
|
|
278
284
|
interface Api {
|
|
@@ -280,7 +286,9 @@ declare namespace MobileMessagingReactNative {
|
|
|
280
286
|
inAppChatEvents: [
|
|
281
287
|
"inAppChat.availabilityUpdated",
|
|
282
288
|
"inAppChat.unreadMessageCounterUpdated",
|
|
283
|
-
"inAppChat.viewStateChanged"
|
|
289
|
+
"inAppChat.viewStateChanged",
|
|
290
|
+
"inAppChat.configurationSynced",
|
|
291
|
+
"inAppChat.livechatRegistrationIdUpdated"
|
|
284
292
|
];
|
|
285
293
|
|
|
286
294
|
supportedEvents: [
|
|
@@ -609,10 +617,19 @@ declare namespace WebRTCUI {
|
|
|
609
617
|
/**
|
|
610
618
|
* Manually enable WebRTCUI calls.
|
|
611
619
|
* @name enableCalls
|
|
620
|
+
* @param identity String to be used as identity for the WebRTC registration. If left empty, push registration Id will be used instead
|
|
621
|
+
* @param {Function} onSuccess success callback
|
|
622
|
+
* @param {Function} onError error callback
|
|
623
|
+
*/
|
|
624
|
+
enableCalls(identity: string, onSuccess: () => void, onError: (error: MobileMessagingError) => void): void;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Manually enable WebRTCUI LiveChat calls.
|
|
628
|
+
* @name enableChatCalls
|
|
612
629
|
* @param {Function} onSuccess success callback
|
|
613
630
|
* @param {Function} onError error callback
|
|
614
631
|
*/
|
|
615
|
-
|
|
632
|
+
enableChatCalls(onSuccess: () => void, onError: (error: MobileMessagingError) => void): void;
|
|
616
633
|
|
|
617
634
|
/**
|
|
618
635
|
* Manually disable WebRTCUI calls if they were previously enabled. Note: This action may need up to half a minute to be completed,
|
package/src/index.js
CHANGED
|
@@ -40,7 +40,9 @@ class MobileMessaging {
|
|
|
40
40
|
this.inAppChatEvents = [
|
|
41
41
|
'inAppChat.availabilityUpdated',
|
|
42
42
|
'inAppChat.unreadMessageCounterUpdated',
|
|
43
|
-
'inAppChat.viewStateChanged'
|
|
43
|
+
'inAppChat.viewStateChanged',
|
|
44
|
+
'inAppChat.configurationSynced',
|
|
45
|
+
'inAppChat.livechatRegistrationIdUpdated'
|
|
44
46
|
];
|
|
45
47
|
this.eventEmitter = new NativeEventEmitter(ReactNativeMobileMessaging);
|
|
46
48
|
}
|
|
@@ -98,6 +100,8 @@ class MobileMessaging {
|
|
|
98
100
|
* - inAppChat.availabilityUpdated
|
|
99
101
|
* - inAppChat.unreadMessageCounterUpdated
|
|
100
102
|
* - inAppChat.viewStateChanged
|
|
103
|
+
* - inAppChat.configurationSynced
|
|
104
|
+
* - inAppChat.livechatRegistrationIdUpdated'
|
|
101
105
|
*
|
|
102
106
|
* @name subscribe
|
|
103
107
|
* @param {String} eventName
|
|
@@ -137,7 +141,7 @@ class MobileMessaging {
|
|
|
137
141
|
* {
|
|
138
142
|
* applicationCode: '<The application code of your Application from Push Portal website>',
|
|
139
143
|
* webRTCUI: {
|
|
140
|
-
*
|
|
144
|
+
* configurationId: <String>
|
|
141
145
|
* },
|
|
142
146
|
* geofencingEnabled: true,
|
|
143
147
|
* messageStorage: '<Message storage save callback>',
|
|
@@ -728,15 +732,28 @@ export const mobileMessaging = new MobileMessaging();
|
|
|
728
732
|
|
|
729
733
|
class WebRTCUI {
|
|
730
734
|
/**
|
|
731
|
-
* Manually enable WebRTCUI calls, provided a valid
|
|
735
|
+
* Manually enable WebRTCUI calls, provided a valid configuration Id exists in the webRTCUI configuration. This function is used to control when to start
|
|
732
736
|
* calls, for example if you want to enabled it only after a successful user authentication. Note: Device settings, such as "Do not disturb" modes, will
|
|
733
737
|
* ignore this method until the operating system allows calls.
|
|
734
738
|
* @name enableCalls
|
|
739
|
+
* @param identity String value to use as identity in the registration for WebRTC calls. If empty string is set, push registration Id will be used
|
|
735
740
|
* @param {Function} onSuccess success callback
|
|
736
741
|
* @param {Function} onError error callback
|
|
737
742
|
*/
|
|
738
|
-
enableCalls(onSuccess = function() {}, onError = function() {}){
|
|
739
|
-
RNMMWebRTCUI.enableCalls(onSuccess, onError);
|
|
743
|
+
enableCalls(identity, onSuccess = function() {}, onError = function() {}){
|
|
744
|
+
RNMMWebRTCUI.enableCalls(identity, onSuccess, onError);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Manually enable WebRTCUI calls, provided a valid configuration Id exists in the webRTCUI configuration. This function is used to control when to start
|
|
749
|
+
* calls, for example if you want to enabled it only after a successful user authentication. Note: Device settings, such as "Do not disturb" modes, will
|
|
750
|
+
* ignore this method until the operating system allows calls.
|
|
751
|
+
* @name enableChatCalls
|
|
752
|
+
* @param {Function} onSuccess success callback
|
|
753
|
+
* @param {Function} onError error callback
|
|
754
|
+
*/
|
|
755
|
+
enableChatCalls(onSuccess = function() {}, onError = function() {}){
|
|
756
|
+
RNMMWebRTCUI.enableChatCalls(onSuccess, onError);
|
|
740
757
|
}
|
|
741
758
|
|
|
742
759
|
/**
|
|
Binary file
|