cordova-plugin-ymchat 1.3.0 → 1.4.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
|
@@ -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.7" 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:v1.
|
|
27
|
+
implementation 'com.github.yellowmessenger:YMChatbot-Android:v1.8.+'
|
|
28
28
|
}
|
|
@@ -59,6 +59,12 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
59
59
|
case "setVersion":
|
|
60
60
|
setVersion(args,callbackContext);
|
|
61
61
|
return true;
|
|
62
|
+
case "setStatusBarColour":
|
|
63
|
+
setStatusBarColour(args,callbackContext);
|
|
64
|
+
return true;
|
|
65
|
+
case "setCloseButtonColour":
|
|
66
|
+
setCloseButtonColour(args,callbackContext);
|
|
67
|
+
return true;
|
|
62
68
|
case "setCustomLoaderURL":
|
|
63
69
|
setCustomLoaderURL(args, callbackContext);
|
|
64
70
|
return true;
|
|
@@ -66,6 +72,24 @@ public class YmChatCordova extends CordovaPlugin {
|
|
|
66
72
|
return false;
|
|
67
73
|
}
|
|
68
74
|
|
|
75
|
+
private void setCloseButtonColour(JSONArray args, CallbackContext callbackContext) {
|
|
76
|
+
try {
|
|
77
|
+
String colour = args.getString(0);
|
|
78
|
+
ymChatService.setCloseButtonColour(colour, callbackContext);
|
|
79
|
+
} catch (Exception e) {
|
|
80
|
+
Utils.genericErrorHelper(e, callbackContext);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
private void setStatusBarColour(JSONArray args, CallbackContext callbackContext) {
|
|
85
|
+
try {
|
|
86
|
+
String colour = args.getString(0);
|
|
87
|
+
ymChatService.setStatusBarColour(colour, callbackContext);
|
|
88
|
+
} catch (Exception e) {
|
|
89
|
+
Utils.genericErrorHelper(e, callbackContext);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
69
93
|
public void setBotId(JSONArray args, CallbackContext callbackContext) {
|
|
70
94
|
try {
|
|
71
95
|
String botId = args.getString(0);
|
|
@@ -132,4 +132,12 @@ public class YmChatService {
|
|
|
132
132
|
public void setCustomLoaderUrl(String url, CallbackContext callbackContext) {
|
|
133
133
|
ymChat.config.customLoaderUrl = url;
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
public void setCloseButtonColour(String colour, CallbackContext callbackContext) {
|
|
137
|
+
ymChat.config.closeButtonColorHex = colour;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public void setStatusBarColour(String colour, CallbackContext callbackContext) {
|
|
141
|
+
ymChat.config.statusBarColorFromHex = colour;
|
|
142
|
+
}
|
|
135
143
|
}
|
package/src/ios/ymchat.m
CHANGED
|
@@ -137,4 +137,30 @@
|
|
|
137
137
|
YMChat.shared.config.customLoaderUrl = url;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
- (void)setStatusBarColour:(CDVInvokedUrlCommand*)command
|
|
141
|
+
{
|
|
142
|
+
NSString* colour = [command.arguments objectAtIndex:0];
|
|
143
|
+
assert(YMChat.shared.config != nil);
|
|
144
|
+
YMChat.shared.config.statusBarColor = [self getColorFromHexString:colour];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
- (void)setCloseButtonColour:(CDVInvokedUrlCommand*)command
|
|
148
|
+
{
|
|
149
|
+
NSString* colour = [command.arguments objectAtIndex:0];
|
|
150
|
+
assert(YMChat.shared.config != nil);
|
|
151
|
+
YMChat.shared.config.closeButtonColor = [self getColorFromHexString:colour];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
- (UIColor *)getColorFromHexString:(NSString *)hexString {
|
|
155
|
+
unsigned rgbValue = 0;
|
|
156
|
+
NSScanner *scanner = [NSScanner scannerWithString:hexString];
|
|
157
|
+
if ([(NSString*) hexString characterAtIndex:0] == '#') {
|
|
158
|
+
[scanner setScanLocation:1]; // bypass '#' character
|
|
159
|
+
} else {
|
|
160
|
+
[scanner setScanLocation:0];
|
|
161
|
+
}
|
|
162
|
+
[scanner scanHexInt:&rgbValue];
|
|
163
|
+
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
|
|
164
|
+
}
|
|
165
|
+
|
|
140
166
|
@end
|
package/www/ymchat.js
CHANGED
|
@@ -43,6 +43,12 @@ const YmChatAPI = {
|
|
|
43
43
|
},
|
|
44
44
|
setCustomLoaderURL: (url) => {
|
|
45
45
|
exec(null, null, "ymchat", "setCustomLoaderURL", [url]);
|
|
46
|
+
},
|
|
47
|
+
setStatusBarColour: (colour) => {
|
|
48
|
+
exec(null, null, "ymchat", "setStatusBarColour", [colour]);
|
|
49
|
+
},
|
|
50
|
+
setCloseButtonColour: (colour) => {
|
|
51
|
+
exec(null, null, "ymchat", "setCloseButtonColour", [colour]);
|
|
46
52
|
}
|
|
47
53
|
};
|
|
48
54
|
|