feat(Instagram): corrections

This commit is contained in:
Swakshan 2026-02-07 16:59:27 +05:30
parent 9187b6480b
commit b89566469e
5 changed files with 12 additions and 15 deletions

View file

@ -6,7 +6,7 @@ import app.revanced.extension.instagram.misc.followbackindicator.Helper;
import com.instagram.common.session.UserSession;
@SuppressWarnings("unused")
public class FollowBackIndicator {
public class FollowBackIndicatorPatch {
public static void indicator(UserSession userSession, Object profileInfoObject, Object badgeObject){
try {
@ -18,7 +18,7 @@ public class FollowBackIndicator {
if(loggedInUserId.equals(viewingProfileUserId)) return;
Boolean followed_by = Helper.getFollowbackInfo(viewingProfileUserObject);
String indicatorText = followed_by ? "User follows you" : "User does not follow you";
String indicatorText = followed_by ? "Follows you" : "Does not follow you";
Helper.setInternalBadgeText(badgeObject,indicatorText);
} catch (Exception ex){

View file

@ -75,6 +75,4 @@ public class Helper {
badgeView.setVisibility(View.VISIBLE);
badgeView.setText(text);
}
}

View file

@ -1,9 +1,7 @@
package com.instagram.common.session;
public class UserSession {
public String getUserId() {
return "";
}
}

View file

@ -3,6 +3,8 @@ import app.revanced.patcher.fingerprint
import com.android.tools.smali.dexlib2.AccessFlags
internal const val INTERNAL_BADGE_TARGET_STRING = "bindInternalBadges"
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/instagram/misc/followbackindicator/"
internal const val EXTENSION_HELPER_CLASS_DESCRIPTOR = "${EXTENSION_CLASS_DESCRIPTOR}Helper;"
internal val bindInternalBadgeFingerprint = fingerprint {
strings(INTERNAL_BADGE_TARGET_STRING)
@ -20,16 +22,13 @@ internal val nametagResultCardViewSetButtonMethodFingerprint = fingerprint {
}
}
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/instagram/misc/followbackindicator/"
internal const val EXTENSION_HELPER_CLASS_DESCRIPTOR = "${EXTENSION_CLASS_DESCRIPTOR}Helper;"
internal val getFollowbackInfoInfoExtension = fingerprint {
internal val getFollowbackInfoExtensionFingerprint = fingerprint {
custom { method, classDef ->
method.name == "getFollowbackInfo" && classDef.type == EXTENSION_HELPER_CLASS_DESCRIPTOR
}
}
internal val getViewingProfileUserObjectInfoExtension = fingerprint {
internal val getViewingProfileUserObjectExtensionFingerprint = fingerprint {
custom { method, classDef ->
method.name == "getViewingProfileUserObject" && classDef.type == EXTENSION_HELPER_CLASS_DESCRIPTOR
}

View file

@ -24,7 +24,9 @@ val followBackIndicatorPatch = bytecodePatch(
use = true,
) {
dependsOn(sharedExtensionPatch)
compatibleWith("com.instagram.android")
execute {
/**
* This function replaces a string instruction with a new one.
@ -49,10 +51,10 @@ val followBackIndicatorPatch = bytecodePatch(
val invokeStaticMethodReference = getInstruction(moveResultIndex - 1).getReference<MethodReference>()
val methodDefClassName = invokeStaticMethodReference!!.definingClass.removePrefix("L").replace("/", ".").removeSuffix(";")
getFollowbackInfoInfoExtension.changeString(0,methodDefClassName)
getFollowbackInfoExtensionFingerprint.changeString(0,methodDefClassName)
val methodName = invokeStaticMethodReference.name
getFollowbackInfoInfoExtension.changeString(1,methodName)
getFollowbackInfoExtensionFingerprint.changeString(1,methodName)
}
// This constant stores the value of the obfuscated profile info class,
@ -65,7 +67,7 @@ val followBackIndicatorPatch = bytecodePatch(
val igetObjectInstruction = instructions.first { it.opcode == Opcode.IGET_OBJECT }
val fieldReference = igetObjectInstruction.getReference<FieldReference>()
val userObjectFieldName = fieldReference!!.name
getViewingProfileUserObjectInfoExtension.changeString(0,userObjectFieldName)
getViewingProfileUserObjectExtensionFingerprint.changeString(0,userObjectFieldName)
profileInfoClassName = fieldReference.definingClass
}
@ -109,7 +111,7 @@ val followBackIndicatorPatch = bytecodePatch(
iget-object v$dummyRegistry1, v$userProfilePageRegistry, $userProfilePageElementsClassName->$userSessionFieldName:$userSessionClassName
move-object/from16 v$dummyRegistry2, p$profileInfoParameter
invoke-static {v$dummyRegistry1,v$dummyRegistry2, v$internalBadgeRegistry}, ${EXTENSION_CLASS_DESCRIPTOR}FollowBackIndicator;->indicator($userSessionClassName Ljava/lang/Object;Ljava/lang/Object;)V
invoke-static {v$dummyRegistry1,v$dummyRegistry2, v$internalBadgeRegistry}, ${EXTENSION_CLASS_DESCRIPTOR}FollowBackIndicatorPatch;->indicator($userSessionClassName Ljava/lang/Object;Ljava/lang/Object;)V
goto :revanced
""".trimIndent(),
ExternalLabel("revanced", getInstruction(invokeStaticRangeIndex)),