Skip to content

Commit

Permalink
Merge pull request #474 from crimera/dev
Browse files Browse the repository at this point in the history
chore: Merge branch `dev` to `main`
  • Loading branch information
crimera authored Nov 27, 2024
2 parents d326deb + 0792795 commit 1018074
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 81 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [1.45.1-dev.2](https://github.com/crimera/piko/compare/v1.45.1-dev.1...v1.45.1-dev.2) (2024-11-25)

### Refactors

* **Twitter:** Added toggle for `Show sensitive media` patch ([cac4fe7](https://github.com/crimera/piko/commit/cac4fe747640e37dc9155c63f23082c44963c05d))

## [1.45.1-dev.1](https://github.com/crimera/piko/compare/v1.45.0...v1.45.1-dev.1) (2024-11-24)

### Bug Fixes

* **Twitter:** Change patch name from `Enable app icon settings` -> `Enable app icons` ([5a7ef46](https://github.com/crimera/piko/commit/5a7ef469557e5cf4ecc9ce8465d73c20501dc524))

## [1.45.0](https://github.com/crimera/piko/compare/v1.44.0...v1.45.0) (2024-11-14)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 1.45.0
version = 1.45.1-dev.2
2 changes: 1 addition & 1 deletion patches.json

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package crimera.patches.twitter.premium.customAppIcon

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.MethodFingerprint
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
Expand All @@ -16,37 +14,46 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import crimera.patches.twitter.misc.settings.SettingsPatch
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint

object CustomiseAppIconFingerprint:MethodFingerprint(
strings = listOf(
"current_app_icon_id"
)
object CustomiseAppIconFingerprint : MethodFingerprint(
strings =
listOf(
"current_app_icon_id",
),
)

@Patch(
name = "Enable app icon settings",
dependencies = [SettingsPatch::class,RedirectBMTab::class],
name = "Enable app icons",
dependencies = [SettingsPatch::class, RedirectBMTab::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true,
requiresIntegrations = true
requiresIntegrations = true,
)
@Suppress("unused")
object CustomiseAppIcon:BytecodePatch(
setOf(CustomiseAppIconFingerprint,SettingsStatusLoadFingerprint)
){
object CustomiseAppIcon : BytecodePatch(
setOf(CustomiseAppIconFingerprint, SettingsStatusLoadFingerprint),
) {
override fun execute(context: BytecodeContext) {
val result = CustomiseAppIconFingerprint.result
?:throw PatchException("CustomiseAppIconFingerprint not found")
val result =
CustomiseAppIconFingerprint.result
?: throw PatchException("CustomiseAppIconFingerprint not found")

val method = result.mutableClass.methods.last()
val loc = method.getInstructions().last { it.opcode == Opcode.MOVE_RESULT }.location.index
val loc =
method
.getInstructions()
.last { it.opcode == Opcode.MOVE_RESULT }
.location.index

val reg = method.getInstruction<OneRegisterInstruction>(loc).registerA

method.addInstruction(loc+1,"""
method.addInstruction(
loc + 1,
"""
const v$reg, 0x0
""".trimIndent())
""".trimIndent(),
)

SettingsStatusLoadFingerprint.enableSettings("customAppIcon")
//end
// end
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package crimera.patches.twitter.timeline.sensitivemediasettings

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import com.android.tools.smali.dexlib2.Opcode
import crimera.patches.twitter.misc.settings.SettingsPatch
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint
import crimera.patches.twitter.timeline.sensitivemediasettings.fingerprints.SensitiveMediaSettingsPatchFingerprint

// Credits to @Cradlesofashes
@Patch(
name = "Show sensitive media",
description = "Shows sensitive media",
dependencies = [SettingsPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
)
@Suppress("unused")
object SensitiveMediaPatch : BytecodePatch(
setOf(SensitiveMediaSettingsPatchFingerprint, SettingsStatusLoadFingerprint),
) {
override fun execute(context: BytecodeContext) {
val TIMELINE_ENTRY_DESCRIPTOR = "${SettingsPatch.PATCHES_DESCRIPTOR}/TimelineEntry"

val result =
SensitiveMediaSettingsPatchFingerprint.result
?: throw PatchException("SensitiveMediaSettingsPatchFingerprint not found")

val methods = result.mutableMethod
val instructions = methods.getInstructions()

val returnObj = instructions.last { it.opcode == Opcode.RETURN_OBJECT }.location.index

methods.addInstructions(
returnObj,
"""
invoke-static {p1}, $TIMELINE_ENTRY_DESCRIPTOR;->sensitiveMedia(Lcom/twitter/model/json/core/JsonSensitiveMediaWarning;)Lcom/twitter/model/json/core/JsonSensitiveMediaWarning;
move-result-object p1
""".trimIndent(),
)

SettingsStatusLoadFingerprint.enableSettings("showSensitiveMedia")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package crimera.patches.twitter.timeline.sensitivemediasettings.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint

object SensitiveMediaSettingsPatchFingerprint : MethodFingerprint(
returnType = "Ljava/lang/Object",
customFingerprint = { it, _ ->
it.definingClass == "Lcom/twitter/model/json/core/JsonSensitiveMediaWarning\$\$JsonObjectMapper;" && it.name == "parse"
},
)
5 changes: 3 additions & 2 deletions src/main/resources/twitter/settings/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@
<string name="piko_pref_customisation_inlinetabs">非表示にするインラインバーの項目</string>
<string name="piko_pref_customisation_reply_sorting">デフォルトの返信の並び替え</string>
<string name="piko_pref_customisation_reply_sorting_remember">前回の選択を記憶</string>
<string name="piko_pref_customisation_post_font_size">ポストのフォントサイズ</string>
<!-- Backup and Restore -->
<string name="piko_title_backup">バックアップと復元</string>
<string name="piko_pref_export">%sをエクスポート</string>
<string name="piko_pref_import">%sをインポート</string>
<string name="piko_pref_export">エクスポート: %s</string>
<string name="piko_pref_import">インポート: %s</string>
<string name="piko_pref_success">成功</string>
<string name="piko_pref_export_failed">エラー: %sのエクスポートに失敗しました</string>
<string name="piko_pref_import_failed">エラー: %sのインポートに失敗しました</string>
Expand Down

0 comments on commit 1018074

Please sign in to comment.