mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-19 01:39:33 +01:00
fix(YouTube - GmsCore support): Prompt to disable battery optimizations, if not done already (#2958)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
d9c5057d76
commit
82acb84b5f
@ -5,7 +5,6 @@ import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
|||||||
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
import app.revanced.patches.music.misc.gms.fingerprints.*
|
import app.revanced.patches.music.misc.gms.fingerprints.*
|
||||||
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint
|
|
||||||
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
|||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
),
|
),
|
||||||
mainActivityOnCreateFingerprint = ApplicationInitFingerprint,
|
mainActivityOnCreateFingerprint = MusicActivityOnCreateFingerprint,
|
||||||
integrationsPatchDependency = IntegrationsPatch::class,
|
integrationsPatchDependency = IntegrationsPatch::class,
|
||||||
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||||
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
|
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.music.misc.gms.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object MusicActivityOnCreateFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
parameters = listOf("Landroid/os/Bundle;"),
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "onCreate" && classDef.type.endsWith("/MusicActivity;")
|
||||||
|
}
|
||||||
|
)
|
@ -98,9 +98,9 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
|
|
||||||
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
||||||
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
1, // Hack to not disturb other patches (such as the YTMusic integrations patch).
|
0,
|
||||||
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
|
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
|
||||||
"checkGmsCore(Landroid/content/Context;)V",
|
"checkGmsCore(Landroid/app/Activity;)V",
|
||||||
) ?: throw mainActivityOnCreateFingerprint.exception
|
) ?: throw mainActivityOnCreateFingerprint.exception
|
||||||
|
|
||||||
// Change the vendor of GmsCore in ReVanced Integrations.
|
// Change the vendor of GmsCore in ReVanced Integrations.
|
||||||
|
@ -42,13 +42,12 @@
|
|||||||
</patch>
|
</patch>
|
||||||
<patch id="misc.gms.BaseGmsCoreSupportResourcePatch">
|
<patch id="misc.gms.BaseGmsCoreSupportResourcePatch">
|
||||||
<!-- Translations of this should not be longer than the original English text, otherwise the text can be clipped and not entirely shown. -->
|
<!-- Translations of this should not be longer than the original English text, otherwise the text can be clipped and not entirely shown. -->
|
||||||
<string name="gms_core_toast_not_installed_message">GmsCore is not installed. Install it.</string>
|
<string name="gms_core_toast_not_installed_message">MicroG GmsCore is not installed. Install it.</string>
|
||||||
<!-- Translations of this should not be longer than the original English text, otherwise the text can be clipped and not entirely shown. -->
|
|
||||||
<string name="gms_core_toast_not_whitelisted_message">Follow the \"Don\'t kill my app\" guide for GmsCore.</string>
|
|
||||||
<string name="gms_core_dialog_title">Action needed</string>
|
<string name="gms_core_dialog_title">Action needed</string>
|
||||||
<string name="gms_core_dialog_not_whitelisted_using_battery_optimizations_message">GmsCore is not whitelisted from battery optimization.\n\nFollow the \"Don\'t kill my app\" guide for GmsCore.</string>
|
<string name="gms_core_dialog_not_whitelisted_not_allowed_in_background_message">MicroG GmsCore does not have permission to run in the background.\n\nFollow the \"Don\'t kill my app\" guide for your phone, and apply the instructions to your MicroG installation.\n\nThis is required for the app to work.</string>
|
||||||
<string name="gms_core_dialog_not_whitelisted_not_allowed_in_background_message">GmsCore does not have permission to run in the background.\n\nFollow the \"Don\'t kill my app\" guide for GmsCore.</string>
|
<string name="gms_core_dialog_open_website_text">Open website</string>
|
||||||
<string name="gms_core_dialog_ok_button_text">Open website</string>
|
<string name="gms_core_dialog_not_whitelisted_using_battery_optimizations_message">MicroG GmsCore battery optimizations must be disabled to prevent issues.\n\nTap on the continue button and disable battery optimizations.</string>
|
||||||
|
<string name="gms_core_dialog_continue_text">Continue</string>
|
||||||
</patch>
|
</patch>
|
||||||
</app>
|
</app>
|
||||||
<app id="youtube">
|
<app id="youtube">
|
||||||
@ -573,7 +572,7 @@
|
|||||||
<string name="revanced_hide_shorts_subscribe_button_paused_title">Hide subscribe button when paused</string>
|
<string name="revanced_hide_shorts_subscribe_button_paused_title">Hide subscribe button when paused</string>
|
||||||
<string name="revanced_hide_shorts_subscribe_button_paused_summary_on">Subscribe button is hidden</string>
|
<string name="revanced_hide_shorts_subscribe_button_paused_summary_on">Subscribe button is hidden</string>
|
||||||
<string name="revanced_hide_shorts_subscribe_button_paused_summary_off">Subscribe button is shown</string>
|
<string name="revanced_hide_shorts_subscribe_button_paused_summary_off">Subscribe button is shown</string>
|
||||||
<!-- 'thanks' should be translated using the same localized wording YouTube displays for the button.
|
<!-- 'thanks' should be translated using the same localized wording YouTube displays for the button.
|
||||||
If the button never shows up, then translate the button name normally. -->
|
If the button never shows up, then translate the button name normally. -->
|
||||||
<string name="revanced_hide_shorts_thanks_button_title">Hide thanks button</string>
|
<string name="revanced_hide_shorts_thanks_button_title">Hide thanks button</string>
|
||||||
<string name="revanced_hide_shorts_thanks_button_summary_on">Thanks button is hidden</string>
|
<string name="revanced_hide_shorts_thanks_button_summary_on">Thanks button is hidden</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user