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

Show an alert dialog when no appropriate file manager was found #7452

Merged

Conversation

litetex
Copy link
Member

@litetex litetex commented Nov 27, 2021

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • See the linked issue for more details about the problem
  • If no file-manager (or SAF compatible) file manager is installed on a device now an alert shows up

Before/After Screenshots/Screen Record

  • Before: <App crashed>
  • After:
    grafik
    grafik ← Android 10+

Fixes the following issue(s)

APK 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

How to test this?

To test this you have to get rid of all your file-managers (may led to data loss or other side effects). This may require disabling system apps.

I strongly recommend doing this on an emulator only!

How to do it on an emulated Android 10 device:

  • Wipe all data from that device
  • Open a shell/commandline
  • Connect to the emulator using adb shell (ensure that you are connected to the correct device!)
  • Get into the sudo mode: su
  • Disable Androids default file-manager: pm disable com.android.documentsui
    → Now you can deploy NewPipe to the emulator and check if the changes work as expected

@litetex litetex changed the title Show an alert/dialog when no appropriate file-manager was found Show an alert-dialog when no appropriate file-manager was found Nov 27, 2021
@litetex litetex marked this pull request as ready for review November 27, 2021 15:01
@litetex litetex added the bug Issue is related to a bug label Nov 27, 2021
@triallax
Copy link
Contributor

triallax commented Nov 27, 2021

Now those no-file-manager-installed issues shall be opened no more.

Note: I think all usages of "file-picker" and "directory-picker" should be unhyphenated (as in "file picker" and "directory picker"), same with "download-settings".

sorry for nitpicking

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Isn't there too much code duplication? Why not just add a launchAndCheck(ActivityResultLauncher<Intent>, Intent, Context) function to NoFileManagerHelper, that does the try-catch?

@TacoTheDank
Copy link
Member

Kinda makes you wonder how they managed to install the app in the first place, huh? 😉

XiangRongLin
XiangRongLin previously approved these changes Dec 2, 2021
@litetex

This comment has been minimized.

@opusforlife2 opusforlife2 requested a review from Stypox December 2, 2021 19:28
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

The code looks good to me, except from the string ;-)

app/src/main/res/values/strings.xml Outdated Show resolved Hide resolved
Co-authored-by: Stypox <stypox@pm.me>
@litetex
Copy link
Member Author

litetex commented Dec 12, 2021

@Stypox
grafik

Kinda makes you wonder how they managed to install the app in the first place, huh? 😉

Black magic I guess 😆 (they likely installed it with F-Droid which requires no file-manager for installation)

Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Great :-)

@litetex litetex merged commit b21d231 into TeamNewPipe:dev Dec 14, 2021
@litetex litetex deleted the show-alert-when-file-manager-not-found branch December 14, 2021 19:01
@AudricV AudricV changed the title Show an alert-dialog when no appropriate file-manager was found Show an alert dialog when no appropriate file-manager was found Dec 14, 2021
@AudricV AudricV changed the title Show an alert dialog when no appropriate file-manager was found Show an alert dialog when no appropriate file manager was found Dec 14, 2021
@litetex litetex mentioned this pull request Feb 3, 2022
4 tasks
This was referenced Feb 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch ActivityNotFoundException (file-manager) and display a meaningful error
5 participants