cordova-plugin-mserviceinterface-2.0 1.0.27 → 1.0.31
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 +2 -2
- package/package.json.bak +28 -0
- package/plugin.xml +3 -2
- package/plugin.xml.bak +154 -0
- package/src/android/mInterface.java +86 -3
- package/src/android/mInterfaceService.java +13 -10
- package/src/ios/mInterface.h +1 -0
- package/src/ios/mInterface.m +15 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cordova-plugin-mserviceinterface-2.0",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "This plugin establishes the connection to the native interface and performs the requested task.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
"version": ">=5.0.0"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
|
-
}
|
|
28
|
+
}
|
package/package.json.bak
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cordova-plugin-mserviceinterface-2.0",
|
|
3
|
+
"version": "1.0.30",
|
|
4
|
+
"description": "This plugin establishes the connection to the native interface and performs the requested task.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "test"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/selfservit/cordova-plugin-mserviceinterface-2.0.git"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mserviceinterface-2.0"
|
|
15
|
+
],
|
|
16
|
+
"author": "selfservit@gmail.com",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/selfservit/cordova-plugin-mserviceinterface-2.0/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/selfservit/cordova-plugin-mserviceinterface-2.0#readme",
|
|
22
|
+
"engines": [
|
|
23
|
+
{
|
|
24
|
+
"name": "cordova",
|
|
25
|
+
"version": ">=5.0.0"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
package/plugin.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
3
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
4
|
id="cordova-plugin-mserviceinterface-2.0"
|
|
5
|
-
version="1.0.
|
|
5
|
+
version="1.0.31">
|
|
6
6
|
<name>mserviceinterface-2.0</name>
|
|
7
7
|
<description>This plugin establishes the connection to the native interface and performs the requested task.</description>
|
|
8
8
|
<author>selfservit@gmail.com</author>
|
|
@@ -46,9 +46,10 @@
|
|
|
46
46
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
47
47
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
48
48
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
49
|
+
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
49
50
|
</config-file>
|
|
50
51
|
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
|
51
|
-
|
|
52
|
+
<service android:name="com.selfservit.util.mInterfaceService" android:foregroundServiceType="location" android:enabled="true" android:exported="true"/>
|
|
52
53
|
<service
|
|
53
54
|
android:name="com.selfservit.util.backgroundNotification"
|
|
54
55
|
android:permission="android.permission.BIND_JOB_SERVICE"
|
package/plugin.xml.bak
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
|
3
|
+
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
4
|
+
id="cordova-plugin-mserviceinterface-2.0"
|
|
5
|
+
version="1.0.30">
|
|
6
|
+
<name>mserviceinterface-2.0</name>
|
|
7
|
+
<description>This plugin establishes the connection to the native interface and performs the requested task.</description>
|
|
8
|
+
<author>selfservit@gmail.com</author>
|
|
9
|
+
<engines>
|
|
10
|
+
<engine name="cordova" version=">=5.0.0" />
|
|
11
|
+
</engines>
|
|
12
|
+
<keywords>mserviceinterface-2.0</keywords>
|
|
13
|
+
<license>Apache 2.0 License</license>
|
|
14
|
+
<repo></repo>
|
|
15
|
+
<issue></issue>
|
|
16
|
+
<asset src="www/mInterface.js" target="js/mInterface.js"/>
|
|
17
|
+
<js-module src="www/mInterface.js" name="mInterface">
|
|
18
|
+
<clobbers target="mInterface" />
|
|
19
|
+
</js-module>
|
|
20
|
+
<platform name="android">
|
|
21
|
+
<framework src="src/android/doubleogradle.gradle" custom="true" type="gradleReference"/>
|
|
22
|
+
<framework src="com.google.android.gms:play-services:11.0.+" />
|
|
23
|
+
<framework src="com.google.android.gms:play-services-location:11.0.+" />
|
|
24
|
+
<framework src="com.android.support:support-v4:26.0.1" />
|
|
25
|
+
<framework src="com.google.zxing:core:3.2.1" />
|
|
26
|
+
<framework src="com.journeyapps:zxing-android-embedded:3.2.0@aar" />
|
|
27
|
+
<edit-config xmlns:android="http://schemas.android.com/apk/res/android" file="AndroidManifest.xml" mode="merge" target="/manifest/application">
|
|
28
|
+
<application android:networkSecurityConfig="@xml/network_security_config" />
|
|
29
|
+
<application android:requestLegacyExternalStorage="true" />
|
|
30
|
+
</edit-config>
|
|
31
|
+
<config-file target="res/xml/config.xml" parent="/*">
|
|
32
|
+
<feature name="mInterface" >
|
|
33
|
+
<param name="android-package" value="com.selfservit.util.mInterface"/>
|
|
34
|
+
</feature>
|
|
35
|
+
</config-file>
|
|
36
|
+
<config-file target="AndroidManifest.xml" parent="/manifest">
|
|
37
|
+
<uses-feature android:name="android.hardware.camera" android:required="true" />
|
|
38
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
39
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
40
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
41
|
+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
42
|
+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
43
|
+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
44
|
+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
45
|
+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
46
|
+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
47
|
+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
48
|
+
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
49
|
+
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
50
|
+
</config-file>
|
|
51
|
+
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
|
52
|
+
<service android:name="com.selfservit.util.mInterfaceService" android:foregroundServiceType="location" android:enabled="true" android:exported="true"/>
|
|
53
|
+
<service
|
|
54
|
+
android:name="com.selfservit.util.backgroundNotification"
|
|
55
|
+
android:permission="android.permission.BIND_JOB_SERVICE"
|
|
56
|
+
android:exported="false">
|
|
57
|
+
<intent-filter>
|
|
58
|
+
<action android:name="com.onesignal.NotificationExtender" />
|
|
59
|
+
</intent-filter>
|
|
60
|
+
</service>
|
|
61
|
+
<receiver android:name="com.selfservit.util.mInterfaceReceiver" android:enabled="true" android:exported="true">
|
|
62
|
+
<intent-filter>
|
|
63
|
+
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
|
64
|
+
<action android:name="com.example.checkservice" />
|
|
65
|
+
</intent-filter>
|
|
66
|
+
</receiver>
|
|
67
|
+
<provider android:name="com.selfservit.util.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true">
|
|
68
|
+
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
|
|
69
|
+
</provider>
|
|
70
|
+
</config-file>
|
|
71
|
+
<source-file src="src/android/mInterfaceService.java" target-dir="src/com/selfservit/util/" />
|
|
72
|
+
<source-file src="src/android/backgroundNotification.java" target-dir="src/com/selfservit/util/" />
|
|
73
|
+
<source-file src="src/android/mInterfaceReceiver.java" target-dir="src/com/selfservit/util/" />
|
|
74
|
+
<source-file src="src/android/mInterface.java" target-dir="src/com/selfservit/util/" />
|
|
75
|
+
<source-file src="src/android/mInterfaceUtil.java" target-dir="src/com/selfservit/util/" />
|
|
76
|
+
<source-file src="src/android/CallbackProgressDialog.java" target-dir="src/com/selfservit/util/" />
|
|
77
|
+
<source-file src="src/android/FileProvider.java" target-dir="src/com/selfservit/util/" />
|
|
78
|
+
<source-file src="src/android/res/xml/opener_paths.xml" target-dir="res/xml" />
|
|
79
|
+
<source-file src="src/android/res/xml/network_security_config.xml" target-dir="res/xml" />
|
|
80
|
+
</platform>
|
|
81
|
+
<platform name="ios">
|
|
82
|
+
<config-file target="*-Info.plist" parent="NSCameraUsageDescription">
|
|
83
|
+
<string>Equipcare wants to access your camera and gallery to attach the images for service reports and photo proofs.</string>
|
|
84
|
+
</config-file>
|
|
85
|
+
|
|
86
|
+
<config-file target="*-Info.plist" parent="NSPhotoLibraryUsageDescription">
|
|
87
|
+
<string>Equipcare wants to access your camera and gallery to attach the images for service reports and photo proofs.</string>
|
|
88
|
+
</config-file>
|
|
89
|
+
<preference name="CAMERA_USAGE_DESCRIPTION" default="Allow use camera from your device" />
|
|
90
|
+
<preference name="PHOTOLIBRARY_USAGE_DESCRIPTION" default="Allow access your photos from gallery" />
|
|
91
|
+
<config-file target="config.xml" parent="/widget">
|
|
92
|
+
<feature name="mInterface">
|
|
93
|
+
<param name="ios-package" value="mInterface" />
|
|
94
|
+
</feature>
|
|
95
|
+
</config-file>
|
|
96
|
+
<header-file src="src/ios/mInterface.h"/>
|
|
97
|
+
<source-file src="src/ios/mInterface.m"/>
|
|
98
|
+
<header-file src="src/ios/InternetConnection.h"/>
|
|
99
|
+
<source-file src="src/ios/InternetConnection.m"/>
|
|
100
|
+
<header-file src="src/ios/XMLConverter.h"/>
|
|
101
|
+
<source-file src="src/ios/XMLConverter.m"/>
|
|
102
|
+
<header-file src="src/ios/UICKeyChainStore.h" />
|
|
103
|
+
<source-file src="src/ios/UICKeyChainStore.m" />
|
|
104
|
+
<source-file src="src/ios/SSZipArchive.h" />
|
|
105
|
+
<source-file src="src/ios/SSZipArchive.m" />
|
|
106
|
+
<header-file src="src/ios/SSZipCommon.h" />
|
|
107
|
+
<header-file src="src/ios/ZipArchive.h" />
|
|
108
|
+
<source-file src="src/ios/minizip/crypt.c" />
|
|
109
|
+
<header-file src="src/ios/minizip/crypt.h" />
|
|
110
|
+
<source-file src="src/ios/minizip/ioapi_buf.c" />
|
|
111
|
+
<header-file src="src/ios/minizip/ioapi_buf.h" />
|
|
112
|
+
<source-file src="src/ios/minizip/ioapi_mem.c" />
|
|
113
|
+
<header-file src="src/ios/minizip/ioapi_mem.h" />
|
|
114
|
+
<source-file src="src/ios/minizip/ioapi.c" />
|
|
115
|
+
<header-file src="src/ios/minizip/ioapi.h" />
|
|
116
|
+
<source-file src="src/ios/minizip/minishared.c" />
|
|
117
|
+
<header-file src="src/ios/minizip/minishared.h" />
|
|
118
|
+
<source-file src="src/ios/minizip/unzip.c" />
|
|
119
|
+
<header-file src="src/ios/minizip/unzip.h" />
|
|
120
|
+
<source-file src="src/ios/minizip/zip.c" />
|
|
121
|
+
<header-file src="src/ios/minizip/zip.h" />
|
|
122
|
+
<source-file src="src/ios/aes/aes_ni.c" />
|
|
123
|
+
<header-file src="src/ios/aes/aes_ni.h" />
|
|
124
|
+
<header-file src="src/ios/aes/aes.h" />
|
|
125
|
+
<source-file src="src/ios/aes/aescrypt.c" />
|
|
126
|
+
<source-file src="src/ios/aes/aeskey.c" />
|
|
127
|
+
<header-file src="src/ios/aes/aesopt.h" />
|
|
128
|
+
<source-file src="src/ios/aes/aestab.c" />
|
|
129
|
+
<header-file src="src/ios/aes/aestab.h" />
|
|
130
|
+
<header-file src="src/ios/aes/brg_endian.h" />
|
|
131
|
+
<header-file src="src/ios/aes/brg_types.h" />
|
|
132
|
+
<source-file src="src/ios/aes/fileenc.c" />
|
|
133
|
+
<header-file src="src/ios/aes/fileenc.h" />
|
|
134
|
+
<source-file src="src/ios/aes/hmac.c" />
|
|
135
|
+
<header-file src="src/ios/aes/hmac.h" />
|
|
136
|
+
<source-file src="src/ios/aes/prng.c" />
|
|
137
|
+
<header-file src="src/ios/aes/prng.h" />
|
|
138
|
+
<source-file src="src/ios/aes/pwd2key.c" />
|
|
139
|
+
<header-file src="src/ios/aes/pwd2key.h" />
|
|
140
|
+
<source-file src="src/ios/aes/sha1.c" />
|
|
141
|
+
<header-file src="src/ios/aes/sha1.h" />
|
|
142
|
+
<framework src="MapKit.framework" />
|
|
143
|
+
<framework src="Foundation.framework" />
|
|
144
|
+
<framework src="SystemConfiguration.framework" />
|
|
145
|
+
<framework src="CoreFoundation.framework" />
|
|
146
|
+
<framework src="CoreTelephony.framework" />
|
|
147
|
+
<framework src="UIKit.framework" />
|
|
148
|
+
<framework src="CFNetwork.framework" />
|
|
149
|
+
<framework src="AssetsLibrary.framework" />
|
|
150
|
+
<framework src="AVFoundation.framework" />
|
|
151
|
+
<framework src="libz.dylib" />
|
|
152
|
+
<framework src="Security.framework" />
|
|
153
|
+
</platform>
|
|
154
|
+
</plugin>
|
|
@@ -86,6 +86,8 @@ import java.io.OutputStreamWriter;
|
|
|
86
86
|
import java.net.HttpURLConnection;
|
|
87
87
|
import java.net.URL;
|
|
88
88
|
import java.text.SimpleDateFormat;
|
|
89
|
+
import java.util.ArrayList;
|
|
90
|
+
import java.util.Arrays;
|
|
89
91
|
import java.util.Date;
|
|
90
92
|
import java.util.List;
|
|
91
93
|
import java.util.Stack;
|
|
@@ -94,6 +96,9 @@ import java.util.regex.Matcher;
|
|
|
94
96
|
import java.util.regex.Pattern;
|
|
95
97
|
import java.util.zip.ZipEntry;
|
|
96
98
|
import java.util.zip.ZipInputStream;
|
|
99
|
+
import java.util.List;
|
|
100
|
+
import java.util.ArrayList;
|
|
101
|
+
import java.util.Arrays;
|
|
97
102
|
|
|
98
103
|
import static android.app.Activity.RESULT_OK;
|
|
99
104
|
|
|
@@ -282,6 +287,12 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
282
287
|
} else if (action.equals("GetPermissions")) {
|
|
283
288
|
getPermissions(args, callbackContext);
|
|
284
289
|
return true;
|
|
290
|
+
} else if (action.equals("GetLocationPermission")) {
|
|
291
|
+
getLocationPermission(args, callbackContext);
|
|
292
|
+
return true;
|
|
293
|
+
} else if (action.equals("CheckLocationPermission")) {
|
|
294
|
+
checkLocationPermission(args, callbackContext);
|
|
295
|
+
return true;
|
|
285
296
|
} else if (action.equals("AppVersion")) {
|
|
286
297
|
appVersion(callbackContext);
|
|
287
298
|
return true;
|
|
@@ -943,13 +954,81 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
943
954
|
callbackContext.success("file://" + mInterfaceUtil.rootDirectory + "/");
|
|
944
955
|
}
|
|
945
956
|
|
|
957
|
+
private void checkLocationPermission(JSONArray args, CallbackContext callbackContext) {
|
|
958
|
+
boolean permissionGranted = true;
|
|
959
|
+
List<String> list;
|
|
960
|
+
try {
|
|
961
|
+
callback = callbackContext;
|
|
962
|
+
Context context = cordova.getActivity().getApplicationContext();
|
|
963
|
+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
|
964
|
+
String[] permissions = args.optJSONObject(0).optString("permissions").split(",");
|
|
965
|
+
list = new ArrayList<String>(Arrays.asList(permissions));
|
|
966
|
+
permissions = list.toArray(new String[0]);
|
|
967
|
+
|
|
968
|
+
for (int i = 0; i < permissions.length; i++) {
|
|
969
|
+
if (ActivityCompat.checkSelfPermission(context, permissions[i]) != PackageManager.PERMISSION_GRANTED) {
|
|
970
|
+
permissionGranted = false;
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
if (!permissionGranted) {
|
|
974
|
+
callback.error("failure");
|
|
975
|
+
} else {
|
|
976
|
+
callback.success("success");
|
|
977
|
+
}
|
|
978
|
+
} else {
|
|
979
|
+
callback.success("success");
|
|
980
|
+
}
|
|
981
|
+
} catch (Exception e) {
|
|
982
|
+
e.printStackTrace();
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
private void getLocationPermission(JSONArray args, CallbackContext callbackContext) {
|
|
986
|
+
boolean permissionGranted = true;
|
|
987
|
+
List<String> list;
|
|
988
|
+
try {
|
|
989
|
+
callback = callbackContext;
|
|
990
|
+
Context context = cordova.getActivity().getApplicationContext();
|
|
991
|
+
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
|
992
|
+
String[] permissions = args.optJSONObject(0).optString("permissions").split(",");
|
|
993
|
+
list = new ArrayList<String>(Arrays.asList(permissions));
|
|
994
|
+
permissions = list.toArray(new String[0]);
|
|
995
|
+
|
|
996
|
+
for (int i = 0; i < permissions.length; i++) {
|
|
997
|
+
if (ActivityCompat.checkSelfPermission(context, permissions[i]) != PackageManager.PERMISSION_GRANTED) {
|
|
998
|
+
permissionGranted = false;
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
if (!permissionGranted) {
|
|
1002
|
+
PermissionHelper.requestPermissions(this, 111, permissions);
|
|
1003
|
+
} else {
|
|
1004
|
+
callback.success("success");
|
|
1005
|
+
}
|
|
1006
|
+
} else {
|
|
1007
|
+
callback.success("success");
|
|
1008
|
+
}
|
|
1009
|
+
} catch (Exception e) {
|
|
1010
|
+
e.printStackTrace();
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
946
1013
|
private void getPermissions(JSONArray args, CallbackContext callbackContext) {
|
|
1014
|
+
boolean permissionGranted = true;
|
|
1015
|
+
List<String> list;
|
|
947
1016
|
try {
|
|
948
1017
|
callback = callbackContext;
|
|
949
1018
|
Context context = cordova.getActivity().getApplicationContext();
|
|
950
1019
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
951
|
-
String[]permissions = args.optJSONObject(0).optString("permissions").split(",");
|
|
952
|
-
if (
|
|
1020
|
+
String[] permissions = args.optJSONObject(0).optString("permissions").split(",");
|
|
1021
|
+
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.Q) {
|
|
1022
|
+
list = new ArrayList<String>(Arrays.asList(permissions));
|
|
1023
|
+
list.remove("android.permission.ACCESS_BACKGROUND_LOCATION");
|
|
1024
|
+
permissions = list.toArray(new String[0]);
|
|
1025
|
+
};
|
|
1026
|
+
for (int i = 0; i < permissions.length; i++) {
|
|
1027
|
+
if (ActivityCompat.checkSelfPermission(context, permissions[i]) != PackageManager.PERMISSION_GRANTED) {
|
|
1028
|
+
permissionGranted = false;
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
if (!permissionGranted) {
|
|
953
1032
|
PermissionHelper.requestPermissions(this, 1, permissions);
|
|
954
1033
|
} else {
|
|
955
1034
|
callback.success("success");
|
|
@@ -1757,8 +1836,12 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1757
1836
|
public void onRequestPermissionResult(int requestCode, String[] permissions, int[] grantResults) {
|
|
1758
1837
|
try {
|
|
1759
1838
|
boolean indicator = true;
|
|
1839
|
+
String failedPermission = "failure";
|
|
1760
1840
|
for (int i = 0; i < grantResults.length; i++) {
|
|
1761
1841
|
if (grantResults[i] != 0) {
|
|
1842
|
+
if (permissions[i].equalsIgnoreCase("android.permission.ACCESS_BACKGROUND_LOCATION")) {
|
|
1843
|
+
failedPermission = "background_location";
|
|
1844
|
+
}
|
|
1762
1845
|
indicator = false;
|
|
1763
1846
|
break;
|
|
1764
1847
|
}
|
|
@@ -1766,7 +1849,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1766
1849
|
if (indicator) {
|
|
1767
1850
|
callback.success("success");
|
|
1768
1851
|
} else {
|
|
1769
|
-
callback.error(
|
|
1852
|
+
callback.error(failedPermission);
|
|
1770
1853
|
}
|
|
1771
1854
|
} catch (Exception e) {
|
|
1772
1855
|
e.printStackTrace();
|
|
@@ -208,16 +208,19 @@ public class mInterfaceService extends Service implements com.google.android.gms
|
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
};
|
|
211
|
-
setLocationTimeInterval
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
if(setLocationTimeInterval == null){
|
|
212
|
+
setLocationTimeInterval = new Timer();
|
|
213
|
+
setLocationTimeInterval.schedule(timerTask, Integer.parseInt(serverDateObj.optString("location_fetch_interval_in_seconds")), Integer.parseInt(serverDateObj.optString("location_fetch_interval_in_seconds")));
|
|
214
|
+
MINIMUM_INTERVAL = Long.parseLong(serverDateObj.optString("location_fetch_interval_in_seconds").toString());
|
|
215
|
+
createLocationRequest();
|
|
216
|
+
this.mGoogleApiClient = new GoogleApiClient.Builder(this)
|
|
217
|
+
.addConnectionCallbacks(this)
|
|
218
|
+
.addOnConnectionFailedListener(this)
|
|
219
|
+
.addApi(LocationServices.API)
|
|
220
|
+
.build();
|
|
221
|
+
mGoogleApiClient.connect();
|
|
222
|
+
};
|
|
223
|
+
|
|
221
224
|
}
|
|
222
225
|
}
|
|
223
226
|
} else {
|
package/src/ios/mInterface.h
CHANGED
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
- (void)OpenFileWithViewer:(CDVInvokedUrlCommand *)command;
|
|
75
75
|
- (void)DeviceInfo:(CDVInvokedUrlCommand*)command;
|
|
76
76
|
-(void)AppVersion:(CDVInvokedUrlCommand*)command;
|
|
77
|
+
-(void)CheckLocationPermission:(CDVInvokedUrlCommand*)command;
|
|
77
78
|
-(void)GetPermissions:(CDVInvokedUrlCommand*)command;
|
|
78
79
|
-(void)RemoveFilesFromDirectory;
|
|
79
80
|
-(void)DespatchQueueMoveToServer;
|
package/src/ios/mInterface.m
CHANGED
|
@@ -10,8 +10,6 @@
|
|
|
10
10
|
#include <sys/types.h>
|
|
11
11
|
#include <sys/sysctl.h>
|
|
12
12
|
#include "TargetConditionals.h"
|
|
13
|
-
#import "OneSignalPush.h"
|
|
14
|
-
#import <OneSignal/OneSignal.h>
|
|
15
13
|
#import <objc/runtime.h>
|
|
16
14
|
|
|
17
15
|
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
|
|
@@ -29,15 +27,6 @@
|
|
|
29
27
|
@synthesize controller = docController;
|
|
30
28
|
@synthesize callbackID;
|
|
31
29
|
|
|
32
|
-
- (void)GetFCMUtils:(CDVInvokedUrlCommand *)command {
|
|
33
|
-
OSDeviceState *deviceState = [OneSignal getDeviceState];
|
|
34
|
-
NSMutableDictionary * deviceDict = [[NSMutableDictionary alloc] init];
|
|
35
|
-
[deviceDict setValue:deviceState.userId forKey:@"userId"];
|
|
36
|
-
[deviceDict setValue:deviceState.pushToken forKey:@"pushToken"];
|
|
37
|
-
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceDict];
|
|
38
|
-
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
39
|
-
}
|
|
40
|
-
|
|
41
30
|
-(void)GetBase64String:(CDVInvokedUrlCommand *)command {
|
|
42
31
|
NSMutableDictionary *dict = [[command arguments] objectAtIndex:0];
|
|
43
32
|
NSString *directory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
|
|
@@ -372,6 +361,7 @@
|
|
|
372
361
|
|
|
373
362
|
- (void)GetSubDirectoryList:(CDVInvokedUrlCommand *)command {
|
|
374
363
|
BOOL isDir;
|
|
364
|
+
NSString *resultString = @"";
|
|
375
365
|
NSMutableDictionary * dict = [[command arguments] objectAtIndex:0];
|
|
376
366
|
NSString *directory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
|
|
377
367
|
NSString *contentsPath = [NSString stringWithFormat:@"%@/%@", directory, dict[@"filePath"]];
|
|
@@ -381,11 +371,17 @@
|
|
|
381
371
|
[contenstMutableArray removeObject:@".DS_Store"];
|
|
382
372
|
}
|
|
383
373
|
for(int index = 0; index < [contenstMutableArray count]; index++) {
|
|
384
|
-
if (
|
|
385
|
-
[
|
|
374
|
+
if ([[NSFileManager defaultManager] fileExistsAtPath:[contentsPath stringByAppendingPathComponent:contenstMutableArray[index]] isDirectory:&isDir] && isDir) {
|
|
375
|
+
if ([resultString isEqualToString:@""]) {
|
|
376
|
+
resultString = [resultString stringByAppendingString:contenstMutableArray[index]];
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
resultString = [resultString stringByAppendingString:@"|"];
|
|
380
|
+
resultString = [resultString stringByAppendingString:contenstMutableArray[index]];
|
|
381
|
+
}
|
|
386
382
|
}
|
|
387
383
|
}
|
|
388
|
-
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
|
|
384
|
+
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:resultString];
|
|
389
385
|
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
390
386
|
}
|
|
391
387
|
|
|
@@ -967,6 +963,11 @@
|
|
|
967
963
|
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
968
964
|
}
|
|
969
965
|
|
|
966
|
+
-(void)CheckLocationPermission:(CDVInvokedUrlCommand*)command {
|
|
967
|
+
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
|
|
968
|
+
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
969
|
+
}
|
|
970
|
+
|
|
970
971
|
- (void)SendLocation {
|
|
971
972
|
[self.commandDelegate runInBackground:^{
|
|
972
973
|
@try {
|