mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-13 06:27:41 +00:00
Compare commits
4 Commits
v5.42.2-de
...
v5.43.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4547ecb73c | ||
|
|
50f0b9c5ee | ||
|
|
a8c4bdb8a6 | ||
|
|
6555f6e6f8 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
||||
# [5.43.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.42.2-dev.3...v5.43.0-dev.1) (2025-10-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Instagram:** Add `Hide suggested content` patch ([#6075](https://github.com/ReVanced/revanced-patches/issues/6075)) ([50f0b9c](https://github.com/ReVanced/revanced-patches/commit/50f0b9c5eee95ff5f9974e344802e1d2a4aab47b))
|
||||
|
||||
## [5.42.2-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.42.2-dev.2...v5.42.2-dev.3) (2025-10-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Custom branding:** Do not add a broken custom icon if the user provides an invalid custom icon path ([6555f6e](https://github.com/ReVanced/revanced-patches/commit/6555f6e6f8b52c2f1ddab1f52c6704cd2d8cfc12))
|
||||
|
||||
## [5.42.2-dev.2](https://github.com/ReVanced/revanced-patches/compare/v5.42.2-dev.1...v5.42.2-dev.2) (2025-10-10)
|
||||
|
||||
|
||||
|
||||
@@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M
|
||||
org.gradle.parallel = true
|
||||
android.useAndroidX = true
|
||||
kotlin.code.style = official
|
||||
version = 5.42.2-dev.2
|
||||
version = 5.43.0-dev.1
|
||||
|
||||
@@ -269,7 +269,7 @@ public final class app/revanced/patches/instagram/feed/LimitFeedToFollowedProfil
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/hide/explore/HideExploreFeedKt {
|
||||
public static final fun getHideExportFeedPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
public static final fun getHideExploreFeedPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/hide/navigation/HideNavigationButtonsKt {
|
||||
@@ -280,6 +280,10 @@ public final class app/revanced/patches/instagram/hide/stories/HideStoriesKt {
|
||||
public static final fun getHideStoriesPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/hide/suggestions/HideSuggestedContentKt {
|
||||
public static final fun getHideSuggestedContent ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatchKt {
|
||||
public static final fun getEnableDeveloperMenuPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@ package app.revanced.patches.instagram.hide.explore
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal const val EXPLORE_KEY_TO_BE_HIDDEN = "sectional_items"
|
||||
|
||||
internal val exploreResponseJsonParserFingerprint = fingerprint {
|
||||
strings("sectional_items", "ExploreTopicalFeedResponse")
|
||||
strings(EXPLORE_KEY_TO_BE_HIDDEN, "ExploreTopicalFeedResponse")
|
||||
custom { method, _ -> method.name == "parseFromJson" }
|
||||
}
|
||||
|
||||
@@ -1,33 +1,39 @@
|
||||
package app.revanced.patches.instagram.hide.explore
|
||||
|
||||
import app.revanced.patcher.Fingerprint
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatchContext
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
context(BytecodePatchContext)
|
||||
internal fun Fingerprint.replaceJsonFieldWithBogus(
|
||||
key: String,
|
||||
) {
|
||||
val targetStringIndex = stringMatches!!.first { match -> match.string == key }.index
|
||||
val targetStringRegister = method.getInstruction<OneRegisterInstruction>(targetStringIndex).registerA
|
||||
|
||||
/**
|
||||
* Replacing the JSON key we want to skip with a random string that is not a valid JSON key.
|
||||
* This way the feeds array will never be populated.
|
||||
* Received JSON keys that are not handled are simply ignored, so there are no side effects.
|
||||
*/
|
||||
method.replaceInstruction(
|
||||
targetStringIndex,
|
||||
"const-string v$targetStringRegister, \"BOGUS\"",
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
val hideExportFeedPatch = bytecodePatch(
|
||||
val hideExploreFeedPatch = bytecodePatch(
|
||||
name = "Hide explore feed",
|
||||
description = "Hides posts and reels from the explore/search page.",
|
||||
use = false
|
||||
use = false,
|
||||
) {
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
execute {
|
||||
exploreResponseJsonParserFingerprint.method.apply {
|
||||
val sectionalItemStringIndex = exploreResponseJsonParserFingerprint.stringMatches!!.first().index
|
||||
val sectionalItemStringRegister = getInstruction<OneRegisterInstruction>(sectionalItemStringIndex).registerA
|
||||
|
||||
/**
|
||||
* Replacing the JSON key we want to skip with a random string that is not a valid JSON key.
|
||||
* This way the feeds array will never be populated.
|
||||
* Received JSON keys that are not handled are simply ignored, so there are no side effects.
|
||||
*/
|
||||
replaceInstruction(
|
||||
sectionalItemStringIndex,
|
||||
"const-string v$sectionalItemStringRegister, \"BOGUS\""
|
||||
)
|
||||
}
|
||||
exploreResponseJsonParserFingerprint.replaceJsonFieldWithBogus(EXPLORE_KEY_TO_BE_HIDDEN)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.revanced.patches.instagram.hide.suggestions
|
||||
|
||||
import app.revanced.patcher.fingerprint
|
||||
|
||||
internal val FEED_ITEM_KEYS_TO_BE_HIDDEN = arrayOf(
|
||||
"clips_netego",
|
||||
"stories_netego",
|
||||
"in_feed_survey",
|
||||
"bloks_netego",
|
||||
"suggested_igd_channels",
|
||||
"suggested_top_accounts",
|
||||
"suggested_users",
|
||||
)
|
||||
|
||||
internal val feedItemParseFromJsonFingerprint = fingerprint {
|
||||
strings(*FEED_ITEM_KEYS_TO_BE_HIDDEN, "FeedItem")
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package app.revanced.patches.instagram.hide.suggestions
|
||||
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patches.instagram.hide.explore.replaceJsonFieldWithBogus
|
||||
|
||||
@Suppress("unused")
|
||||
val hideSuggestedContent = bytecodePatch(
|
||||
name = "Hide suggested content",
|
||||
description = "Hides suggested stories, reels, threads and survey from feed (Suggested posts will still be shown).",
|
||||
use = false,
|
||||
) {
|
||||
compatibleWith("com.instagram.android")
|
||||
|
||||
execute {
|
||||
FEED_ITEM_KEYS_TO_BE_HIDDEN.forEach { key ->
|
||||
feedItemParseFromJsonFingerprint.replaceJsonFieldWithBogus(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.music.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_MAIN_ACTIVITY_NAME
|
||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.misc.gms.musicActivityOnCreateFingerprint
|
||||
@@ -68,7 +69,7 @@ val customBrandingPatch = baseCustomBrandingPatch(
|
||||
preferenceScreen = PreferenceScreen.GENERAL,
|
||||
|
||||
block = {
|
||||
dependsOn(disableSplashAnimationPatch)
|
||||
dependsOn(sharedExtensionPatch, disableSplashAnimationPatch)
|
||||
|
||||
compatibleWith(
|
||||
"com.google.android.apps.youtube.music"(
|
||||
|
||||
@@ -21,7 +21,6 @@ import app.revanced.util.findElementByAttributeValueOrThrow
|
||||
import app.revanced.util.removeFromParent
|
||||
import app.revanced.util.returnEarly
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.Node
|
||||
import org.w3c.dom.NodeList
|
||||
import java.io.File
|
||||
import java.util.logging.Logger
|
||||
@@ -106,6 +105,7 @@ internal fun baseCustomBrandingPatch(
|
||||
|
||||
dependsOn(
|
||||
addResourcesPatch,
|
||||
|
||||
bytecodePatch {
|
||||
execute {
|
||||
mainActivityOnCreateFingerprint.method.addInstruction(
|
||||
@@ -201,6 +201,135 @@ internal fun baseCustomBrandingPatch(
|
||||
)
|
||||
}
|
||||
|
||||
document("AndroidManifest.xml").use { document ->
|
||||
// Create launch aliases that can be programmatically selected in app.
|
||||
fun createAlias(
|
||||
aliasName: String,
|
||||
iconMipmapName: String,
|
||||
appNameIndex: Int,
|
||||
useCustomName: Boolean,
|
||||
enabled: Boolean,
|
||||
intents: NodeList
|
||||
): Element {
|
||||
val label = if (useCustomName) {
|
||||
if (customName == null) {
|
||||
"Custom" // Dummy text, and normally cannot be seen.
|
||||
} else {
|
||||
customName!!
|
||||
}
|
||||
} else if (appNameIndex == 1) {
|
||||
// Indexing starts at 1.
|
||||
originalAppName
|
||||
} else {
|
||||
"@string/revanced_custom_branding_name_entry_$appNameIndex"
|
||||
}
|
||||
val alias = document.createElement("activity-alias")
|
||||
alias.setAttribute("android:name", aliasName)
|
||||
alias.setAttribute("android:enabled", enabled.toString())
|
||||
alias.setAttribute("android:exported", "true")
|
||||
alias.setAttribute("android:icon", "@mipmap/$iconMipmapName")
|
||||
alias.setAttribute("android:label", label)
|
||||
alias.setAttribute("android:targetActivity", mainActivityName)
|
||||
|
||||
// Copy all intents from the original alias so long press actions still work.
|
||||
if (copyExistingIntentsToAliases) {
|
||||
for (i in 0 until intents.length) {
|
||||
alias.appendChild(
|
||||
intents.item(i).cloneNode(true)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
val intentFilter = document.createElement("intent-filter").apply {
|
||||
val action = document.createElement("action")
|
||||
action.setAttribute("android:name", "android.intent.action.MAIN")
|
||||
appendChild(action)
|
||||
|
||||
val category = document.createElement("category")
|
||||
category.setAttribute("android:name", "android.intent.category.LAUNCHER")
|
||||
appendChild(category)
|
||||
}
|
||||
alias.appendChild(intentFilter)
|
||||
}
|
||||
|
||||
return alias
|
||||
}
|
||||
|
||||
val application = document.getElementsByTagName("application").item(0) as Element
|
||||
val intentFilters = document.childNodes.findElementByAttributeValueOrThrow(
|
||||
"android:name",
|
||||
activityAliasNameWithIntents
|
||||
).childNodes
|
||||
|
||||
// The YT application name can appear in some places along side the system
|
||||
// YouTube app, such as the settings app list and in the "open with" file picker.
|
||||
// Because the YouTube app cannot be completely uninstalled and only disabled,
|
||||
// use a custom name for this situation to disambiguate which app is which.
|
||||
application.setAttribute(
|
||||
"android:label",
|
||||
"@string/revanced_custom_branding_name_entry_2"
|
||||
)
|
||||
|
||||
for (appNameIndex in 1 .. numberOfPresetAppNames) {
|
||||
fun aliasName(name: String): String = ".revanced_" + name + '_' + appNameIndex
|
||||
|
||||
val useCustomNameLabel = (useCustomName && appNameIndex == numberOfPresetAppNames)
|
||||
|
||||
// Original icon.
|
||||
application.appendChild(
|
||||
createAlias(
|
||||
aliasName = aliasName(ORIGINAL_USER_ICON_STYLE_NAME),
|
||||
iconMipmapName = originalLauncherIconName,
|
||||
appNameIndex = appNameIndex,
|
||||
useCustomName = useCustomNameLabel,
|
||||
enabled = (appNameIndex == 1),
|
||||
intentFilters
|
||||
)
|
||||
)
|
||||
|
||||
// Bundled icons.
|
||||
iconStyleNames.forEachIndexed { index, style ->
|
||||
application.appendChild(
|
||||
createAlias(
|
||||
aliasName = aliasName(style),
|
||||
iconMipmapName = LAUNCHER_RESOURCE_NAME_PREFIX + style,
|
||||
appNameIndex = appNameIndex,
|
||||
useCustomName = useCustomNameLabel,
|
||||
enabled = false,
|
||||
intentFilters
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// User provided custom icon.
|
||||
//
|
||||
// Must add all aliases even if the user did not provide a custom icon of their own.
|
||||
// This is because if the user installs with an option, then repatches without the option,
|
||||
// the alias must still exist because if it was previously enabled and then it's removed
|
||||
// the app will become broken and cannot launch. Even if the app data is cleared
|
||||
// it still cannot be launched and the only fix is to uninstall the app.
|
||||
// To prevent this, always include all aliases and use dummy data if needed.
|
||||
application.appendChild(
|
||||
createAlias(
|
||||
aliasName = aliasName(CUSTOM_USER_ICON_STYLE_NAME),
|
||||
iconMipmapName = LAUNCHER_RESOURCE_NAME_PREFIX + CUSTOM_USER_ICON_STYLE_NAME,
|
||||
appNameIndex = appNameIndex,
|
||||
useCustomName = useCustomNameLabel,
|
||||
enabled = false,
|
||||
intentFilters
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Remove the main action from the original alias, otherwise two apps icons
|
||||
// can be shown in the launcher. Can only be done after adding the new aliases.
|
||||
intentFilters.findElementByAttributeValueOrThrow(
|
||||
"android:name",
|
||||
"android.intent.action.MAIN"
|
||||
).removeFromParent()
|
||||
}
|
||||
|
||||
// Copy custom icons last, so if the user enters an invalid icon path
|
||||
// and an exception is thrown then the critical manifest changes are still made.
|
||||
if (useCustomIcon) {
|
||||
// Copy user provided files
|
||||
val iconPathFile = File(customIcon!!.trim())
|
||||
@@ -263,125 +392,6 @@ internal fun baseCustomBrandingPatch(
|
||||
}
|
||||
}
|
||||
|
||||
document("AndroidManifest.xml").use { document ->
|
||||
// Create launch aliases that can be programmatically selected in app.
|
||||
fun createAlias(
|
||||
aliasName: String,
|
||||
iconMipmapName: String,
|
||||
appNameIndex: Int,
|
||||
useCustomName: Boolean,
|
||||
enabled: Boolean,
|
||||
intents: NodeList
|
||||
): Element {
|
||||
val label = if (useCustomName) {
|
||||
if (customName == null) {
|
||||
"Custom" // Dummy text, and normally cannot be seen.
|
||||
} else {
|
||||
customName!!
|
||||
}
|
||||
} else if (appNameIndex == 1) {
|
||||
// Indexing starts at 1.
|
||||
originalAppName
|
||||
} else {
|
||||
"@string/revanced_custom_branding_name_entry_$appNameIndex"
|
||||
}
|
||||
val alias = document.createElement("activity-alias")
|
||||
alias.setAttribute("android:name", aliasName)
|
||||
alias.setAttribute("android:enabled", enabled.toString())
|
||||
alias.setAttribute("android:exported", "true")
|
||||
alias.setAttribute("android:icon", "@mipmap/$iconMipmapName")
|
||||
alias.setAttribute("android:label", label)
|
||||
alias.setAttribute("android:targetActivity", mainActivityName)
|
||||
|
||||
// Copy all intents from the original alias so long press actions still work.
|
||||
if (copyExistingIntentsToAliases) {
|
||||
for (i in 0 until intents.length) {
|
||||
alias.appendChild(
|
||||
intents.item(i).cloneNode(true)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
val intentFilter = document.createElement("intent-filter").apply {
|
||||
val action = document.createElement("action")
|
||||
action.setAttribute("android:name", "android.intent.action.MAIN")
|
||||
appendChild(action)
|
||||
|
||||
val category = document.createElement("category")
|
||||
category.setAttribute("android:name", "android.intent.category.LAUNCHER")
|
||||
appendChild(category)
|
||||
}
|
||||
alias.appendChild(intentFilter)
|
||||
}
|
||||
|
||||
return alias
|
||||
}
|
||||
|
||||
val intentFilters = document.childNodes.findElementByAttributeValueOrThrow(
|
||||
"android:name",
|
||||
activityAliasNameWithIntents
|
||||
).childNodes
|
||||
|
||||
val application = document.getElementsByTagName("application").item(0) as Element
|
||||
|
||||
for (appNameIndex in 1 .. numberOfPresetAppNames) {
|
||||
fun aliasName(name: String): String = ".revanced_" + name + '_' + appNameIndex
|
||||
|
||||
val useCustomNameLabel = (useCustomName && appNameIndex == numberOfPresetAppNames)
|
||||
|
||||
// Original icon.
|
||||
application.appendChild(
|
||||
createAlias(
|
||||
aliasName = aliasName(ORIGINAL_USER_ICON_STYLE_NAME),
|
||||
iconMipmapName = originalLauncherIconName,
|
||||
appNameIndex = appNameIndex,
|
||||
useCustomName = useCustomNameLabel,
|
||||
enabled = (appNameIndex == 1),
|
||||
intentFilters
|
||||
)
|
||||
)
|
||||
|
||||
// Bundled icons.
|
||||
iconStyleNames.forEachIndexed { index, style ->
|
||||
application.appendChild(
|
||||
createAlias(
|
||||
aliasName = aliasName(style),
|
||||
iconMipmapName = LAUNCHER_RESOURCE_NAME_PREFIX + style,
|
||||
appNameIndex = appNameIndex,
|
||||
useCustomName = useCustomNameLabel,
|
||||
enabled = false,
|
||||
intentFilters
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// User provided custom icon.
|
||||
//
|
||||
// Must add all aliases even if the user did not provide a custom icon of their own.
|
||||
// This is because if the user installs with an option, then repatches without the option,
|
||||
// the alias must still exist because if it was previously enabled and then it's removed
|
||||
// the app will become broken and cannot launch. Even if the app data is cleared
|
||||
// it still cannot be launched and the only fix is to uninstall the app.
|
||||
// To prevent this, always include all aliases and use dummy data if needed.
|
||||
application.appendChild(
|
||||
createAlias(
|
||||
aliasName = aliasName(CUSTOM_USER_ICON_STYLE_NAME),
|
||||
iconMipmapName = LAUNCHER_RESOURCE_NAME_PREFIX + CUSTOM_USER_ICON_STYLE_NAME,
|
||||
appNameIndex = appNameIndex,
|
||||
useCustomName = useCustomNameLabel,
|
||||
enabled = false,
|
||||
intentFilters
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Remove the main action from the original alias, otherwise two apps icons
|
||||
// can be shown in the launcher. Can only be done after adding the new aliases.
|
||||
intentFilters.findElementByAttributeValueOrThrow(
|
||||
"android:name",
|
||||
"android.intent.action.MAIN"
|
||||
).removeFromParent()
|
||||
}
|
||||
|
||||
executeBlock()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user