Skip to content

Commit

Permalink
chore: lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Oct 13, 2024
1 parent bc48f2b commit 20389d5
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ object PlayerComponentsPatch : BaseBytecodePatch(
.filter { (_, instruction) ->
val reference = (instruction as? ReferenceInstruction)?.reference
instruction.opcode == Opcode.INVOKE_VIRTUAL &&
reference is MethodReference &&
reference is MethodReference &&
reference.toString() == AUDIO_VIDEO_SWITCH_TOGGLE_VISIBILITY
}
.map { (index, _) -> index }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ object ChangePackageNamePatch : BaseResourcePatch(
node.textContent = when (node.getAttribute("name")) {
"provider_authority_appdata", "provider_authority_file",
"provider_authority_userdata", "provider_workmanager_init"
-> node.textContent.replace(PACKAGE_NAME_REDDIT, redditPackageName)
-> node.textContent.replace(PACKAGE_NAME_REDDIT, redditPackageName)

else -> continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ abstract class BaseGmsCoreSupportPatch(
in PERMISSIONS,
in ACTIONS,
in AUTHORITIES,
-> referencedString.replace("com.google", gmsCoreVendor)
-> referencedString.replace("com.google", gmsCoreVendor)

// No vendor prefix for whatever reason...
"subscribedfeeds" -> "$gmsCoreVendor.subscribedfeeds"
Expand Down Expand Up @@ -279,7 +279,7 @@ abstract class BaseGmsCoreSupportPatch(
when (string) {
"$fromPackageName.SuggestionsProvider",
"$fromPackageName.fileprovider",
-> string.replace(fromPackageName, toPackageName)
-> string.replace(fromPackageName, toPackageName)

else -> null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ internal object AccessibilityOfflineButtonSyncFingerprint : MethodFingerprint(
return@custom false
}

val endsWithMethodParameterList = parameterTypes.slice(parameterSize - 3..< parameterSize)
val endsWithMethodParameterList = parameterTypes.slice(parameterSize - 3..<parameterSize)
parametersEqual(ENDS_WITH_PARAMETER_LIST, endsWithMethodParameterList)
}
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,13 @@ object ToolBarComponentsPatch : BaseBytecodePatch(
// region patch for hide YouTube Doodles

YoodlesImageViewFingerprint.resultOrThrow().mutableMethod.apply {
findOpcodeIndicesReversed{
findOpcodeIndicesReversed {
opcode == Opcode.INVOKE_VIRTUAL
&& getReference<MethodReference>()?.name == "setImageDrawable"
}.forEach { insertIndex ->
val (viewRegister, drawableRegister) = getInstruction<FiveRegisterInstruction>(insertIndex).let {
val (viewRegister, drawableRegister) = getInstruction<FiveRegisterInstruction>(
insertIndex
).let {
Pair(it.registerC, it.registerD)
}
replaceInstruction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ object ThemePatch : BaseResourcePatch(
node.textContent = when (node.getAttribute("name")) {
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98",
"yt_white2", "yt_white3", "yt_white4",
-> lightThemeColor
-> lightThemeColor

else -> continue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ object PlayerFlyoutMenuPatch : BaseBytecodePatch(
// region patch for hide '1080p Premium' label

VideoQualityArrayFingerprint.resultOrThrow().mutableMethod.apply {
val qualityLabelIndex = VideoQualityArrayFingerprint.indexOfQualityLabelInstruction(this) + 1
val qualityLabelRegister = getInstruction<OneRegisterInstruction>(qualityLabelIndex).registerA
val qualityLabelIndex =
VideoQualityArrayFingerprint.indexOfQualityLabelInstruction(this) + 1
val qualityLabelRegister =
getInstruction<OneRegisterInstruction>(qualityLabelIndex).registerA
val jumpIndex = indexOfFirstInstructionReversedOrThrow(qualityLabelIndex) {
opcode == Opcode.INVOKE_INTERFACE &&
getReference<MethodReference>()?.name == "hasNext"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal object VideoQualityArrayFingerprint : MethodFingerprint(
}

val startsWithMethodParameterList = parameterTypes.slice(0..0)
val endsWithMethodParameterList = parameterTypes.slice(parameterSize - 2..< parameterSize)
val endsWithMethodParameterList = parameterTypes.slice(parameterSize - 2..<parameterSize)

parametersEqual(STARTS_WITH_PARAMETER_LIST, startsWithMethodParameterList) &&
parametersEqual(ENDS_WITH_PARAMETER_LIST, endsWithMethodParameterList) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ object SuggestedVideoEndScreenPatch : BytecodePatch(
val invokeIndex =
indexOfFirstInstructionOrThrow {
val reference = getReference<MethodReference>()
reference?.returnType == "Z" &&
reference?.returnType == "Z" &&
reference.parameterTypes.size == 0 &&
reference.name == autoNavStatusMethodName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ object ReturnYouTubeDislikeShortsPatch : BytecodePatch(
}

if (SettingsPatch.upward1834) {
TextComponentPatch.hookSpannableString(INTEGRATIONS_RYD_CLASS_DESCRIPTOR, "onCharSequenceLoaded")
TextComponentPatch.hookSpannableString(
INTEGRATIONS_RYD_CLASS_DESCRIPTOR,
"onCharSequenceLoaded"
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ internal object PlayerParameterBuilderFingerprint : MethodFingerprint(
}

val startsWithMethodParameterList = parameterTypes.slice(0..5)
val endsWithMethodParameterList = parameterTypes.slice(parameterSize - 7..< parameterSize)
val endsWithMethodParameterList = parameterTypes.slice(parameterSize - 7..<parameterSize)

parametersEqual(STARTS_WITH_PARAMETER_LIST, startsWithMethodParameterList) &&
parametersEqual(ENDS_WITH_PARAMETER_LIST, endsWithMethodParameterList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ internal object VideoIdFingerprint : MethodFingerprint(
return@custom false
}

val reference = (instructions.elementAt(instructionCount - 2) as? ReferenceInstruction)?.reference.toString()
val reference =
(instructions.elementAt(instructionCount - 2) as? ReferenceInstruction)?.reference.toString()
if (reference != "Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") {
return@custom false
}
Expand Down

0 comments on commit 20389d5

Please sign in to comment.