Skip to content

Commit 42ba1d6

Browse files
authored
Merge pull request #454 from crimera/dev
chore: Merge branch `dev` to `main`
2 parents b255e94 + 97e2650 commit 42ba1d6

File tree

23 files changed

+739
-297
lines changed

23 files changed

+739
-297
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## [1.44.0-dev.1](https://github.com/crimera/piko/compare/v1.43.0...v1.44.0-dev.1) (2024-11-02)
2+
3+
### Features
4+
5+
* **Twitter:** Added `Custom translator` patch ([737fb9e](https://github.com/crimera/piko/commit/737fb9eaa0b8da7f020b93c314f5da60f961e345))
6+
7+
### Refactors
8+
9+
* **Twitter:** Change translator icon ([bf5f027](https://github.com/crimera/piko/commit/bf5f027f80507cf0db5b3dfd208d26b131987eca))
10+
* **Twitter:** refactor `Custom downloader` patch ([42cc752](https://github.com/crimera/piko/commit/42cc752c599f978f455f84ae9a917f7bb457af98))
11+
* **Twitter:** Refactor `Custom downloader` patch ([1e966f7](https://github.com/crimera/piko/commit/1e966f7f519b7d947e0b516f8bc0ca0c55c1d623))
12+
* **Twitter:** Refactor hooks filename ([2daa292](https://github.com/crimera/piko/commit/2daa2922c7225711fd1aa5d0556493e068026e0a))
13+
* **Twitter:** renamed 'Share menu button' fingerprints to hooks ([395c221](https://github.com/crimera/piko/commit/395c2217fc5f5b18cdc76568c3845140f76940d6))
14+
115
## [1.43.0](https://github.com/crimera/piko/compare/v1.42.1...v1.43.0) (2024-10-29)
216

317
### Bug Fixes

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
33
kotlin.code.style = official
4-
version = 1.43.0
4+
version = 1.44.0-dev.1

patches.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/main/kotlin/crimera/patches/twitter/misc/debugMenu/DebugMenu.kt

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/main/kotlin/crimera/patches/twitter/misc/nativeDownloader/NativeDownloaderPatch.kt

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/main/kotlin/crimera/patches/twitter/misc/nativeDownloader/fingerprints/NativeDownloaderAlwaysIcon.kt

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/main/kotlin/crimera/patches/twitter/misc/nativeDownloader/fingerprints/NativeDownloaderPatchFingerprint.kt

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/main/kotlin/crimera/patches/twitter/misc/nativeDownloader/fingerprints/NativeDownloaderResourcePatch.kt

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/main/kotlin/crimera/patches/twitter/misc/settings/SettingsPatch.kt

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import crimera.patches.twitter.misc.settings.fingerprints.UrlInterpreterActivity
2626
compatiblePackages = [CompatiblePackage("com.twitter.android")],
2727
)
2828
object SettingsPatch : BytecodePatch(
29-
setOf(SettingsFingerprint, AuthorizeAppActivity, IntegrationsUtilsFingerprint,UrlInterpreterActivity)
29+
setOf(SettingsFingerprint, AuthorizeAppActivity, IntegrationsUtilsFingerprint, UrlInterpreterActivity),
3030
) {
3131
private const val INTEGRATIONS_PACKAGE = "Lapp/revanced/integrations/twitter"
32-
private const val UTILS_DESCRIPTOR = "$INTEGRATIONS_PACKAGE/Utils"
32+
const val UTILS_DESCRIPTOR = "$INTEGRATIONS_PACKAGE/Utils"
3333
private const val ACTIVITY_HOOK_CLASS = "Lapp/revanced/integrations/twitter/settings/ActivityHook;"
3434
private const val DEEPLINK_HOOK_CLASS = "Lapp/revanced/integrations/twitter/settings/DeepLink;"
3535
private const val ADD_PREF_DESCRIPTOR =
@@ -45,26 +45,39 @@ object SettingsPatch : BytecodePatch(
4545
"invoke-static {}, $ACTIVITY_HOOK_CLASS->startSettingsActivity()V"
4646

4747
override fun execute(context: BytecodeContext) {
48-
val result = SettingsFingerprint.result
49-
?: throw PatchException("Fingerprint not found")
48+
val result =
49+
SettingsFingerprint.result
50+
?: throw PatchException("Fingerprint not found")
5051

5152
val initMethod = result.mutableClass.methods.first()
5253

53-
val arrayCreation = initMethod.getInstructions()
54-
.first { it.opcode == Opcode.FILLED_NEW_ARRAY_RANGE }.location.index+1
54+
val arrayCreation =
55+
initMethod
56+
.getInstructions()
57+
.first { it.opcode == Opcode.FILLED_NEW_ARRAY_RANGE }
58+
.location.index + 1
5559

56-
initMethod.getInstruction<BuilderInstruction11x>(arrayCreation).registerA.also { reg->
57-
initMethod.addInstructions(arrayCreation+1, """
60+
initMethod.getInstruction<BuilderInstruction11x>(arrayCreation).registerA.also { reg ->
61+
initMethod.addInstructions(
62+
arrayCreation + 1,
63+
"""
5864
const-string v1, "pref_mod"
5965
invoke-static {v$reg, v1}, $ADD_PREF_DESCRIPTOR
6066
move-result-object v$reg
61-
""")
67+
""",
68+
)
6269
}
6370

6471
val prefCLickedMethod = result.mutableClass.methods.find { it.returnType == "Z" }!!
65-
val constIndex = prefCLickedMethod.getInstructions().first{ it.opcode == Opcode.CONST_4 }.location.index
72+
val constIndex =
73+
prefCLickedMethod
74+
.getInstructions()
75+
.first { it.opcode == Opcode.CONST_4 }
76+
.location.index
6677

67-
prefCLickedMethod.addInstructionsWithLabels(1, """
78+
prefCLickedMethod.addInstructionsWithLabels(
79+
1,
80+
"""
6881
const-string v1, "pref_mod"
6982
invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
7083
move-result v2
@@ -77,40 +90,44 @@ object SettingsPatch : BytecodePatch(
7790
const/4 v3, 0x1
7891
return v3
7992
""",
80-
ExternalLabel("cont", prefCLickedMethod.getInstruction(constIndex))
93+
ExternalLabel("cont", prefCLickedMethod.getInstruction(constIndex)),
8194
)
8295

8396
AuthorizeAppActivity.result?.apply {
8497
mutableMethod.addInstructionsWithLabels(
85-
1, """
98+
1,
99+
"""
86100
invoke-static {p0}, $ACTIVITY_HOOK_CLASS->create(Landroid/app/Activity;)Z
87101
move-result v0
88102
if-nez v0, :no_piko_settings_init
89103
""".trimIndent(),
90104
ExternalLabel(
91105
"no_piko_settings_init",
92-
mutableMethod.getInstructions().first { it.opcode == Opcode.RETURN_VOID })
106+
mutableMethod.getInstructions().first { it.opcode == Opcode.RETURN_VOID },
107+
),
93108
)
94109
} ?: throw PatchException("ProxySettingsActivityFingerprint not found")
95110

96111
UrlInterpreterActivity.result?.apply {
97112
val instructions = mutableMethod.getInstructions()
98-
val loc = instructions.first { it.opcode == Opcode.INVOKE_SUPER }.location.index+1
113+
val loc = instructions.first { it.opcode == Opcode.INVOKE_SUPER }.location.index + 1
99114
mutableMethod.addInstructionsWithLabels(
100-
loc, """
115+
loc,
116+
"""
101117
invoke-static {p0}, $DEEPLINK_HOOK_CLASS->deeplink(Landroid/app/Activity;)Z
102118
move-result v0
103119
if-nez v0, :deep_link
104120
""".trimIndent(),
105121
ExternalLabel(
106122
"deep_link",
107-
instructions.first { it.opcode == Opcode.RETURN_VOID })
123+
instructions.first { it.opcode == Opcode.RETURN_VOID },
124+
),
108125
)
109126
} ?: throw PatchException("UrlInterpreterActivity not found")
110127

111128
IntegrationsUtilsFingerprint.result!!.mutableMethod.addInstruction(
112129
0,
113-
"${SSTS_DESCRIPTOR}->load()V"
130+
"${SSTS_DESCRIPTOR}->load()V",
114131
)
115132
}
116-
}
133+
}

0 commit comments

Comments
 (0)