Compare commits

..

4 Commits

Author SHA1 Message Date
semantic-release-bot
e74df8bba9 chore(release): 2.175.0-dev.13 [skip ci]
# [2.175.0-dev.13](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.12...v2.175.0-dev.13) (2023-05-29)

### Bug Fixes

* **settings:** sort setting preferences using lowercase ([#2312](https://github.com/revanced/revanced-patches/issues/2312)) ([b285e46](b285e4663b))
2023-05-29 10:02:59 +00:00
LisoUseInAIKyrios
b285e4663b fix(settings): sort setting preferences using lowercase (#2312) 2023-05-29 14:01:13 +04:00
semantic-release-bot
9159c77725 chore(release): 2.175.0-dev.12 [skip ci]
# [2.175.0-dev.12](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.11...v2.175.0-dev.12) (2023-05-29)

### Bug Fixes

* **youtube/integrations:** fix playback of embedded videos ([#2304](https://github.com/revanced/revanced-patches/issues/2304)) ([3ac1be3](3ac1be3f01))
2023-05-29 07:25:57 +00:00
LisoUseInAIKyrios
3ac1be3f01 fix(youtube/integrations): fix playback of embedded videos (#2304) 2023-05-29 11:23:54 +04:00
13 changed files with 139 additions and 28 deletions

View File

@@ -1,3 +1,17 @@
# [2.175.0-dev.13](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.12...v2.175.0-dev.13) (2023-05-29)
### Bug Fixes
* **settings:** sort setting preferences using lowercase ([#2312](https://github.com/revanced/revanced-patches/issues/2312)) ([2743a95](https://github.com/revanced/revanced-patches/commit/2743a95b417a6023799035e30631e7b3a68bcc45))
# [2.175.0-dev.12](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.11...v2.175.0-dev.12) (2023-05-29)
### Bug Fixes
* **youtube/integrations:** fix playback of embedded videos ([#2304](https://github.com/revanced/revanced-patches/issues/2304)) ([1dffbaf](https://github.com/revanced/revanced-patches/commit/1dffbaf0aa73f0f703516648d5cd935000fa2770))
# [2.175.0-dev.11](https://github.com/revanced/revanced-patches/compare/v2.175.0-dev.10...v2.175.0-dev.11) (2023-05-28)

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.175.0-dev.11
version = 2.175.0-dev.13

View File

@@ -35,8 +35,8 @@ internal abstract class AbstractPreferenceScreen(
return PreferenceScreen(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value } +
categories.sortedBy { it.title }.map { it.transform() },
preferences.sortedBy { it.title.value.lowercase() } +
categories.sortedBy { it.title.lowercase() }.map { it.transform() },
summary?.let { summary ->
StringResource("${key}_summary", summary)
}
@@ -63,7 +63,7 @@ internal abstract class AbstractPreferenceScreen(
return PreferenceCategory(
key,
StringResource("${key}_title", title),
preferences.sortedBy { it.title.value }
preferences.sortedBy { it.title.value.lowercase() }
)
}

View File

@@ -0,0 +1,17 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback.
* It appears this hook may no longer be needed as one of the constructor parameters is the already hooked
* [EmbeddedPlayerControlsOverlayFingerprint]
*/
object APIPlayerServiceFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
customFingerprint = { methodDef, _ -> methodDef.definingClass == "Lcom/google/android/apps/youtube/embeddedplayer/service/service/jar/ApiPlayerService;" },
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -2,6 +2,10 @@ package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
object InitFingerprint : IntegrationsFingerprint(
/**
* Hooks the context when the app is launched as a regular application (and is not an embedded video playback).
*/
object ApplicationInitFingerprint : IntegrationsFingerprint(
strings = listOf("Application creation", "Application.onCreate"),
// Integrations context is the Activity itself.
)

View File

@@ -4,12 +4,19 @@ import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback inside Google Play store (and probably other situations as well).
*
* Note: this fingerprint may no longer be needed, as it appears
* [RemoteEmbedFragmentFingerprint] may be set before this hook is called.
*/
object EmbeddedPlayerControlsOverlayFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
returnType = "V",
parameters = listOf("L", "L", "L"),
parameters = listOf("Landroid/content/Context;", "L", "L"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass.startsWith("Lcom/google/android/apps/youtube/embeddedplayer/service/ui/overlays/controlsoverlay/remoteloaded/")
},
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -0,0 +1,20 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback inside the Google app (such as the in app 'discover' tab).
*
* Note: this fingerprint may or may not be needed, as
* [RemoteEmbedFragmentFingerprint] might be set before this is called.
*/
object EmbeddedPlayerFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
returnType = "L",
parameters = listOf("L", "L", "Landroid/content/Context;"),
strings = listOf("android.hardware.type.television"), // String is also found in other classes
// Integrations context is the third method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size + 2 }
)

View File

@@ -0,0 +1,19 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback. Likely covers Google Play store and other Google products.
*/
object RemoteEmbedFragmentFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
returnType = "V",
parameters = listOf("Landroid/content/Context;", "L", "L"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/apps/youtube/embeddedplayer/service/jar/client/RemoteEmbedFragment;"
},
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -0,0 +1,19 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
import org.jf.dexlib2.AccessFlags
/**
* For embedded playback inside 3rd party android app (such as 3rd party Reddit apps).
*/
object RemoteEmbeddedPlayerFingerprint : IntegrationsFingerprint(
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
returnType = "V",
parameters = listOf("Landroid/content/Context;", "L", "L", "Z"),
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/youtube/api/jar/client/RemoteEmbeddedPlayer;"
},
// Integrations context is the first method parameter.
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -1,8 +0,0 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
object ServiceFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("ApiPlayerService;") && methodDef.name == "<init>" },
contextRegisterResolver = { it.implementation!!.registerCount - it.parameters.size }
)

View File

@@ -0,0 +1,18 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
/**
* Old API activity to embed YouTube into 3rd party Android apps.
*
* In 2023 supported was ended and is no longer available,
* but this may still be used by older apps:
* https://developers.google.com/youtube/android/player
*/
object StandalonePlayerActivityFingerprint : IntegrationsFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass == "Lcom/google/android/youtube/api/StandalonePlayerActivity;"
&& methodDef.name == "onCreate"
},
// Integrations context is the Activity itself.
)

View File

@@ -1,10 +0,0 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch.IntegrationsFingerprint
object StandalonePlayerFingerprint : IntegrationsFingerprint(
strings = listOf(
"Invalid PlaybackStartDescriptor. Returning the instance itself.",
"com.google.android.music",
),
)

View File

@@ -4,15 +4,26 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.patch.annotations.RequiresIntegrations
import app.revanced.patches.shared.integrations.patch.AbstractIntegrationsPatch
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.EmbeddedPlayerControlsOverlayFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.EmbeddedPlayerFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.ApplicationInitFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.RemoteEmbedFragmentFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.RemoteEmbeddedPlayerFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.APIPlayerServiceFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerActivityFingerprint
@Name("integrations")
@IntegrationsCompatibility
@RequiresIntegrations
class IntegrationsPatch : AbstractIntegrationsPatch(
"Lapp/revanced/integrations/utils/ReVancedUtils;",
listOf(InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint, EmbeddedPlayerControlsOverlayFingerprint),
listOf(
ApplicationInitFingerprint,
StandalonePlayerActivityFingerprint,
RemoteEmbeddedPlayerFingerprint,
RemoteEmbedFragmentFingerprint,
EmbeddedPlayerControlsOverlayFingerprint,
EmbeddedPlayerFingerprint,
APIPlayerServiceFingerprint,
),
)