Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
chore: Merge branch dev to main (#14)
Browse files Browse the repository at this point in the history
close #13
  • Loading branch information
github-actions[bot] authored Mar 22, 2024
1 parent 4315dab commit 9226df7
Show file tree
Hide file tree
Showing 73 changed files with 1,640 additions and 288 deletions.
67 changes: 67 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
# [1.12.0-dev.6](https://github.com/IndusAryan/twitter-patches/compare/v1.12.0-dev.5...v1.12.0-dev.6) (2024-03-22)


### Features

* **twitter:** prepare merge2 ([33626bb](https://github.com/IndusAryan/twitter-patches/commit/33626bbd5d4608718f1b365cdcab78ddc90dd341))

# [1.12.0-dev.5](https://github.com/IndusAryan/twitter-patches/compare/v1.12.0-dev.4...v1.12.0-dev.5) (2024-03-22)


### Features

* **twitter:** prepare merge ([e22f6ec](https://github.com/IndusAryan/twitter-patches/commit/e22f6ec42bc010c3d4f1702d41e46d7d6462264d))

# [1.12.0-dev.4](https://github.com/IndusAryan/twitter-patches/compare/v1.12.0-dev.3...v1.12.0-dev.4) (2024-03-22)


### Bug Fixes

* **twitter:** fix monochrome again lmao ([37375b7](https://github.com/IndusAryan/twitter-patches/commit/37375b771babeb99f0c44e5fccf8f996904dcce0))

# [1.12.0-dev.3](https://github.com/IndusAryan/twitter-patches/compare/v1.12.0-dev.2...v1.12.0-dev.3) (2024-03-22)


### Bug Fixes

* **twitter:** fix monochrome ([4d6622a](https://github.com/IndusAryan/twitter-patches/commit/4d6622a29d18da3fdbcc0412310ca141b738bc40))

# [1.12.0-dev.2](https://github.com/IndusAryan/twitter-patches/compare/v1.12.0-dev.1...v1.12.0-dev.2) (2024-03-22)


### Features

* **twitter:** add warning. ([2cd9fc4](https://github.com/IndusAryan/twitter-patches/commit/2cd9fc47495f4f51e685cbcc45370ea60138f879))

# [1.12.0-dev.1](https://github.com/IndusAryan/twitter-patches/compare/v1.11.0...v1.12.0-dev.1) (2024-03-22)


### Bug Fixes

* **twitter:** fix crash ([9f6aaa4](https://github.com/IndusAryan/twitter-patches/commit/9f6aaa42eeace22f539a533b1cf8fda7488ea116))


### Features

* **twitter:** initial patch release ([23740b0](https://github.com/IndusAryan/twitter-patches/commit/23740b061cda6bab54f2692bbd248ea78604a106))
* **twitter:** new patches ([bc94acd](https://github.com/IndusAryan/twitter-patches/commit/bc94acda01cbb78065a7b4b190ad5f082ae89075))

# [1.12.0-dev.1](https://github.com/IndusAryan/twitter-patches/compare/v1.11.0...v1.12.0-dev.1) (2024-03-22)


### Bug Fixes

* **twitter:** fix crash ([9f6aaa4](https://github.com/IndusAryan/twitter-patches/commit/9f6aaa42eeace22f539a533b1cf8fda7488ea116))


### Features

* **twitter:** new patches ([bc94acd](https://github.com/IndusAryan/twitter-patches/commit/bc94acda01cbb78065a7b4b190ad5f082ae89075))

# [1.12.0-dev.1](https://github.com/IndusAryan/twitter-patches/compare/v1.11.0...v1.12.0-dev.1) (2024-03-22)


### Features

* **twitter:** new patches ([bc94acd](https://github.com/IndusAryan/twitter-patches/commit/bc94acda01cbb78065a7b4b190ad5f082ae89075))

# [1.12.0-dev.1](https://github.com/IndusAryan/twitter-patches/compare/v1.11.0...v1.12.0-dev.1) (2024-03-16)


Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
⦿ OG Twitter name and in app branding
⦿ Bird Splash screen and toolbar icon
⦿ Three Icon sets
⦿ Adaptive Monochrome Icon
⦿ Video downloads

-> from Revanced Official
⦿ Hide tweet View counts
⦿ Hide promoted users and AdBlock

-> from Crimera Piko
⦿ Hide Google ads
⦿ Clean URL
⦿ Hide Promoted Trends
⦿ All Patches and settings menu (RIP originality)
```
## Usage

Expand All @@ -25,15 +24,18 @@ To use these patches, follow the steps below:
2. Set `twitter-patches` as the source for your patches.

<div style="display:flex; justify-content:space-between;">
<img src="screenshots/raw1.jpg" alt="usage" width="200" />
<img src="screenshots/raw1.png" alt="usage" width="200" />
</div>

## Warning:
Only use 1 icon patch and deselect other two otherwise; last applied patch will be used.
## Warnings:
Only use 1 icon patch and deselect other two otherwise; last applied patch icon will be used.
All icon sets contain adaptive monochrome icon.
Use crimera integrations as seen in image due to implementation of Mod menu.

## Icons
<div style="display:flex; justify-content:space-between;">
<img src="screenshots/raw2.jpg" alt="icons" width="300" />
<img src="screenshots/raw2.jpg" alt="icons" width="300" />
<img src="screenshots/raw3.jpg" alt="adaptive_icons" width="300" />
</div>

## Screenshots
Expand Down Expand Up @@ -70,4 +72,4 @@ These patches are fully FOSS. You can use, study, share and modify it at your wi

---
### Info:
These patches are only for educational purpose and personal usages. They are safe and don't tamper with any application functionality in a negative way, neither they are capable of it. We are not affiliated with Revanced Project. Some patches and parts are taken from Crimera and TheRealSwak, So many thanks to them and do star their Repo.
These patches are only for educational purpose and personal usages. They are safe and don't tamper with any application functionality in a negative way, neither they are capable of it. We are not affiliated with Revanced Project. This Repo also contains patches and parts from the Crimera piko and TheRealSwak, So many thanks to them and do star their awesome Repo.
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.12.0-dev.1
version = 1.12.0-dev.6
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed screenshots/raw1.jpg
Binary file not shown.
Binary file added screenshots/raw1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/raw3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 34 additions & 10 deletions src/main/kotlin/indus/org/patches/twitter/XMLUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ class XMLUtils(context: ResourceContext) {
/*** ⚠ DON'T TOUCH THE XML WITHIN """INDENTS""", IT FUCKS UP THE WHOLE VECTOR AS WELL AS PATCH **/

private val avatarMarkerTwitterFile = context["res/drawable/avatar_marker_twitter.xml"]
private val monochromeFile = context["res/drawable/ic_vector_twitter_circle_fill.xml"]
private val mipmapDirectory = context["res"].resolve("mipmap-anydpi")
private val mipmapDirectory26 = context["res"].resolve("mipmap-anydpi-v26")
private val icLauncherTwitterXml = mipmapDirectory.resolve("ic_launcher_twitter.xml")
private val icLauncherTwitterRoundXml = mipmapDirectory.resolve("ic_launcher_twitter_round.xml")
private val icLauncherTwitterXml26 = mipmapDirectory26.resolve("ic_launcher_twitter.xml")
private val icLauncherTwitterRoundXml26 = mipmapDirectory26.resolve("ic_launcher_twitter_round.xml")

private fun avatarFile() {
private fun createIconFiles() {
if (!avatarMarkerTwitterFile.isFile) Files.createFile(avatarMarkerTwitterFile.toPath())
if (!monochromeFile.isFile) Files.createFile(monochromeFile.toPath())
}

fun whiteIconBlackBG() {
Expand Down Expand Up @@ -53,7 +55,8 @@ class XMLUtils(context: ResourceContext) {
</vector>
""".trimIndent()

avatarFile()
createIconFiles()
addMonochromeIcon()
avatarMarkerTwitterFile.writeText(whiteBird)
}

Expand Down Expand Up @@ -88,7 +91,8 @@ class XMLUtils(context: ResourceContext) {
</vector>
""".trimIndent()

avatarFile()
createIconFiles()
addMonochromeIcon()
avatarMarkerTwitterFile.writeText(newAvatarMarkerTwitterContent)
}

Expand Down Expand Up @@ -123,7 +127,8 @@ class XMLUtils(context: ResourceContext) {
</vector>
""".trimIndent()

avatarFile()
createIconFiles()
addMonochromeIcon()
avatarMarkerTwitterFile.writeText(blackIcon)
}

Expand Down Expand Up @@ -158,16 +163,34 @@ class XMLUtils(context: ResourceContext) {
vectorFileDark.writeText(newBirdVector)
}

private fun addMonochromeIcon() {
val adaptiveIcon = """
<?xml version='1.0' encoding='utf-8' ?>
<vector android:height="24.0dp"
android:width="24.0dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#ffffffff"
android:pathData="M16.62,10.08c0.004,0.095 0.007,0.192 0.007,0.29 0,2.956 -2.25,6.366 -6.368,6.366 -1.265,0 -2.44,-0.37 -3.43,-1.005 0.174,0.022 0.352,0.032 0.533,0.032 1.048,0 2.013,-0.358 2.78,-0.958 -0.98,-0.018 -1.806,-0.665 -2.09,-1.554 0.135,0.026 0.276,0.04 0.42,0.04 0.204,0 0.402,-0.028 0.59,-0.08 -1.024,-0.204 -1.795,-1.11 -1.795,-2.194v-0.028c0.302,0.168 0.647,0.268 1.014,0.28 -0.6,-0.4 -0.995,-1.087 -0.995,-1.863 0,-0.41 0.11,-0.794 0.303,-1.125 1.104,1.354 2.753,2.245 4.613,2.338 -0.038,-0.164 -0.058,-0.334 -0.058,-0.51 0,-1.236 1.002,-2.238 2.238,-2.238 0.644,0 1.225,0.272 1.633,0.706 0.51,-0.1 0.99,-0.287 1.42,-0.543 -0.166,0.522 -0.52,0.96 -0.983,1.238 0.453,-0.053 0.884,-0.174 1.285,-0.35 -0.3,0.45 -0.68,0.843 -1.118,1.16z"/>
</vector>
""".trimIndent()

monochromeFile.writeText(adaptiveIcon)
}

private fun updateXmlFile(xmlFile: File) {
if (!Files.isRegularFile(xmlFile.toPath())) throw PatchException("$xmlFile not found.")

val content = xmlFile.readText()
val modifiedContent = content.replace(
"""android:drawable="@mipmap/ic_launcher_twitter_foreground"""",
"""android:drawable="@drawable/avatar_marker_twitter""""
)
val newMipmap = """
<?xml version='1.0' encoding='utf-8' ?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/avatar_marker_twitter" />
<monochrome android:drawable="@drawable/ic_vector_twitter_circle_fill" />
</adaptive-icon>
""".trimIndent()

xmlFile.writeText(modifiedContent)
xmlFile.writeText(newMipmap)
}

fun updateLauncherXmlFiles() {
Expand All @@ -181,6 +204,7 @@ class XMLUtils(context: ResourceContext) {
updateXmlFile(icLauncherTwitterXml26)
updateXmlFile(icLauncherTwitterRoundXml26)
}

else throw PatchException("Mipmap directory not found")
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package indus.org.patches.twitter.crimeraswak.ads.timelineEntryHook

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import indus.org.patches.twitter.crimeraswak.misc.settings.SettingsPatch
import indus.org.patches.twitter.crimeraswak.misc.settings.fingerprints.SettingsStatusLoadFingerprint

@Patch(
name = "Remove Ads",
dependencies = [SettingsPatch::class, TimelineEntryHookPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true
)
object HideAds :BytecodePatch(
setOf()
){
override fun execute(context: BytecodeContext) {
SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction(
0,
"${SettingsPatch.SSTS_DESCRIPTOR}->hideAds()V"
)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package indus.org.patches.twitter.crimeraswak.ads.timelineEntryHook

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import indus.org.patches.twitter.crimeraswak.misc.settings.SettingsPatch
import indus.org.patches.twitter.crimeraswak.misc.settings.fingerprints.SettingsStatusLoadFingerprint

@Patch(
name = "Remove \"Communities to join\" Banner",
dependencies = [SettingsPatch::class, TimelineEntryHookPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true
)
object HideCTJ :BytecodePatch(
setOf()
){
override fun execute(context: BytecodeContext) {
SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction(
0,
"${SettingsPatch.SSTS_DESCRIPTOR}->hideCommToJoin()V"
)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package indus.org.patches.twitter.crimeraswak.ads.timelineEntryHook

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import indus.org.patches.twitter.crimeraswak.misc.settings.SettingsPatch
import indus.org.patches.twitter.crimeraswak.misc.settings.fingerprints.SettingsStatusLoadFingerprint

@Patch(
name = "Remove \"Creators to subscribe\" Banner",
dependencies = [SettingsPatch::class, TimelineEntryHookPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true
)
object HideCTS :BytecodePatch(
setOf()
){
override fun execute(context: BytecodeContext) {
SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction(
0,
"${SettingsPatch.SSTS_DESCRIPTOR}->hideCreatorsToSub()V"
)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package indus.org.patches.twitter.crimeraswak.ads.timelineEntryHook

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import indus.org.patches.twitter.crimeraswak.misc.settings.SettingsPatch
import indus.org.patches.twitter.crimeraswak.misc.settings.fingerprints.SettingsStatusLoadFingerprint

@Patch(
name = "Remove Detailed posts",
description = "Removes detailed posts in replies",
dependencies = [SettingsPatch::class, TimelineEntryHookPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = false
)
object HideDetailedPosts :BytecodePatch(
setOf()
){
override fun execute(context: BytecodeContext) {
SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction(
0,
"${SettingsPatch.SSTS_DESCRIPTOR}->hideDetailedPost()V"
)

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package indus.org.patches.twitter.crimeraswak.ads.timelineEntryHook

import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import indus.org.patches.twitter.crimeraswak.misc.settings.SettingsPatch
import indus.org.patches.twitter.crimeraswak.misc.settings.fingerprints.SettingsStatusLoadFingerprint

@Patch(
name = "Remove Google Ads",
dependencies = [SettingsPatch::class, TimelineEntryHookPatch::class],
compatiblePackages = [CompatiblePackage("com.twitter.android")],
use = true
)
object HideGoogleAds :BytecodePatch(
setOf()
){
override fun execute(context: BytecodeContext) {
SettingsStatusLoadFingerprint.result!!.mutableMethod.addInstruction(
0,
"${SettingsPatch.SSTS_DESCRIPTOR}->hideGAds()V"
)

}
}
Loading

0 comments on commit 9226df7

Please sign in to comment.