cordova-plugin-mserviceinterface-2.0 1.0.54 → 1.0.56
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 +1 -1
- package/plugin.xml +2 -1
- package/src/android/mInterface.java +25 -14
- package/src/ios/mInterface.h +1 -0
- package/src/ios/mInterface.m +30 -0
package/package.json
CHANGED
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.56">
|
|
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>
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
48
48
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
49
49
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
50
|
+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
50
51
|
</config-file>
|
|
51
52
|
<config-file target="AndroidManifest.xml" parent="/manifest/application">
|
|
52
53
|
<service android:name="com.selfservit.util.mInterfaceService" android:foregroundServiceType="location" android:enabled="true" android:exported="true"/>
|
|
@@ -25,7 +25,6 @@ import android.graphics.Canvas;
|
|
|
25
25
|
import android.graphics.Matrix;
|
|
26
26
|
import android.graphics.Paint;
|
|
27
27
|
import android.location.Location;
|
|
28
|
-
import androidx.exifinterface.media.ExifInterface;
|
|
29
28
|
import android.media.MediaMetadataRetriever;
|
|
30
29
|
import android.media.ThumbnailUtils;
|
|
31
30
|
import android.net.ConnectivityManager;
|
|
@@ -35,7 +34,6 @@ import android.os.AsyncTask;
|
|
|
35
34
|
import android.os.Build;
|
|
36
35
|
import android.os.Bundle;
|
|
37
36
|
import android.os.Environment;
|
|
38
|
-
import android.os.PowerManager;
|
|
39
37
|
import android.provider.DocumentsContract;
|
|
40
38
|
import android.provider.MediaStore;
|
|
41
39
|
import android.provider.OpenableColumns;
|
|
@@ -52,6 +50,7 @@ import androidx.annotation.NonNull;
|
|
|
52
50
|
import androidx.annotation.Nullable;
|
|
53
51
|
import androidx.annotation.RequiresApi;
|
|
54
52
|
import androidx.core.app.ActivityCompat;
|
|
53
|
+
import androidx.exifinterface.media.ExifInterface;
|
|
55
54
|
|
|
56
55
|
import com.google.android.gms.common.ConnectionResult;
|
|
57
56
|
import com.google.android.gms.common.api.GoogleApiClient;
|
|
@@ -1051,6 +1050,12 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1051
1050
|
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.Q) {
|
|
1052
1051
|
list = new ArrayList<String>(Arrays.asList(permissions));
|
|
1053
1052
|
list.remove("android.permission.ACCESS_BACKGROUND_LOCATION");
|
|
1053
|
+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
|
1054
|
+
list.remove("android.permission.POST_NOTIFICATIONS");
|
|
1055
|
+
}else{
|
|
1056
|
+
list.remove("android.permission.WRITE_EXTERNAL_STORAGE");
|
|
1057
|
+
list.remove("android.permission.READ_EXTERNAL_STORAGE");
|
|
1058
|
+
}
|
|
1054
1059
|
permissions = list.toArray(new String[0]);
|
|
1055
1060
|
}
|
|
1056
1061
|
for (int i = 0; i < permissions.length; i++) {
|
|
@@ -1128,19 +1133,26 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1128
1133
|
selectFile;
|
|
1129
1134
|
PluginResult pluginResult;
|
|
1130
1135
|
callback = callbackContext;
|
|
1131
|
-
if (Build.
|
|
1132
|
-
|
|
1133
|
-
openFile =
|
|
1134
|
-
openFile.
|
|
1136
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
1137
|
+
// Use the ACTION_OPEN_DOCUMENT intent for Android 13 and higher
|
|
1138
|
+
openFile = new Intent(MediaStore.ACTION_PICK_IMAGES);
|
|
1139
|
+
openFile.setType("image/*");
|
|
1135
1140
|
} else {
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
+
if (Build.MANUFACTURER.equals("samsung")) {
|
|
1142
|
+
/* SELECT FILE FOR SAMSUNG DEVICES */
|
|
1143
|
+
openFile = new Intent("com.sec.android.app.myfiles.PICK_DATA");
|
|
1144
|
+
openFile.putExtra("CONTENT_TYPE", "*/*");
|
|
1145
|
+
} else {
|
|
1146
|
+
/* SELECT FILE FOR EXCEPT SAMSUNG DEVICES */
|
|
1147
|
+
openFile = new Intent(Intent.ACTION_GET_CONTENT);
|
|
1148
|
+
openFile.setType("*/*");
|
|
1149
|
+
openFile.addCategory(Intent.CATEGORY_OPENABLE);
|
|
1150
|
+
openFile.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
|
|
1151
|
+
}
|
|
1141
1152
|
}
|
|
1153
|
+
|
|
1142
1154
|
selectFile = Intent.createChooser(openFile, "Select File");
|
|
1143
|
-
cordova.startActivityForResult(this,
|
|
1155
|
+
cordova.startActivityForResult(this,selectFile, PICK_IMAGE_FROM_GALLERY);
|
|
1144
1156
|
pluginResult = new PluginResult(PluginResult.Status.NO_RESULT);
|
|
1145
1157
|
pluginResult.setKeepCallback(true);
|
|
1146
1158
|
callbackContext.sendPluginResult(pluginResult);
|
|
@@ -1714,7 +1726,7 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1714
1726
|
fileName = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME));
|
|
1715
1727
|
}
|
|
1716
1728
|
cursor.close();
|
|
1717
|
-
// API LEVEL 19 BELOW AND SAMSUNG (TO GET
|
|
1729
|
+
// API LEVEL 19 BELOW AND SAMSUNG (TO GET FILE PROPERTIES OF NORMAL FILES(EX:txt,.pdf,etc..,))
|
|
1718
1730
|
} else {
|
|
1719
1731
|
getfilePath = data.getData().getPath();
|
|
1720
1732
|
filePath = getfilePath.substring(0, getfilePath.lastIndexOf(File.separator));
|
|
@@ -1764,7 +1776,6 @@ public class mInterface extends CordovaPlugin implements com.google.android.gms.
|
|
|
1764
1776
|
Cursor cursor = null;
|
|
1765
1777
|
if (uri.getScheme().equals("file")) {
|
|
1766
1778
|
fileName = uri.getLastPathSegment();
|
|
1767
|
-
|
|
1768
1779
|
if (fileName.indexOf(".") > 0) {
|
|
1769
1780
|
fileName = fileName.substring(0, fileName.lastIndexOf("."));
|
|
1770
1781
|
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
package/src/ios/mInterface.h
CHANGED
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
- (void)GetPackageName:(CDVInvokedUrlCommand*)command;
|
|
90
90
|
- (void)UpdateNew:(CDVInvokedUrlCommand*)command;
|
|
91
91
|
- (void)StartService:(CDVInvokedUrlCommand*)command;
|
|
92
|
+
- (void)SendAttachmentToServer:(CDVInvokedUrlCommand*)command;
|
|
92
93
|
- (void)SendLocation;
|
|
93
94
|
- (void)GetLocation:(CDVInvokedUrlCommand*)command;
|
|
94
95
|
- (void)timeReader;
|
package/src/ios/mInterface.m
CHANGED
|
@@ -38,6 +38,36 @@
|
|
|
38
38
|
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
- (void)SendAttachmentToServer:(CDVInvokedUrlCommand *)command {
|
|
42
|
+
NSString *statusIndication = @"false";
|
|
43
|
+
NSMutableArray *argumentsList = [command arguments];
|
|
44
|
+
CDVPluginResult *result;
|
|
45
|
+
NSDictionary *argumentObject;
|
|
46
|
+
NSString *filePath;
|
|
47
|
+
NSString *serverPath;
|
|
48
|
+
NSString *fileName;
|
|
49
|
+
NSString *attachURL;
|
|
50
|
+
for(int index = 0; index < [argumentsList count]; index++) {
|
|
51
|
+
argumentObject = [argumentsList objectAtIndex:index];
|
|
52
|
+
filePath = argumentObject[@"filePath"];
|
|
53
|
+
serverPath = argumentObject[@"serverPath"];
|
|
54
|
+
fileName = argumentObject[@"fileName"];
|
|
55
|
+
attachURL = [NSString stringWithFormat: @"%@/common/components/msvFileHandler/UploadFiles.aspx?client_id=%@&country_code=%@&path=%@", clientUrl, clientID, countryCode, serverPath];
|
|
56
|
+
statusIndication = [self sendFilesToServer:filePath fileName:fileName requestURL:attachURL];
|
|
57
|
+
if ([statusIndication isEqualToString:@"false"]) {
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if ([statusIndication isEqualToString:@"true"]) {
|
|
62
|
+
NSString *serviceResult = [NSString stringWithFormat:@"%s", "success"];
|
|
63
|
+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:serviceResult];
|
|
64
|
+
} else {
|
|
65
|
+
NSString *serviceResult = [NSString stringWithFormat:@"%s", "failure"];
|
|
66
|
+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:serviceResult];
|
|
67
|
+
}
|
|
68
|
+
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
|
69
|
+
}
|
|
70
|
+
|
|
41
71
|
-(void)GetBase64String:(CDVInvokedUrlCommand *)command {
|
|
42
72
|
NSMutableDictionary *dict = [[command arguments] objectAtIndex:0];
|
|
43
73
|
NSString *directory = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
|