From 18c0b04f0cd1bf8cd78b05af3b8ebe3a6a5f9e48 Mon Sep 17 00:00:00 2001 From: Swakshan <56347042+Swakshan@users.noreply.github.com> Date: Mon, 19 Jan 2026 14:31:42 +0530 Subject: [PATCH] feat(Instagram): Add `Remove build expired popup` patch (#6488) Co-authored-by: oSumAtrIX --- patches/api/patches.api | 4 +++ .../removeBuildExpiredPopup/Fingerprints.kt | 12 +++++++++ .../RemoveBuildExpiredPopupPatch.kt | 27 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/Fingerprints.kt create mode 100644 patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/RemoveBuildExpiredPopupPatch.kt diff --git a/patches/api/patches.api b/patches/api/patches.api index bcdb1bace..52f732b31 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -336,6 +336,10 @@ public final class app/revanced/patches/instagram/misc/links/OpenLinksExternally public static final fun getOpenLinksExternallyPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } +public final class app/revanced/patches/instagram/misc/removeBuildExpiredPopup/RemoveBuildExpiredPopupPatchKt { + public static final fun getRemoveBuildExpiredPopupPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatchKt { public static final fun getChangeLinkSharingDomainPatch ()Lapp/revanced/patcher/patch/BytecodePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/Fingerprints.kt new file mode 100644 index 000000000..ad4a66540 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/Fingerprints.kt @@ -0,0 +1,12 @@ + +package app.revanced.patches.instagram.misc.removeBuildExpiredPopup + +import app.revanced.patcher.fingerprint +import app.revanced.util.literal + +internal const val MILLISECOND_IN_A_DAY_LITERAL = 0x5265c00L + +internal val appUpdateLockoutBuilderFingerprint = fingerprint { + strings("android.hardware.sensor.hinge_angle") + literal { MILLISECOND_IN_A_DAY_LITERAL } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/RemoveBuildExpiredPopupPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/RemoveBuildExpiredPopupPatch.kt new file mode 100644 index 000000000..9d19e928e --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/removeBuildExpiredPopup/RemoveBuildExpiredPopupPatch.kt @@ -0,0 +1,27 @@ +package app.revanced.patches.instagram.misc.removeBuildExpiredPopup + +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patcher.extensions.InstructionExtensions.getInstruction +import app.revanced.patcher.extensions.InstructionExtensions.instructions +import app.revanced.patcher.patch.bytecodePatch +import com.android.tools.smali.dexlib2.Opcode +import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction + +@Suppress("unused") +val removeBuildExpiredPopupPatch = bytecodePatch( + name = "Remove build expired popup", + description = "Removes the popup that appears after a while, when the app version ages.", +) { + compatibleWith("com.instagram.android") + + execute { + appUpdateLockoutBuilderFingerprint.method.apply { + val longToIntIndex = instructions.first { it.opcode == Opcode.LONG_TO_INT }.location.index + val appAgeRegister = getInstruction(longToIntIndex).registerA + + // Set app age to 0 days old such that the build expired popup doesn't appear. + addInstruction(longToIntIndex + 1, "const v$appAgeRegister, 0x0") + } + } +} +