feat(Instagram): Add Follow back indicator patch#6564
feat(Instagram): Add Follow back indicator patch#6564Swakshan wants to merge 2 commits intoReVanced:devfrom
Follow back indicator patch#6564Conversation
...n/kotlin/app/revanced/patches/instagram/misc/followBackIndicator/FollowBackIndicatorPatch.kt
Show resolved
Hide resolved
Follow back indicatorFollow back indicator patch
...nstagram/src/main/java/app/revanced/extension/instagram/misc/followbackindicator/Helper.java
Outdated
Show resolved
Hide resolved
| if(loggedInUserId.equals(viewingProfileUserId)) return; | ||
|
|
||
| Boolean followed_by = Helper.getFollowbackInfo(viewingProfileUserObject); | ||
| String indicatorText = followed_by ? "User follows you" : "User does not follow you"; |
There was a problem hiding this comment.
shorter
| String indicatorText = followed_by ? "User follows you" : "User does not follow you"; | |
| String indicatorText = followed_by ? "Follows you" : "Does not follow you"; |
There was a problem hiding this comment.
could even not show anything at all if doesnt follow back
There was a problem hiding this comment.
I feel its better to have a consistent feedback, rather than showing for some and not showing for others.
extensions/instagram/stub/src/main/java/com/instagram/common/session/UserSession.java
Show resolved
Hide resolved
...n/kotlin/app/revanced/patches/instagram/misc/followBackIndicator/FollowBackIndicatorPatch.kt
Show resolved
Hide resolved
patches/src/main/kotlin/app/revanced/patches/instagram/misc/followBackIndicator/Fingerprint.kt
Outdated
Show resolved
Hide resolved
patches/src/main/kotlin/app/revanced/patches/instagram/misc/followBackIndicator/Fingerprint.kt
Outdated
Show resolved
Hide resolved
...n/kotlin/app/revanced/patches/instagram/misc/followBackIndicator/FollowBackIndicatorPatch.kt
Outdated
Show resolved
Hide resolved
| index: Int, | ||
| value: String, | ||
| ) { | ||
| method.instructions.filter { it.opcode == Opcode.CONST_STRING }[index].let { instruction -> |
There was a problem hiding this comment.
sequence to avoid unnecessary filtering all instructions
| method.instructions.filter { it.opcode == Opcode.CONST_STRING }[index].let { instruction -> | |
| method.instructions.asSequence().filter { it.opcode == Opcode.CONST_STRING }.elementAt(index).let { instruction -> |
| value: String, | ||
| ) { | ||
| method.instructions.filter { it.opcode == Opcode.CONST_STRING }[index].let { instruction -> | ||
| val register = (instruction as BuilderInstruction21c).registerA |
There was a problem hiding this comment.
Better to understand
| val register = (instruction as BuilderInstruction21c).registerA | |
| val register = (instruction as OneRegisterInstruction).registerA |
|
|
||
| // This constant stores the value of the obfuscated profile info class, | ||
| // which is later used to find the index of the parameter. | ||
| var profileInfoClassName:String |
There was a problem hiding this comment.
| var profileInfoClassName:String | |
| var profileInfoClassName: String |
| // This fingerprint is used to identify field name in obfuscated profile info class, | ||
| // that holds user data. | ||
| bindRowViewTypesFingerprint.method.apply { | ||
| val igetObjectInstruction = instructions.first { it.opcode == Opcode.IGET_OBJECT } |
There was a problem hiding this comment.
Try running a format in your IDE theres a couple of formatting issues
|
|
||
| invoke-static {v$dummyRegistry1,v$dummyRegistry2, v$internalBadgeRegistry}, ${EXTENSION_CLASS_DESCRIPTOR}FollowBackIndicatorPatch;->indicator($userSessionClassName Ljava/lang/Object;Ljava/lang/Object;)V | ||
| goto :revanced | ||
| """.trimIndent(), |
There was a problem hiding this comment.
| """.trimIndent(), | |
| """, |
| val dummyRegistry2 = getInstruction<OneRegisterInstruction>(internalBadgeStringIndex).registerA | ||
|
|
||
| // Instruction to which the call needs to transfer after our hook. | ||
| val invokeStaticRangeIndex = indexOfFirstInstruction(internalBadgeInstructionIndex, Opcode.INVOKE_STATIC_RANGE) |
There was a problem hiding this comment.
Instruction to which the call needs to transfer after our hook.
Whats the reason for this? PLease add in the comment
There was a problem hiding this comment.
Basically Instagram does their check on whether or not developer tag/badge needs to be displayed (which is always false in production and the visibility is set to GONE), which in some builds are done in a seperate method and in some, they do it without a method. So to avoid it, I have added the hook before they do their developer badge check and transfer the flow, avoiding their check, which is this static-range instructions.
This patch aims are bringing a follow back indicator on user profile, which indicates which the viewing profile is following the user or not.
I tested it on 414, 415, 416 alphas and the patch was working fine.