cordova-plugin-ymchat 2.4.0 → 2.6.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.4.0",
3
+ "version": "2.6.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.4.0"
2
+ <plugin id="cordova-plugin-ymchat" version="2.6.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.10" 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.4.+'
27
+ implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.6.+'
28
28
  }
@@ -82,7 +82,13 @@ public class YmChatCordova extends CordovaPlugin {
82
82
  return true;
83
83
  case "reloadBot":
84
84
  reloadBot();
85
+ return true;
86
+ case "setMicIconColor":
87
+ setMicIconColor(args, callbackContext);
85
88
  return true;
89
+ case "setMicBackgroundColor":
90
+ setMicBackgroundColor(args, callbackContext);
91
+ return true;
86
92
  }
87
93
  return false;
88
94
  }
@@ -261,4 +267,21 @@ public class YmChatCordova extends CordovaPlugin {
261
267
  }
262
268
  }
263
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
+ }
264
287
  }
@@ -195,4 +195,12 @@ public class YmChatService {
195
195
  public void useLiteVersion(boolean shouldUseLiteVersion, CallbackContext callbackContext) {
196
196
  ymChat.config.useLiteVersion = shouldUseLiteVersion;
197
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
+ }
198
206
  }
package/src/ios/ymchat.m CHANGED
@@ -214,6 +214,20 @@
214
214
  YMChat.shared.config.useLiteVersion = shouldUseLiteVersion;
215
215
  }
216
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
+
217
231
  - (UIColor *)getColorFromHexString:(NSString *)hexString {
218
232
  unsigned rgbValue = 0;
219
233
  NSScanner *scanner = [NSScanner scannerWithString:hexString];
package/www/ymchat.js CHANGED
@@ -65,6 +65,12 @@ const YmChatAPI = {
65
65
  reloadBot: () => {
66
66
  exec(null, null, "ymchat", "reloadBot", []);
67
67
  },
68
+ setMicIconColor: (color) => {
69
+ exec(null, null, "ymchat", "setMicIconColor", [color]);
70
+ },
71
+ setMicBackgroundColor: (color) => {
72
+ exec(null, null, "ymchat", "setMicBackgroundColor", [color]);
73
+ },
68
74
  };
69
75
 
70
76
  module.exports = YmChatAPI;