cordova-plugin-ymchat 3.1.0 → 3.3.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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.3.0]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Configurable Upload Sources** (Android only) — restricts the attachment picker to specific sources via `cordova.plugins.ymchat.setAllowedUploadSources(['camera'])` (or `['file']`, or both). Bridges the native Android SDK's `allowedUploadSources` config for the first time (`YMChatbot-Android` since v3.3.0, already pinned since v3.0.0 of this plugin). No iOS equivalent exists natively, so calling this on iOS is a no-op — the plugin doesn't implement the selector there.
|
|
13
|
+
|
|
14
|
+
## [3.2.0]
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`stopVoiceMode()`** — lets the host app programmatically end an active voice call, e.g. when a modal presentation covers the chatbot and the native view-lifecycle callback that would normally stop voice mode doesn't fire. Bridges the native SDKs' `stopVoiceMode()` for the first time (iOS `YMChat` since 2.2.0, Android `YMChatbot-Android` since v3.2.0 — both already pinned since v3.0.0 of this plugin).
|
|
19
|
+
|
|
8
20
|
## [3.1.0]
|
|
9
21
|
|
|
10
22
|
### Added
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
-
<plugin id="cordova-plugin-ymchat" version="3.
|
|
2
|
+
<plugin id="cordova-plugin-ymchat" version="3.3.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>
|
|
@@ -10,6 +10,9 @@ import org.apache.cordova.CordovaPlugin;
|
|
|
10
10
|
import org.json.JSONArray;
|
|
11
11
|
import org.json.JSONObject;
|
|
12
12
|
|
|
13
|
+
import java.util.ArrayList;
|
|
14
|
+
import java.util.List;
|
|
15
|
+
|
|
13
16
|
public class YmChatCordova extends CordovaPlugin {
|
|
14
17
|
|
|
15
18
|
final String Tag = "YmChat";
|
|
@@ -56,6 +59,9 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
56
59
|
case "closeBot":
|
|
57
60
|
closeBot();
|
|
58
61
|
return true;
|
|
62
|
+
case "stopVoiceMode":
|
|
63
|
+
stopVoiceMode();
|
|
64
|
+
return true;
|
|
59
65
|
case "unlinkDeviceToken":
|
|
60
66
|
unlinkDeviceToken(args, callbackContext);
|
|
61
67
|
return true;
|
|
@@ -86,6 +92,9 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
86
92
|
case "useLiteVersion":
|
|
87
93
|
useLiteVersion(args, callbackContext);
|
|
88
94
|
return true;
|
|
95
|
+
case "setAllowedUploadSources":
|
|
96
|
+
setAllowedUploadSources(args, callbackContext);
|
|
97
|
+
return true;
|
|
89
98
|
case "reloadBot":
|
|
90
99
|
reloadBot();
|
|
91
100
|
return true;
|
|
@@ -150,6 +159,19 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
161
|
|
|
162
|
+
private void setAllowedUploadSources(JSONArray args, CallbackContext callbackContext) {
|
|
163
|
+
try {
|
|
164
|
+
JSONArray sourcesArray = args.getJSONArray(0);
|
|
165
|
+
List<String> sources = new ArrayList<>();
|
|
166
|
+
for (int i = 0; i < sourcesArray.length(); i++) {
|
|
167
|
+
sources.add(sourcesArray.getString(i));
|
|
168
|
+
}
|
|
169
|
+
ymChatService.setAllowedUploadSources(sources, callbackContext);
|
|
170
|
+
} catch (Exception e) {
|
|
171
|
+
Utils.genericErrorHelper(e, callbackContext);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
153
175
|
private void setDisableActionsOnLoad(JSONArray args, CallbackContext callbackContext) {
|
|
154
176
|
try {
|
|
155
177
|
boolean shouldDisableActionsOnLoad = args.getBoolean(0);
|
|
@@ -204,6 +226,10 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
204
226
|
ymChatService.closeBot();
|
|
205
227
|
}
|
|
206
228
|
|
|
229
|
+
public void stopVoiceMode() {
|
|
230
|
+
ymChatService.stopVoiceMode();
|
|
231
|
+
}
|
|
232
|
+
|
|
207
233
|
public void reloadBot() {
|
|
208
234
|
ymChatService.reloadBot();
|
|
209
235
|
}
|
|
@@ -8,6 +8,7 @@ import com.yellow.ai.ymchat.utils.Utils;
|
|
|
8
8
|
import com.yellowmessenger.ymchat.YMChat;
|
|
9
9
|
import com.yellowmessenger.ymchat.YMConfig;
|
|
10
10
|
import com.yellowmessenger.ymchat.models.YMActivationMode;
|
|
11
|
+
import com.yellowmessenger.ymchat.models.YMUploadSource;
|
|
11
12
|
import com.yellowmessenger.ymchat.models.YellowCallback;
|
|
12
13
|
import com.yellowmessenger.ymchat.models.YellowDataCallback;
|
|
13
14
|
import com.yellowmessenger.ymchat.models.YellowUnreadMessageResponse;
|
|
@@ -18,7 +19,9 @@ import org.apache.cordova.PluginResult;
|
|
|
18
19
|
import org.json.JSONArray;
|
|
19
20
|
import org.json.JSONObject;
|
|
20
21
|
|
|
22
|
+
import java.util.ArrayList;
|
|
21
23
|
import java.util.HashMap;
|
|
24
|
+
import java.util.List;
|
|
22
25
|
|
|
23
26
|
public class YmChatService {
|
|
24
27
|
YMChat ymChat;
|
|
@@ -51,6 +54,10 @@ public class YmChatService {
|
|
|
51
54
|
ymChat.closeBot();
|
|
52
55
|
}
|
|
53
56
|
|
|
57
|
+
public void stopVoiceMode() {
|
|
58
|
+
ymChat.stopVoiceMode();
|
|
59
|
+
}
|
|
60
|
+
|
|
54
61
|
public void reloadBot() {
|
|
55
62
|
ymChat.reloadBot();
|
|
56
63
|
}
|
|
@@ -223,6 +230,14 @@ public class YmChatService {
|
|
|
223
230
|
ymChat.config.useLiteVersion = shouldUseLiteVersion;
|
|
224
231
|
}
|
|
225
232
|
|
|
233
|
+
public void setAllowedUploadSources(List<String> sources, CallbackContext callbackContext) {
|
|
234
|
+
List<YMUploadSource> uploadSources = new ArrayList<>();
|
|
235
|
+
for (String source : sources) {
|
|
236
|
+
uploadSources.add(YMUploadSource.valueOf(source.toUpperCase()));
|
|
237
|
+
}
|
|
238
|
+
ymChat.config.allowedUploadSources = uploadSources;
|
|
239
|
+
}
|
|
240
|
+
|
|
226
241
|
public void setMicIconColor(String color, CallbackContext callbackContext) {
|
|
227
242
|
ymChat.config.speechConfig.fabIconColor = color;
|
|
228
243
|
}
|
package/src/ios/ymchat.m
CHANGED
|
@@ -98,6 +98,11 @@
|
|
|
98
98
|
[[YMChat shared] closeBot];
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
- (void)stopVoiceMode:(CDVInvokedUrlCommand*)command
|
|
102
|
+
{
|
|
103
|
+
[[YMChat shared] stopVoiceMode];
|
|
104
|
+
}
|
|
105
|
+
|
|
101
106
|
- (void)reloadBot:(CDVInvokedUrlCommand*)command
|
|
102
107
|
{
|
|
103
108
|
[[YMChat shared] reloadBotAndReturnError:nil];
|
package/www/ymchat.js
CHANGED
|
@@ -38,6 +38,9 @@ const YmChatAPI = {
|
|
|
38
38
|
closeBot: () => {
|
|
39
39
|
exec(null, null, "ymchat", "closeBot", []);
|
|
40
40
|
},
|
|
41
|
+
stopVoiceMode: () => {
|
|
42
|
+
exec(null, null, "ymchat", "stopVoiceMode", []);
|
|
43
|
+
},
|
|
41
44
|
unlinkDeviceToken: (apiKey, success, failure) => {
|
|
42
45
|
exec(success, failure, "ymchat", "unlinkDeviceToken", [apiKey])
|
|
43
46
|
},
|
|
@@ -68,6 +71,9 @@ const YmChatAPI = {
|
|
|
68
71
|
useLiteVersion: (shouldUseLiteVersion) => {
|
|
69
72
|
exec(null, null, "ymchat", "useLiteVersion", [shouldUseLiteVersion]);
|
|
70
73
|
},
|
|
74
|
+
setAllowedUploadSources: (sources) => {
|
|
75
|
+
exec(null, null, "ymchat", "setAllowedUploadSources", [sources]);
|
|
76
|
+
},
|
|
71
77
|
reloadBot: () => {
|
|
72
78
|
exec(null, null, "ymchat", "reloadBot", []);
|
|
73
79
|
},
|