cordova-plugin-netcontroll-integration-getnet 1.0.104
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 +5 -0
- package/package.json +31 -0
- package/plugin.xml +44 -0
- package/src/android/GetNet/GetNetSumni.java +611 -0
- package/src/android/NetControllCordovaPluginsIntegrationGetNet.java +70 -0
- package/src/android/Utils/NetControllHelpers.java +21 -0
- package/src/android/Utils/NetControllPrinter.java +652 -0
- package/src/android/netcontroll.gradle +7 -0
- package/src/build.gradle +102 -0
- package/src/libs/libposdigital-1.8.0-12-release.aar +0 -0
- package/www/GetNet/Sumni.js +32 -0
- package/www/NetControllCordovaPluginsIntegrationGetNet.js +16 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package cordova.plugin.netcontroll.integration.getnet;
|
|
2
|
+
|
|
3
|
+
import org.apache.cordova.CordovaPlugin;
|
|
4
|
+
import org.apache.cordova.CallbackContext;
|
|
5
|
+
import org.apache.cordova.CordovaInterface;
|
|
6
|
+
import org.apache.cordova.CordovaWebView;
|
|
7
|
+
|
|
8
|
+
import org.json.JSONArray;
|
|
9
|
+
import org.json.JSONException;
|
|
10
|
+
|
|
11
|
+
import android.app.Activity;
|
|
12
|
+
import android.content.Context;
|
|
13
|
+
|
|
14
|
+
public class NetControllCordovaPluginsIntegrationGetNet extends CordovaPlugin {
|
|
15
|
+
//GetNet
|
|
16
|
+
public GetNetSumni getNetSumni;
|
|
17
|
+
|
|
18
|
+
//Cordova/Java Params
|
|
19
|
+
private Activity mActivity;
|
|
20
|
+
private Context mContext;
|
|
21
|
+
private CordovaInterface mCordova;
|
|
22
|
+
private CordovaWebView webView;
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
|
|
26
|
+
super.initialize(cordova, webView);
|
|
27
|
+
|
|
28
|
+
this.webView = webView;
|
|
29
|
+
mActivity = cordova.getActivity();
|
|
30
|
+
mContext = cordova.getActivity().getApplicationContext();
|
|
31
|
+
mCordova = cordova;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private void initializeGetNetSumni() {
|
|
35
|
+
if (this.getNetSumni == null) {
|
|
36
|
+
this.getNetSumni = new GetNetSumni();
|
|
37
|
+
this.getNetSumni.initialize(this.cordova, this.webView);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
|
|
43
|
+
try {
|
|
44
|
+
String result = "Sem resultado";
|
|
45
|
+
String[] actionProviderList = action.split("\\.");
|
|
46
|
+
String provider = actionProviderList[0];
|
|
47
|
+
|
|
48
|
+
switch (provider.toLowerCase()) {
|
|
49
|
+
case "getnet":
|
|
50
|
+
String getNetProduct = actionProviderList[1];
|
|
51
|
+
switch (getNetProduct.toLowerCase()) {
|
|
52
|
+
case "sumni":
|
|
53
|
+
this.initializeGetNetSumni();
|
|
54
|
+
String getNetSuminAction = actionProviderList[2];
|
|
55
|
+
boolean resultGetNetSuminExecute = this.getNetSumni.execute(getNetSuminAction, args, callbackContext);
|
|
56
|
+
return resultGetNetSuminExecute;
|
|
57
|
+
default:
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
default:
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
callbackContext.success(result);
|
|
64
|
+
return true;
|
|
65
|
+
} catch (Exception e) {
|
|
66
|
+
callbackContext.error("NetControllCordovaPluginsIntegrationGetNet excute error: " + e.toString());
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
package cordova.plugin.netcontroll.integration.getnet;
|
|
2
|
+
|
|
3
|
+
import com.google.gson.Gson;
|
|
4
|
+
|
|
5
|
+
import java.lang.reflect.Type;
|
|
6
|
+
|
|
7
|
+
public class NetControllHelpers {
|
|
8
|
+
|
|
9
|
+
public static <T> T parseJsonStringToObj(String objJson, Type objectClass) {
|
|
10
|
+
Gson gson = new Gson();
|
|
11
|
+
T result = gson.fromJson(objJson, objectClass);
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public static String parseObjToJsonSrtring(Object obj) {
|
|
16
|
+
Gson gson = new Gson();
|
|
17
|
+
String result = gson.toJson(obj);
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|