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

bug: (YouTube - External downloader) The patch becomes weird #2838

Closed
3 tasks done
cyberboh opened this issue Mar 5, 2024 · 3 comments · Fixed by #2841
Closed
3 tasks done

bug: (YouTube - External downloader) The patch becomes weird #2838

cyberboh opened this issue Mar 5, 2024 · 3 comments · Fixed by #2841
Labels
Bug report Something isn't working

Comments

@cyberboh
Copy link

cyberboh commented Mar 5, 2024

Bug description

As the patch description says, based on this new feature/commit https://github.com/ReVanced/revanced-patches/releases/tag/v4.4.0-dev.2 it will hook in-app download button to external downloader. In this case i'm using Seal). But after i applying patch, it becomes weird.

With default settings like this:
Screenshot_083711

I get toast error like this:
Screenshot_084231

Then i put com.junkfood.seal into external downloader box, then it shows error toast:
Screenshot_084339

It does not matter which i enabled or disabled (Show external download button or Use in-app download button) , the 3rd error toast above is appearing.

Error logs

03-05 09:20:35.456  1404  1404 D revanced: DownloadsPatch: Launching external downloader
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: Failed to launch the intent: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.app.ContextImpl.startActivity(ContextImpl.java:1036)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.app.ContextImpl.startActivity(ContextImpl.java:1005)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.content.ContextWrapper.startActivity(ContextWrapper.java:383)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at app.revanced.integrations.youtube.patches.DownloadsPatch.launchExternalDownloader(DownloadsPatch.java:50)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at app.revanced.integrations.youtube.videoplayer.ExternalDownloadButton.onDownloadClick(ExternalDownloadButton.java:47)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at app.revanced.integrations.youtube.videoplayer.ExternalDownloadButton.$r8$lambda$_KkOTCuqFRiXBpSso_gWuUO5hJQ(ExternalDownloadButton.java:0)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at app.revanced.integrations.youtube.videoplayer.ExternalDownloadButton$$ExternalSyntheticLambda1.onClick(R8$$SyntheticClass:0)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.view.View.performClick(View.java:7317)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.view.View.performClickInternal(View.java:7291)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.view.View.access$3600(View.java:838)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.view.View$PerformClick.run(View.java:28247)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.os.Handler.handleCallback(Handler.java:900)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.os.Handler.dispatchMessage(Handler.java:103)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.os.Looper.loop(Looper.java:219)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at android.app.ActivityThread.main(ActivityThread.java:8668)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at java.lang.reflect.Method.invoke(Native Method)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
03-05 09:20:35.458  1404  1404 E revanced: DownloadsPatch: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
03-05 09:20:35.458  1404  1404 D revanced: Utils: Showing toast: DownloadsPatch: Failed to launch the intent: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

Solution

No response

Additional context

No response

Acknowledgements

  • This issue is not a duplicate of an existing bug report.
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@cyberboh cyberboh added the Bug report Something isn't working label Mar 5, 2024
@oSumAtrIX
Copy link
Member

This may be caused because the context parameter has been removed and instead Utils.getContext() is used.

@oSumAtrIX oSumAtrIX added the Waiting on author Further information is requested label Mar 5, 2024
@MarcaDian
Copy link
Contributor

MarcaDian commented Mar 5, 2024

I am using the dev code and I am haven't this third tost error.

Screenshot_2024-03-05-08-08-54-556_app revanced android youtube
Screenshot_2024-03-05-08-07-44-763_app revanced android youtube

@oSumAtrIX The only strange thing for me is that, as the author writes, in order to specify the name of the package external downloader, you need to activate the button in the player, but for example, I don't use it, maybe need to remove the parent parameter? Or add parent parameter to in-app button item

@LisoUseInAIKyrios
Copy link
Contributor

The settings can be changed so the package text field is available if either the player or download button is enabled:
parentsAny(EXTERNAL_DOWNLOADER, USE_IN_APP_DOWNLOAD_BUTTON))

Util.context is set from multiple hooks (and it can be set multiple times). I think the context error is because a non application context is overwriting the Util field with some other context. This might be fixed by using a Util.setContext(Context) method, that then sets the context only if Until.context is null OR if the context parameter is an Activity. Then non Activity contexts will not overwrite any existing application context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants