Skip to content

Commit 2c83b86

Browse files
committed
fix(Tiktok - Remember clear display): Use correct name
1 parent 5ceda29 commit 2c83b86

File tree

4 files changed

+29
-28
lines changed

4 files changed

+29
-28
lines changed

api/revanced-patches.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ public final class app/revanced/patches/tiktok/feedfilter/FeedFilterPatch : app/
818818
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
819819
}
820820

821-
public final class app/revanced/patches/tiktok/interaction/clearmode/RememberClearModePatch : app/revanced/patcher/patch/BytecodePatch {
822-
public static final field INSTANCE Lapp/revanced/patches/tiktok/interaction/clearmode/RememberClearModePatch;
821+
public final class app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch : app/revanced/patcher/patch/BytecodePatch {
822+
public static final field INSTANCE Lapp/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch;
823823
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
824824
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
825825
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.patches.tiktok.interaction.clearmode
1+
package app.revanced.patches.tiktok.interaction.cleardisplay
22

33
import app.revanced.patcher.data.BytecodeContext
44
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
@@ -8,72 +8,72 @@ import app.revanced.patcher.patch.BytecodePatch
88
import app.revanced.patcher.patch.annotation.CompatiblePackage
99
import app.revanced.patcher.patch.annotation.Patch
1010
import app.revanced.patcher.util.smali.ExternalLabel
11-
import app.revanced.patches.tiktok.interaction.clearmode.fingerprints.OnClearModeEventFingerprint
12-
import app.revanced.patches.tiktok.interaction.clearmode.fingerprints.OnRenderFirstFrameFingerprint
11+
import app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints.OnClearDisplayEventFingerprint
12+
import app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints.OnRenderFirstFrameFingerprint
1313
import app.revanced.util.exception
1414
import app.revanced.util.indexOfFirstInstruction
1515
import com.android.tools.smali.dexlib2.Opcode
1616
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
1717

1818
@Patch(
19-
name = "Remember clear mode",
20-
description = "Remembers the clear mode configurations in between videos.",
19+
name = "Remember clear display",
20+
description = "Remembers the clear display configurations in between videos.",
2121
compatiblePackages = [
2222
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
2323
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
2424
]
2525
)
2626
@Suppress("unused")
27-
object RememberClearModePatch : BytecodePatch(
27+
object RememberClearDisplayPatch : BytecodePatch(
2828
setOf(
29-
OnClearModeEventFingerprint,
29+
OnClearDisplayEventFingerprint,
3030
OnRenderFirstFrameFingerprint
3131
)
3232
) {
3333
override fun execute(context: BytecodeContext) {
34-
OnClearModeEventFingerprint.result?.mutableMethod?.let {
35-
// region Hook the "Clear mode" configuration save event to remember the state of clear mode.
34+
OnClearDisplayEventFingerprint.result?.mutableMethod?.let {
35+
// region Hook the "Clear display" configuration save event to remember the state of clear display.
3636

3737
val isEnabledIndex = it.indexOfFirstInstruction { opcode == Opcode.IGET_BOOLEAN } + 1
3838
val isEnabledRegister = it.getInstruction<Instruction22c>(isEnabledIndex - 1).registerA
3939

4040
it.addInstructions(
4141
isEnabledIndex,
4242
"invoke-static { v$isEnabledRegister }, " +
43-
"Lapp/revanced/tiktok/clearmode/RememberClearModePatch;->rememberClearModeState(Z)V"
43+
"Lapp/revanced/tiktok/cleardisplay/RememberClearDisplayPatch;->rememberClearDisplayState(Z)V"
4444
)
4545

4646
// endregion
4747

48-
// region Override the "Clear mode" configuration load event to load the state of clear mode.
48+
// region Override the "Clear display" configuration load event to load the state of clear display.
4949

50-
val clearModeEventClass = it.parameters[0].type
50+
val clearDisplayEventClass = it.parameters[0].type
5151
OnRenderFirstFrameFingerprint.result?.mutableMethod?.apply {
5252
addInstructionsWithLabels(
5353
0,
5454
"""
55-
# Create a new clearModeEvent and post it to the EventBus (https://github.com/greenrobot/EventBus)
55+
# Create a new clearDisplayEvent and post it to the EventBus (https://github.com/greenrobot/EventBus)
5656
57-
# The state of clear mode.
58-
invoke-static { }, Lapp/revanced/tiktok/clearmode/RememberClearModePatch;->getClearModeState()Z
57+
# The state of clear display.
58+
invoke-static { }, Lapp/revanced/tiktok/cleardisplay/RememberClearDisplayPatch;->getClearDisplayState()Z
5959
move-result v3
60-
if-eqz v3, :clear_mode_disabled
60+
if-eqz v3, :clear_display_disabled
6161
62-
# Clear mode type such as 0 = LONG_PRESS, 1 = SCREEN_RECORD etc.
62+
# Clear display type such as 0 = LONG_PRESS, 1 = SCREEN_RECORD etc.
6363
const/4 v1, 0x0
6464
65-
# Name of the clear mode type which is equivalent to the clear mode type.
65+
# Name of the clear display type which is equivalent to the clear display type.
6666
const-string v2, "long_press"
6767
68-
new-instance v0, $clearModeEventClass
69-
invoke-direct { v0, v1, v2, v3 }, $clearModeEventClass-><init>(ILjava/lang/String;Z)V
70-
invoke-virtual { v0 }, $clearModeEventClass->post()Lcom/ss/android/ugc/governance/eventbus/IEvent;
68+
new-instance v0, $clearDisplayEventClass
69+
invoke-direct { v0, v1, v2, v3 }, $clearDisplayEventClass-><init>(ILjava/lang/String;Z)V
70+
invoke-virtual { v0 }, $clearDisplayEventClass->post()Lcom/ss/android/ugc/governance/eventbus/IEvent;
7171
""",
72-
ExternalLabel("clear_mode_disabled", getInstruction(0))
72+
ExternalLabel("clear_display_disabled", getInstruction(0))
7373
)
7474
} ?: throw OnRenderFirstFrameFingerprint.exception
7575

7676
// endregion
77-
} ?: throw OnClearModeEventFingerprint.exception
77+
} ?: throw OnClearDisplayEventFingerprint.exception
7878
}
7979
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
package app.revanced.patches.tiktok.interaction.clearmode.fingerprints
1+
package app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints
22

33
import app.revanced.patcher.fingerprint.MethodFingerprint
44

5-
internal object OnClearModeEventFingerprint : MethodFingerprint(
5+
internal object OnClearDisplayEventFingerprint : MethodFingerprint(
66
customFingerprint = { methodDef, _ ->
7+
// Internally the feature is called "Clear mode".
78
methodDef.definingClass.endsWith("/ClearModePanelComponent;") && methodDef.name == "onClearModeEvent"
89
}
910
)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.patches.tiktok.interaction.clearmode.fingerprints
1+
package app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints
22

33
import app.revanced.patcher.fingerprint.MethodFingerprint
44

0 commit comments

Comments
 (0)