Skip to content

Commit

Permalink
fix(youtube/client-spoof): update settings text for known side effect…
Browse files Browse the repository at this point in the history
…s of spoof signature (ReVanced#2476)
  • Loading branch information
LisoUseInAIKyrios authored Jun 23, 2023
1 parent 1686cb7 commit 6756f80
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.OpenCronetDataSourceFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.ProtobufParameterBuilderFingerprint
import app.revanced.patches.youtube.misc.fix.playback.fingerprints.SubtitleWindowSettingsConstructorFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.youtube.video.videoid.patch.VideoIdPatch
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction

@Name("spoof-signature-verification")
Expand All @@ -30,14 +28,12 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
IntegrationsPatch::class,
SettingsPatch::class,
PlayerTypeHookPatch::class,
VideoIdPatch::class
])
@Version("0.0.1")
class SpoofSignatureVerificationPatch : BytecodePatch(
listOf(
ProtobufParameterBuilderFingerprint,
OpenCronetDataSourceFingerprint,
SubtitleWindowSettingsConstructorFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
Expand All @@ -48,17 +44,15 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
StringResource("revanced_spoof_signature_verification_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• End screen cards are always hidden\\n"
+ "• Ambient mode may not work\\n"
+ "• Seekbar thumbnails are hidden\\n"
+ "• Downloading videos may not work"),
StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"),
StringResource("revanced_spoof_signature_verification_user_dialog_message",
"Turning off this setting may cause playback issues.")
)
)

// Hook video id, required for subtitle fix.
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")

// hook parameter
ProtobufParameterBuilderFingerprint.result?.let {
val setParamMethod = context
Expand Down Expand Up @@ -95,25 +89,6 @@ class SpoofSignatureVerificationPatch : BytecodePatch(

} ?: return OpenCronetDataSourceFingerprint.toErrorResult()

// hook override subtitles
SubtitleWindowSettingsConstructorFingerprint.result?.let {
it.mutableMethod.apply {
addInstructions(
0,
"""
invoke-static {p1, p2, p3, p4, p5}, $INTEGRATIONS_CLASS_DESCRIPTOR->getSubtitleWindowSettingsOverride(IIIZZ)[I
move-result-object v0
const/4 v1, 0x0
aget p1, v0, v1 # ap, anchor position
const/4 v1, 0x1
aget p2, v0, v1 # ah, horizontal anchor
const/4 v1, 0x2
aget p3, v0, v1 # av, vertical anchor
"""
)
}
} ?: return SubtitleWindowSettingsConstructorFingerprint.toErrorResult()

return PatchResultSuccess()
}

Expand Down

0 comments on commit 6756f80

Please sign in to comment.