cordova-plugin-ymchat 2.1.1 → 2.2.1
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/Readme.md +1 -1
- package/package.json +1 -1
- package/plugin.xml +1 -1
- package/src/android/build.gradle +1 -1
- package/src/android/com/yellow/ai/ymchat/YmChatCordova.java +12 -0
- package/src/android/com/yellow/ai/ymchat/YmChatService.java +4 -0
- package/src/ios/ymchat.m +12 -1
- package/www/ymchat.js +3 -0
- package/.vscode/settings.json +0 -3
package/Readme.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Documentation
|
|
4
4
|
|
|
5
5
|
For integration and usage refer documentation
|
|
6
|
-
[https://docs.yellow.ai/docs/platform_concepts/
|
|
6
|
+
[https://docs.yellow.ai/docs/platform_concepts/mobile/chatbot/cordova](https://docs.yellow.ai/docs/platform_concepts/mobile/chatbot/cordova)
|
|
7
7
|
|
|
8
8
|
## Demo App
|
|
9
9
|
|
package/package.json
CHANGED
package/plugin.xml
CHANGED
|
@@ -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.
|
|
37
|
+
<pod name="YMChat" spec="~> 1.9" swift-version="5.0"/>
|
|
38
38
|
</pods>
|
|
39
39
|
</podspec>
|
|
40
40
|
<config-file parent="/*" target="config.xml">
|
package/src/android/build.gradle
CHANGED
|
@@ -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.
|
|
27
|
+
implementation 'com.github.yellowmessenger:YMChatbot-Android:v2.2.+'
|
|
28
28
|
}
|
|
@@ -71,10 +71,22 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
71
71
|
case "setDisableActionsOnLoad":
|
|
72
72
|
setDisableActionsOnLoad(args, callbackContext);
|
|
73
73
|
return true;
|
|
74
|
+
case "useLiteVersion":
|
|
75
|
+
useLiteVersion(args, callbackContext);
|
|
76
|
+
return true;
|
|
74
77
|
}
|
|
75
78
|
return false;
|
|
76
79
|
}
|
|
77
80
|
|
|
81
|
+
private void useLiteVersion(JSONArray args, CallbackContext callbackContext) {
|
|
82
|
+
try {
|
|
83
|
+
boolean shouldUseLiteVersion = args.getBoolean(0);
|
|
84
|
+
ymChatService.useLiteVersion(shouldUseLiteVersion, callbackContext);
|
|
85
|
+
} catch (Exception e) {
|
|
86
|
+
Utils.genericErrorHelper(e, callbackContext);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
private void setDisableActionsOnLoad(JSONArray args, CallbackContext callbackContext) {
|
|
79
91
|
try {
|
|
80
92
|
boolean shouldDisableActionsOnLoad = args.getBoolean(0);
|
|
@@ -144,4 +144,8 @@ public class YmChatService {
|
|
|
144
144
|
public void setDisableActionsOnLoad(boolean shouldDisableActionsOnLoad, CallbackContext callbackContext) {
|
|
145
145
|
ymChat.config.disableActionsOnLoad = shouldDisableActionsOnLoad;
|
|
146
146
|
}
|
|
147
|
+
|
|
148
|
+
public void useLiteVersion(boolean shouldUseLiteVersion, CallbackContext callbackContext) {
|
|
149
|
+
ymChat.config.useLiteVersion = shouldUseLiteVersion;
|
|
150
|
+
}
|
|
147
151
|
}
|
package/src/ios/ymchat.m
CHANGED
|
@@ -95,7 +95,11 @@
|
|
|
95
95
|
|
|
96
96
|
- (void)onEventFromBotWithResponse:(YMBotEventResponse *)response {
|
|
97
97
|
CDVPluginResult* pluginResult = nil;
|
|
98
|
-
|
|
98
|
+
NSMutableDictionary *event = [[NSMutableDictionary alloc]initWithCapacity:10];
|
|
99
|
+
[event setObject:response.code forKey:@"code"];
|
|
100
|
+
if(response.data){
|
|
101
|
+
[event setObject:response.data forKey:@"data"];
|
|
102
|
+
}
|
|
99
103
|
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:event];
|
|
100
104
|
[pluginResult setKeepCallbackAsBool:YES];
|
|
101
105
|
[self.commandDelegate sendPluginResult:pluginResult callbackId:onEvent.callbackId];
|
|
@@ -158,6 +162,13 @@
|
|
|
158
162
|
YMChat.shared.config.disableActionsOnLoad = shouldDisableActionsOnLoad;
|
|
159
163
|
}
|
|
160
164
|
|
|
165
|
+
- (void)useLiteVersion:(CDVInvokedUrlCommand*)command
|
|
166
|
+
{
|
|
167
|
+
BOOL shouldUseLiteVersion = [command.arguments objectAtIndex:0];
|
|
168
|
+
assert(YMChat.shared.config != nil);
|
|
169
|
+
YMChat.shared.config.useLiteVersion = shouldUseLiteVersion;
|
|
170
|
+
}
|
|
171
|
+
|
|
161
172
|
- (UIColor *)getColorFromHexString:(NSString *)hexString {
|
|
162
173
|
unsigned rgbValue = 0;
|
|
163
174
|
NSScanner *scanner = [NSScanner scannerWithString:hexString];
|
package/www/ymchat.js
CHANGED
|
@@ -53,6 +53,9 @@ const YmChatAPI = {
|
|
|
53
53
|
setDisableActionsOnLoad: (shouldDisableActionsOnLoad) => {
|
|
54
54
|
exec(null, null, "ymchat", "setDisableActionsOnLoad", [shouldDisableActionsOnLoad]);
|
|
55
55
|
},
|
|
56
|
+
useLiteVersion: (shouldUseLiteVersion) => {
|
|
57
|
+
exec(null, null, "ymchat", "useLiteVersion", [shouldUseLiteVersion]);
|
|
58
|
+
},
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
module.exports = YmChatAPI;
|
package/.vscode/settings.json
DELETED