Skip to content

Commit

Permalink
fix(Twitter): Only show settings category if patch is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
crimera committed Mar 2, 2024
1 parent bd7c6e2 commit 2141680
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package crimera.patches.twitter.interaction.downloads.changedirectory

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
Expand All @@ -12,6 +13,7 @@ import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import crimera.patches.twitter.interaction.downloads.changedirectory.fingerprints.SetDownloadDestinationFingerprint
import crimera.patches.twitter.misc.settings.SettingsPatch.UTILS_DESCRIPTOR
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint

@Patch(
name = "Custom download folder",
Expand All @@ -21,7 +23,7 @@ import crimera.patches.twitter.misc.settings.SettingsPatch.UTILS_DESCRIPTOR
)
@Suppress("unused")
object ChangeDownloadDirPatch: BytecodePatch(
setOf(SetDownloadDestinationFingerprint)
setOf(SetDownloadDestinationFingerprint, SettingsStatusLoadFingerprint)
) {
private const val GETFOLDER_DESCRIPTOR =
"invoke-static {p1}, $UTILS_DESCRIPTOR;->getVideoFolder(Ljava/lang/String;)Ljava/lang/String;"
Expand All @@ -45,5 +47,10 @@ object ChangeDownloadDirPatch: BytecodePatch(
$GETFOLDER_DESCRIPTOR
move-result-object p1
""".trimIndent())

SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction(
0,
"invoke-static {}, Lapp/revanced/integrations/twitter/settings/SettingsStatus;->enableDownload()V"
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package crimera.patches.twitter.misc.settings.fingerprints

import app.revanced.patcher.fingerprint.MethodFingerprint

object SettingsStatusLoadFingerprint: MethodFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("Lapp/revanced/integrations/twitter/settings/SettingsStatus;") &&
methodDef.name == "load"
}
)

8 comments on commit 2141680

@VixenSugo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every time I patch the program with cli commands, the mod menu causes the app to crash
How should I do it?

@crimera
Copy link
Owner Author

@crimera crimera commented on 2141680 Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try building it with revanced-integrations https://github.com/crimera/revanced-integrations/releases

@crimera
Copy link
Owner Author

@crimera crimera commented on 2141680 Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try building it with revanced-integrations https://github.com/crimera/revanced-integrations/releases

how bro? i use this tutorial but i couldn't

java -jar cli.jar
patch -b patches.jar
-m integrations.apk
-o out.apk input.apk

replace integrations.apk with the Integrations path.

@crimera
Copy link
Owner Author

@crimera crimera commented on 2141680 Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm... do you have a crash log?

oh, and can I see the command you use for building.

@VixenSugo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm... do you have a crash log?

oh, and can I see the command you use for building.

i used this cmd for building

java -jar cli.jar
patch -b patches.jar
-m integrations.apk
-o out.apk input.apk

i deleted output apk so i haven't crash log for now but i can send it to you a few minutes later

@VixenSugo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i dont know how use cmd for include/exclude features

@crimera
Copy link
Owner Author

@crimera crimera commented on 2141680 Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i dont know how use cmd for include/exclude features

just add -i "Name of patch to include" or -e "patch to exclude" before the input APK

so the CMD will look something like this
java -jar cli.jar
patch -b patches.jar
-m integrations.apk
-i "Hide For You"
-o out.apk input.apk

@VixenSugo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crimera

i managed to build and fix problem, thank you bro
you are so kind and Patience <3

Please sign in to comment.