[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16261742#comment-16261742 ] ASF GitHub Bot commented on CB-12107: - maverickmishra commented on issue #165: CB-12107: (android) Trigger media scanner after downloading a file in… URL: https://github.com/apache/cordova-plugin-file-transfer/pull/165#issuecomment-346204062 With the new features introduced in [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), this plugin is not needed any more. Migrating from this plugin to using the new features of [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest), is explained in this [Cordova blog post](https://cordova.apache.org/blog/2017/10/18/from-filetransfer-to-xhr2.html). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-plugin-file-transfer (DEPRECATED) > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe >Assignee: Joe Bowser > Labels: Android > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16261743#comment-16261743 ] ASF GitHub Bot commented on CB-12107: - maverickmishra closed pull request #165: CB-12107: (android) Trigger media scanner after downloading a file in… URL: https://github.com/apache/cordova-plugin-file-transfer/pull/165 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java index f9c2037..9b80891 100644 --- a/src/android/FileTransfer.java +++ b/src/android/FileTransfer.java @@ -62,8 +62,10 @@ Licensed to the Apache Software Foundation (ASF) under one import org.json.JSONException; import org.json.JSONObject; +import android.content.Intent; import android.net.Uri; import android.os.Build; +import android.os.Environment; import android.webkit.CookieManager; public class FileTransfer extends CordovaPlugin { @@ -914,6 +916,11 @@ public void run() { LOG.d(LOG_TAG, "Saved file: " + target); +String path = targetUri.getPath(); +if( isPublicDirectory( path ) ) { +Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, targetUri); +cordova.getActivity().sendBroadcast(intent); +} // create FileEntry object Class webViewClass = webView.getClass(); @@ -1025,4 +1032,24 @@ public void run() { }); } } + +/** + * Checks if path belongs to a public directory described by cordova-plugin-file + * https://github.com/apache/cordova-plugin-file#android-file-system-layout + * @param absolutePath + * @return boolean + */ +private boolean isPublicDirectory(String absolutePath) { +if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { +// Lollipop has a bug where SD cards are null. +for (File f : webView.getContext().getExternalMediaDirs()) { +if(f != null && absolutePath.startsWith(f.getAbsolutePath())) { +return true; +} +} +} + +String extPath = Environment.getExternalStorageDirectory().getAbsolutePath(); +return absolutePath.startsWith(extPath); +} } This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-plugin-file-transfer (DEPRECATED) > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe >Assignee: Joe Bowser > Labels: Android > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15959135#comment-15959135 ] ASF GitHub Bot commented on CB-12107: - Github user alsorokin commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 Let there be tests > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe >Assignee: Joe Bowser > Labels: Android > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15663215#comment-15663215 ] ASF GitHub Bot commented on CB-12107: - Github user beatgrabe commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 @infil00p Alright…keep me updated > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15658362#comment-15658362 ] ASF GitHub Bot commented on CB-12107: - Github user infil00p commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 @beatgrabe And the tests that are failing are all related to this plugin. Until these pass, I'm not going to merge it in. > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15657126#comment-15657126 ] ASF GitHub Bot commented on CB-12107: - Github user beatgrabe commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 @infil00p Seems like project is still broken… > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15656737#comment-15656737 ] ASF GitHub Bot commented on CB-12107: - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 Cordova CI Build has one or more failures. Link: http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/43/ 312 tests run, 26 skipped, 50 failed. > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15655493#comment-15655493 ] ASF GitHub Bot commented on CB-12107: - Github user infil00p commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 @beatgrabe Can you send an empty commit to the branch so that we can re-bump the CI? I think it got broken during a past build unrelated to this one. Thanks! > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15632676#comment-15632676 ] ASF GitHub Bot commented on CB-12107: - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-file-transfer/pull/165 Cordova CI Build has one or more failures. Link: http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-file-transfer-pr/40/ 312 tests run, 26 skipped, 50 failed. > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12107) Downloading a file into public folder does not show up on MTP
[ https://issues.apache.org/jira/browse/CB-12107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15632218#comment-15632218 ] ASF GitHub Bot commented on CB-12107: - GitHub user beatgrabe opened a pull request: https://github.com/apache/cordova-plugin-file-transfer/pull/165 CB-12107: (android) Trigger media scanner after downloading a file in… ### Platforms affected Android ### What does this PR do? Automatically triggers "ACTION_MEDIA_SCANNER_SCAN_FILE" broadcasting when a new file was downloadws into a public directory on android ### What testing has been done on this change? - Code was tested on a real Nexus 4 device. - npm test ### Checklist - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB- is the JIRA ID & "android" is the platform affected. - [x] Added automated test coverage as appropriate for this change. …to a public directory You can merge this pull request into a Git repository by running: $ git pull https://github.com/fairmanager-cordova/cordova-plugin-file-transfer CB-12107 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-file-transfer/pull/165.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #165 commit 123e3068636ff2c3fe73c48def7e698fa0794a90 Author: BeatDate: 2016-11-02T15:42:30Z CB-12107: (android) Trigger media scanner after downloading a file into a public directory > Downloading a file into public folder does not show up on MTP > - > > Key: CB-12107 > URL: https://issues.apache.org/jira/browse/CB-12107 > Project: Apache Cordova > Issue Type: Improvement > Components: Android, Plugin File Transfer > Environment: Nexus 4 and Windows 10 >Reporter: Beat Grabe > Labels: cordova-plugin-file-transfer > > Using the cordova-plugin-file-transfer to download a file from external url > works as aspected. But when you want to see the file on Windows by using MTP > when the device is connected via USB the file does not show up. Same > behaviour on android photos or gallery application when you want to download > an image file. The Plugin should be broadcasting > "ACTION_MEDIA_SCANNER_SCAN_FILE" on the downloaded file to see it immediately. > I will submit a PR on GitHub for a tested fix, which was inspired by a > similar issue on the cordova-plugin-file > ([CB-7487|https://issues.apache.org/jira/browse/CB-7487] && > [CB-8663|https://issues.apache.org/jira/browse/CB-8663]). -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org