cordova-plugin-mserviceinterface-2.0 1.0.55 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
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": {
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.55">
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.MANUFACTURER.equals("samsung")) {
1132
- /* SELECT FILE FOR SAMSUNG DEVICES */
1133
- openFile = new Intent("com.sec.android.app.myfiles.PICK_DATA");
1134
- openFile.putExtra("CONTENT_TYPE", "*/*");
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
- /* SELECT FILE FOR EXCEPT SAMSUNG DEVICES */
1137
- openFile = new Intent(Intent.ACTION_GET_CONTENT);
1138
- openFile.setType("*/*");
1139
- openFile.addCategory(Intent.CATEGORY_OPENABLE);
1140
- openFile.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
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, selectFile, PICK_IMAGE_FROM_GALLERY);
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 FILEPROPERTIES OF NORMAL FILES(EX:txt,.pdf,etc..,))
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());