cordova-plugin-ymchat 2.8.0 → 2.9.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
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.
|
|
2
|
+
<plugin id="cordova-plugin-ymchat" version="2.9.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.
|
|
37
|
+
<pod name="YMChat" spec="~> 1.14.1" 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.9.+'
|
|
28
28
|
}
|
|
@@ -95,6 +95,9 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
95
95
|
case "revalidateToken":
|
|
96
96
|
revalidateToken(args,callbackContext);
|
|
97
97
|
return true;
|
|
98
|
+
case "sendEventToBot":
|
|
99
|
+
sendEventToBot(args,callbackContext);
|
|
100
|
+
return true;
|
|
98
101
|
}
|
|
99
102
|
return false;
|
|
100
103
|
}
|
|
@@ -309,4 +312,14 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
309
312
|
Utils.genericErrorHelper(e, callbackContext);
|
|
310
313
|
}
|
|
311
314
|
}
|
|
315
|
+
|
|
316
|
+
private void sendEventToBot(JSONArray args, CallbackContext callbackContext) {
|
|
317
|
+
try {
|
|
318
|
+
String code = args.getString(0);
|
|
319
|
+
JSONObject data = args.getJSONObject(1);
|
|
320
|
+
ymChatService.sendEventToBot(code, data, callbackContext);
|
|
321
|
+
} catch (Exception e) {
|
|
322
|
+
Utils.genericErrorHelper(e, callbackContext);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
312
325
|
}
|
|
@@ -10,6 +10,7 @@ import com.yellowmessenger.ymchat.YMConfig;
|
|
|
10
10
|
import com.yellowmessenger.ymchat.models.YellowCallback;
|
|
11
11
|
import com.yellowmessenger.ymchat.models.YellowDataCallback;
|
|
12
12
|
import com.yellowmessenger.ymchat.models.YellowUnreadMessageResponse;
|
|
13
|
+
import com.yellowmessenger.ymchat.models.YMEventModel;
|
|
13
14
|
|
|
14
15
|
import org.apache.cordova.CallbackContext;
|
|
15
16
|
import org.apache.cordova.PluginResult;
|
|
@@ -223,4 +224,13 @@ public class YmChatService {
|
|
|
223
224
|
e.printStackTrace();
|
|
224
225
|
}
|
|
225
226
|
}
|
|
227
|
+
|
|
228
|
+
public void sendEventToBot(String code, JSONObject data, CallbackContext callbackContext) {
|
|
229
|
+
try {
|
|
230
|
+
YMEventModel model = new YMEventModel(code, Utils.jsonToMap(data));
|
|
231
|
+
ymChat.sendEventToBot(model);
|
|
232
|
+
} catch (Exception e) {
|
|
233
|
+
e.printStackTrace();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
226
236
|
}
|
package/src/ios/ymchat.m
CHANGED
|
@@ -242,6 +242,14 @@
|
|
|
242
242
|
[[YMChat shared] revalidateTokenWithToken:token refreshSession:refreshSession error:nil];
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
+
- (void)sendEventToBot:(CDVInvokedUrlCommand*)command
|
|
246
|
+
{
|
|
247
|
+
NSString* code = [command.arguments objectAtIndex:0];
|
|
248
|
+
NSDictionary* data = [command.arguments objectAtIndex:1];
|
|
249
|
+
YMEventModel* event = [[YMEventModel alloc] initWithCode:code data:data];
|
|
250
|
+
[[YMChat shared] sendEventToBotWithEvent:event error:nil];
|
|
251
|
+
}
|
|
252
|
+
|
|
245
253
|
- (UIColor *)getColorFromHexString:(NSString *)hexString {
|
|
246
254
|
unsigned rgbValue = 0;
|
|
247
255
|
NSScanner *scanner = [NSScanner scannerWithString:hexString];
|
package/www/ymchat.js
CHANGED
|
@@ -76,6 +76,9 @@ const YmChatAPI = {
|
|
|
76
76
|
},
|
|
77
77
|
revalidateToken: (token, refreshSession) => {
|
|
78
78
|
exec(null, null, "ymchat", "revalidateToken", [token, refreshSession]);
|
|
79
|
+
},
|
|
80
|
+
sendEventToBot: (code, data) => {
|
|
81
|
+
exec(null, null, "ymchat", "sendEventToBot", [code, data]);
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
84
|
|