cordova-plugin-ymchat 2.3.2 → 2.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-ymchat",
3
- "version": "2.3.2",
3
+ "version": "2.5.0",
4
4
  "description": "Cordova plugin to integrate yellow.ai chatbot",
5
5
  "cordova": {
6
6
  "id": "cordova-plugin-ymchat",
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-ymchat" version="2.3.2"
2
+ <plugin id="cordova-plugin-ymchat" version="2.5.0"
3
3
  xmlns="http://apache.org/cordova/ns/plugins/1.0"
4
4
  xmlns:android="http://schemas.android.com/apk/res/android">
5
5
  <name>ymchat</name>
@@ -34,7 +34,7 @@
34
34
  <source url="https://github.com/CocoaPods/Specs.git" branch="master"/>
35
35
  </config>
36
36
  <pods use-frameworks="true">
37
- <pod name="YMChat" spec="~> 1.9" swift-version="5.0"/>
37
+ <pod name="YMChat" spec="~> 1.11" swift-version="5.0"/>
38
38
  </pods>
39
39
  </podspec>
40
40
  <config-file parent="/*" target="config.xml">
@@ -24,5 +24,5 @@ repositories {
24
24
  dependencies {
25
25
  implementation 'androidx.appcompat:appcompat:1.0.2'
26
26
  implementation 'androidx.annotation:annotation:1.0.2'
27
- implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.3.+'
27
+ implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.5.+'
28
28
  }
@@ -80,6 +80,15 @@ public class YmChatCordova extends CordovaPlugin {
80
80
  case "useLiteVersion":
81
81
  useLiteVersion(args, callbackContext);
82
82
  return true;
83
+ case "reloadBot":
84
+ reloadBot();
85
+ return true;
86
+ case "setMicIconColor":
87
+ setMicIconColor(args, callbackContext);
88
+ return true;
89
+ case "setMicBackgroundColor":
90
+ setMicBackgroundColor(args, callbackContext);
91
+ return true;
83
92
  }
84
93
  return false;
85
94
  }
@@ -147,6 +156,10 @@ public class YmChatCordova extends CordovaPlugin {
147
156
  ymChatService.closeBot();
148
157
  }
149
158
 
159
+ public void reloadBot() {
160
+ ymChatService.reloadBot();
161
+ }
162
+
150
163
  public void setDeviceToken(JSONArray args, CallbackContext callbackContext) {
151
164
  try {
152
165
  String deviceToken = args.getString(0);
@@ -254,4 +267,21 @@ public class YmChatCordova extends CordovaPlugin {
254
267
  }
255
268
  }
256
269
 
270
+ private void setMicIconColor(JSONArray args, CallbackContext callbackContext) {
271
+ try {
272
+ String color = args.getString(0);
273
+ ymChatService.setMicIconColor(color, callbackContext);
274
+ } catch (Exception e) {
275
+ Utils.genericErrorHelper(e, callbackContext);
276
+ }
277
+ }
278
+
279
+ private void setMicBackgroundColor(JSONArray args, CallbackContext callbackContext) {
280
+ try {
281
+ String color = args.getString(0);
282
+ ymChatService.setMicBackgroundColor(color, callbackContext);
283
+ } catch (Exception e) {
284
+ Utils.genericErrorHelper(e, callbackContext);
285
+ }
286
+ }
257
287
  }
@@ -49,6 +49,10 @@ public class YmChatService {
49
49
  ymChat.closeBot();
50
50
  }
51
51
 
52
+ public void reloadBot() {
53
+ ymChat.reloadBot();
54
+ }
55
+
52
56
  public void setDeviceToken(String token, CallbackContext callbackContext) {
53
57
  ymChat.config.deviceToken = token;
54
58
  }
@@ -191,4 +195,12 @@ public class YmChatService {
191
195
  public void useLiteVersion(boolean shouldUseLiteVersion, CallbackContext callbackContext) {
192
196
  ymChat.config.useLiteVersion = shouldUseLiteVersion;
193
197
  }
198
+
199
+ public void setMicIconColor(String color, CallbackContext callbackContext) {
200
+ ymChat.config.enableSpeechConfig.fabIconColor = color;
201
+ }
202
+
203
+ public void setMicBackgroundColor(String color, CallbackContext callbackContext) {
204
+ ymChat.config.enableSpeechConfig.fabBackgroundColor = color;
205
+ }
194
206
  }
package/src/ios/ymchat.m CHANGED
@@ -92,6 +92,10 @@
92
92
  [[YMChat shared] closeBot];
93
93
  }
94
94
 
95
+ - (void)reloadBot:(CDVInvokedUrlCommand*)command
96
+ {
97
+ [[YMChat shared] reloadBot];
98
+ }
95
99
 
96
100
  - (void)onEventFromBotWithResponse:(YMBotEventResponse *)response {
97
101
  CDVPluginResult* pluginResult = nil;
@@ -210,6 +214,20 @@
210
214
  YMChat.shared.config.useLiteVersion = shouldUseLiteVersion;
211
215
  }
212
216
 
217
+ - (void)setMicIconColor:(CDVInvokedUrlCommand*)command
218
+ {
219
+ NSString* color = [command.arguments objectAtIndex:0];
220
+ assert(YMChat.shared.config != nil);
221
+ YMChat.shared.config.enableSpeechConfig.fabIconColor = [self getColorFromHexString:color];
222
+ }
223
+
224
+ - (void)setMicBackgroundColor:(CDVInvokedUrlCommand*)command
225
+ {
226
+ NSString* color = [command.arguments objectAtIndex:0];
227
+ assert(YMChat.shared.config != nil);
228
+ YMChat.shared.config.enableSpeechConfig.fabBackgroundColor = [self getColorFromHexString:color];
229
+ }
230
+
213
231
  - (UIColor *)getColorFromHexString:(NSString *)hexString {
214
232
  unsigned rgbValue = 0;
215
233
  NSScanner *scanner = [NSScanner scannerWithString:hexString];
package/www/ymchat.js CHANGED
@@ -62,6 +62,15 @@ const YmChatAPI = {
62
62
  useLiteVersion: (shouldUseLiteVersion) => {
63
63
  exec(null, null, "ymchat", "useLiteVersion", [shouldUseLiteVersion]);
64
64
  },
65
+ reloadBot: () => {
66
+ exec(null, null, "ymchat", "reloadBot", []);
67
+ },
68
+ setMicIconColor: (color) => {
69
+ exec(null, null, "ymchat", "setMicIconColor", [color]);
70
+ },
71
+ setMicBackgroundColor: (color) => {
72
+ exec(null, null, "ymchat", "setMicBackgroundColor", [color]);
73
+ },
65
74
  };
66
75
 
67
76
  module.exports = YmChatAPI;