-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[Android 11+] Correctly open URLs in browser and fix opening downloads and external players #9850
Conversation
88b6c1d
to
f329b32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good overall to me, except the following ones which needs to be solved.
Please split the sentences in Javadocs into "visible" multiple lines, i.e. lines that can be seen in the Javadoc preview, especially in the ones you changed in ShareUtils
. This would make their reading a lot better.
Could you also reword your commit message to summarize better what you have done here, so we are not really forced to look at the pull request in the future to understand better your changes? Thanks in advance!
app/src/main/java/org/schabi/newpipe/util/external_communication/KoreUtils.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/util/external_communication/KoreUtils.java
Outdated
Show resolved
Hide resolved
app/src/main/java/org/schabi/newpipe/util/external_communication/ShareUtils.java
Outdated
Show resolved
Hide resolved
- Fix misconfiguration in manifest ('http|https|market' is not valid) - Split ShareUtils functions taking a boolean parameter into pairs of functions with better names and less runtime checks - Move all Kore-related functions to KoreUtils - Remove the toast_no_player string
f329b32
to
5972e50
Compare
@AudricV done, thanks for the review :-) |
But such method is not available before API 33
5972e50
to
be4f3d9
Compare
SonarCloud Quality Gate failed. |
What is it?
Description of the changes in your PR
queries
field in the manifest. I thought I could usehttp|https|market
to specify three schemas at once, but actually it's not possible. Hence, the permission was not actually given by the Android system andgetDefaultAppPackageName
would not work. Now I removedhttps
andmarket
as we never actually query those packages, but we only queryhttp
inopenUrlInBrowser
.boolean
parameter toopenUrlInBrowser
, now there are two functions:openUrlInBrowser
, which enforces the opened app is a browsergetDefaultAppPackageName
and just hardcode the one important line of code insideopenUrlInBrowser
. This is to make sure that function is not used by accident anywhere else, since we don't wantresolveActivity
checks anywhere (tryOpenIntentInApp
should be used instead, which uses atry catch
instead).openUrlInApp
, which allows any app to be openedboolean
parameter to decide whetheropenIntentInApp
should show a toast, now there are two functions:openIntentInApp
andtryOpenIntentInApp
KoreUtils
and deduplicate code for trying to open a Kore intent and showing a failure toast.toast_no_player
string ("No app installed to play this file"), because it was basically a duplicate ofno_app_to_open_intent
("No app on your device can open this").For more info check out the javadocs in
ShareUtils
Fixes the following issue(s)
startActivity
without querying for default app #9817 and Fix opening downloads and streams on external players on Android 11+ and refactor external intents #9833APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.
Due diligence