-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...youtube/navigation/navigationbuttons/fingerprints/MainActivityOnBackPressedFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
internal object MainActivityOnBackPressedFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "V", | ||
parameters = listOf(), | ||
customFingerprint = { methodDef, _ -> | ||
(methodDef.definingClass.endsWith("MainActivity;") || | ||
// Old versions of YouTube called this class "WatchWhileActivity" instead. | ||
methodDef.definingClass.endsWith("WatchWhileActivity;")) | ||
&& methodDef.name == "onBackPressed" | ||
} | ||
) |
26 changes: 26 additions & 0 deletions
26
...be/navigation/navigationbuttons/fingerprints/PivotBarButtonsViewSetSelectedFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.patches.youtube.navigation.navigationbuttons.fingerprints.PivotBarButtonsViewSetSelectedFingerprint.indexOfSetViewSelectedInstruction | ||
import app.revanced.util.getReference | ||
import app.revanced.util.indexOfFirstInstruction | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.Method | ||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference | ||
|
||
internal object PivotBarButtonsViewSetSelectedFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
parameters = listOf("I", "Z"), | ||
returnType = "V", | ||
customFingerprint = { methodDef, classDef -> | ||
classDef.type == "Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;" && | ||
indexOfSetViewSelectedInstruction(methodDef) >= 0 | ||
} | ||
) { | ||
fun indexOfSetViewSelectedInstruction(methodDef: Method) = | ||
methodDef.indexOfFirstInstruction { | ||
opcode == Opcode.INVOKE_VIRTUAL && getReference<MethodReference>()?.name == "setSelected" | ||
} | ||
} |