From 2eab5f60550d3827d78134b79e7b025775722aba Mon Sep 17 00:00:00 2001 From: Bob Moore <@remoorejr> Date: Wed, 15 May 2019 14:24:27 -0400 Subject: [PATCH 1/6] Modified to resolve issue with conflicting provider_paths --- plugin.xml | 13 ++++++++++--- src/android/FileProvider.java | 4 ++++ .../{provider_paths.xml => open_provider_paths.xml} | 0 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 src/android/FileProvider.java rename src/android/{provider_paths.xml => open_provider_paths.xml} (100%) diff --git a/plugin.xml b/plugin.xml index 7518434..ca8be89 100644 --- a/plugin.xml +++ b/plugin.xml @@ -16,12 +16,19 @@ - - + + - + + diff --git a/src/android/FileProvider.java b/src/android/FileProvider.java new file mode 100644 index 0000000..bb50524 --- /dev/null +++ b/src/android/FileProvider.java @@ -0,0 +1,4 @@ +package com.disusered.cordova.open; + +public class FileProvider extends android.support.v4.content.FileProvider {} + diff --git a/src/android/provider_paths.xml b/src/android/open_provider_paths.xml similarity index 100% rename from src/android/provider_paths.xml rename to src/android/open_provider_paths.xml From c1d62327187ddfb31714e04facd9beaa86bfa363 Mon Sep 17 00:00:00 2001 From: Bob Moore <@remoorejr> Date: Fri, 7 Jun 2019 15:50:48 -0400 Subject: [PATCH 2/6] Update plugin.xml Added ANDROID_SUPPORT_V4_VERSION to avoid errors with android.support.v4.content --- plugin.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin.xml b/plugin.xml index ca8be89..3182e79 100644 --- a/plugin.xml +++ b/plugin.xml @@ -10,6 +10,8 @@ + + From 444402bd88e2864c74e7112293cf14ffbc55c6ce Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Tue, 25 Oct 2022 11:56:28 -0400 Subject: [PATCH 3/6] Modified to use AndroidX library, bump version --- package.json | 2 +- plugin.xml | 8 +++++--- src/android/FileProvider.java | 2 +- src/android/Open.java | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ae14a16..e15e6c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-open", - "version": "1.1.0", + "version": "1.2.0", "description": "Open audio, video, images and more with applications installed on the user's device", "cordova": { "id": "com.disusered.open", diff --git a/plugin.xml b/plugin.xml index 3182e79..434aff9 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + Open Open audio, video, images and more with applications installed on the user's device MIT @@ -10,8 +10,10 @@ - - + + + + diff --git a/src/android/FileProvider.java b/src/android/FileProvider.java index bb50524..951dc28 100644 --- a/src/android/FileProvider.java +++ b/src/android/FileProvider.java @@ -1,4 +1,4 @@ package com.disusered.cordova.open; -public class FileProvider extends android.support.v4.content.FileProvider {} +public class FileProvider extends androidx.core.content.FileProvider {} diff --git a/src/android/Open.java b/src/android/Open.java index 8a30c19..3e24843 100644 --- a/src/android/Open.java +++ b/src/android/Open.java @@ -9,7 +9,7 @@ import android.content.Context; import android.net.Uri; import android.content.Intent; -import android.support.v4.content.FileProvider; +import androidx.core.content.FileProvider; import android.webkit.MimeTypeMap; import android.content.ActivityNotFoundException; import android.os.Build; From 8c09f715c4110210983b4c039a44d8e884370124 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Tue, 25 Oct 2022 12:10:23 -0400 Subject: [PATCH 4/6] Update README.md --- README.md | 59 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index aa815bd..77371fe 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ -cordova-open -==== +# cordova-open -[![Build Status](https://travis-ci.org/disusered/cordova-open.svg)](https://travis-ci.org/disusered/cordova-open) [![Code Climate](https://codeclimate.com/github/disusered/cordova-open/badges/gpa.svg)](https://codeclimate.com/github/disusered/cordova-open) +[![Build Status](https://travis-ci.org/disusered/cordova-open.svg)](https://travis-ci.org/disusered/cordova-open) [![Code Climate](https://codeclimate.com/github/disusered/cordova-open/badges/gpa.svg)](https://codeclimate.com/github/disusered/cordova-open) > Open audio, video, images and more with applications installed on the user's device. @@ -9,30 +8,36 @@ cordova-open ## Install +This version or the Cordova Open Plugin must be installed from the Github Repo listed below. + ```bash -$ cordova plugin add cordova-open +$ cordova plugin add https://github.com/remoorejr/cordova-open.git ``` +## Features + +- This version uses the newer AndroidX libraries for compatibility with the latest versions of Android. + ## Usage ```javascript var open = cordova.plugins.disusered.open; function success() { - console.log('Success'); + console.log("Success"); } function error(code) { if (code === 1) { - console.log('No file handler found'); + console.log("No file handler found"); } else { - console.log('Undefined error'); + console.log("Undefined error"); } } function progress(progressEvent) { if (progressEvent.lengthComputable) { - var perc = Math.floor(progressEvent.loaded / progressEvent.total * 100); + var perc = Math.floor((progressEvent.loaded / progressEvent.total) * 100); // update UI with status, for example: // statusDom.innerHTML = perc + "% loaded..."; } else { @@ -45,30 +50,44 @@ function progress(progressEvent) { } */ } -}; +} -open('file:/storage/sdcard/DCIM/Camera/1404177327783.jpg', success, error, progress); +open( + "file:/storage/sdcard/DCIM/Camera/1404177327783.jpg", + success, + error, + progress +); ``` ## API + The plugin exposes the following methods: ```javascript -cordova.plugins.disusered.open(file, success, error, progress, trustAllCertificates) +cordova.plugins.disusered.open( + file, + success, + error, + progress, + trustAllCertificates +); ``` #### Parameters: -* __file:__ A string representing a URI -* __success:__ Optional success callback -* __error:__ Optional error callback -* __progress:__ Optional progress callback -* __trustAllCertificates:__ Optional, trusts any certificate when the connection is done over HTTPS. + +- **file:** A string representing a URI +- **success:** Optional success callback +- **error:** Optional error callback +- **progress:** Optional progress callback +- **trustAllCertificates:** Optional, trusts any certificate when the connection is done over HTTPS. #### Events: -* __pause:__ Opening files emits Cordova's pause event (Android only) -* __resume:__ Closing the file emits Cordova's resume event -* __open.success:__ File is found and can be opened -* __open.error:__ File not found, or no file handler is installed + +- **pause:** Opening files emits Cordova's pause event (Android only) +- **resume:** Closing the file emits Cordova's resume event +- **open.success:** File is found and can be opened +- **open.error:** File not found, or no file handler is installed ## License From 5839ade4392b62525e552a041272c213c19cbdf5 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Wed, 26 Oct 2022 12:11:27 -0400 Subject: [PATCH 5/6] Update plugin.xml Load dependency from github repo --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 434aff9..7adbb65 100644 --- a/plugin.xml +++ b/plugin.xml @@ -46,5 +46,5 @@ - + From 4554a1e20173144e075eed4304756e30ca769a20 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Wed, 26 Oct 2022 12:24:27 -0400 Subject: [PATCH 6/6] Update plugin.xml add dependency versions --- plugin.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.xml b/plugin.xml index 7adbb65..da98583 100644 --- a/plugin.xml +++ b/plugin.xml @@ -45,6 +45,6 @@ - - + +