Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements #6

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

giordanocardillo
Copy link

  • Removed unneded nanoassert dependency
  • Added clobbers to allow usage by cordova.plugins.DownloadManager syntax
  • Updated README accordingly

www/index.js Show resolved Hide resolved
@@ -146,7 +146,7 @@ private static JSONArray JSONFromCursor(Cursor cursor) throws JSONException {
rowObject.put("title", cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_TITLE)));
rowObject.put("description", cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_DESCRIPTION)));
rowObject.put("mediaType", cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_MEDIA_TYPE)));
rowObject.put("localFilename", cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_FILENAME)));
rowObject.put("localFilename", cursor.getString(cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a mistake or on purpose?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, testing on android 7+ told me that COLUMN_LOCAL_FILENAME was deprecated and resulted to error in callback. Searching upon deprecation brought to solutions using COLUMN_LOCAL_URI instead.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@giordanocardillo giordanocardillo Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen this, I just thought that it was a bit overkilling for the purpose of the plugin. It's basically the same thing just without the "file://" in front. So maybe just DownloadManager.COLUMN_LOCAL_URI.replace("file://", "") could be fine.

https://stackoverflow.com/questions/38839688/downloadmanager-column-local-filename-deprecated

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, so the snippet they refer to I don't think belongs here. What I'm more considering is whether this property should be present if the API is > 24. That can however also quickly turn into a mess. What does other plugins do in cases like this? I know it's very common in iOS plugins to feature detect

Copy link
Author

@giordanocardillo giordanocardillo Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use platform version detection for the purpose. E. G.
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.N){ ... }

Copy link
Author

@giordanocardillo giordanocardillo Aug 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added feature detection in latest commit

plugin.xml Outdated Show resolved Hide resolved
@giordanocardillo
Copy link
Author

Any news about this? Can you merge?

@emilbayes
Copy link
Owner

I'm happy to take the java and readme changes but you need to revert the rest.

@phatpaul
Copy link

What is the reasoning to not accept this PR?
My environment is not making it convenient for me to do a require(). It would be convenient to expose the plugin at the typical cordova.plugins.DownloadManager.

@giordanocardillo
Copy link
Author

giordanocardillo commented Mar 20, 2021

Sorry to say this but the repo owner is stubborn and doesn’t want to remove an unneeded dependency (from a library he created) that just resolves in an if statement for the usage made. I guess nanoassert it’s useful in other cases, but here it’s just overhead.

@phatpaul
Copy link

Nevermind. I found https://github.com/vasani-arpit/cordova-plugin-downloadmanager which is working for me. Thanks @giordanocardillo for your contribution which pointed me to my solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants