Skip to content

fix(instagram): pass current carousel index to reel overflow buttons - #1586

Merged
swakwork merged 1 commit into
crimera:devfrom
kuntal-devrat:dev
Jul 26, 2026
Merged

fix(instagram): pass current carousel index to reel overflow buttons#1586
swakwork merged 1 commit into
crimera:devfrom
kuntal-devrat:dev

Conversation

@kuntal-devrat

Copy link
Copy Markdown
Contributor

Problem

When a reel post contains multiple images (carousel/slideshow), tapping the download button or any other overflow menu button (external downloader, more options) always operated on slide 1, regardless of which slide the user was currently viewing. The index was hardcoded to 0 in all ReelButton subclasses.

Root Cause

The reel overflow button hook (ClipsOrganicMediaItemViewMoreOptionsController) did not pass the current carousel position to the extension. No index was read from the controller at hook time.

Fix

The hook now reads CURRENT_MEDIA_FIELD from MEDIA_ADD_INFO_CLASS_NAME on the controller class — the same field and pattern already used by the feed onClick hook (HookOverflowMenuButtonOnClickPatch).

A safe three-instruction register sequence is used to avoid clobbering live registers (which caused a previous crash):

iget-object freeReg, self, mediaExtraDataField    ← read extra-data obj (self still intact)
iget        freeReg, freeReg, CURRENT_MEDIA_FIELD ← read int index (safe reuse of freeReg)
iget-object self,    self,    appActivityField    ← clobber self LAST, after all reads done

Falls back to index 0 via a 3-arg overload if mediaExtraDataField is not found on the controller class.

hookReelOverflowMenuButton now depends on decoderEntity to ensure CURRENT_MEDIA_FIELD and MEDIA_ADD_INFO_CLASS_NAME are resolved before the hook runs.

Testing

Confirmed on a real device — downloading from slide 3 of a carousel reel correctly downloads slide 3. Single-video reels and the reel overflow bottom sheet are unaffected.

Note

The consent popup fix (#1574, #1563) is handled separately in PR #1585 which introduces a dedicated Disable onboarding permission prompts patch.

Closes #1562

@kuntal-devrat

kuntal-devrat commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Addressed — removed the unused 2-parameter constructors from all button subclasses (DownloadButton, ExternalDownloadButton, InfoButton, DebugButton) and from the base ReelButton class. Force pushed.

its good to go

When a reel post contains multiple images, all overflow buttons
(download, external downloader, info) always operated on slide 1
(index hardcoded to 0), regardless of which slide the user was viewing.

The hook now reads CURRENT_MEDIA_FIELD from MEDIA_ADD_INFO_CLASS_NAME
on the controller class using the same safe register pattern as the
feed onClick hook (HookOverflowMenuButtonOnClickPatch):

  iget-object freeReg, self, mediaExtraDataField    <- read obj (self intact)
  iget        freeReg, freeReg, CURRENT_MEDIA_FIELD <- read int index
  iget-object self,    self,    appActivityField    <- clobber self LAST

Falls back to index 0 via 3-arg overload if mediaExtraDataField is
not found on the controller class.

Note: The consent popup fix (crimera#1574, crimera#1563) is handled by PR crimera#1585
which adds a dedicated 'Disable onboarding permission prompts' patch.

Closes crimera#1562
@kuntal-devrat

Copy link
Copy Markdown
Contributor Author

Addressed all three comments:

  1. DebugButton — reverted to 2-param constructor with hardcoded index 0, since it doesn't use the index.
  2. Fallback else branch — removed. The controller class confirmed to always have the \MEDIA_ADD_INFO_CLASS_NAME\ field (tested on device). The fallback was dead code.
  3. Removed the now-unused 3-arg \includeCustomReelOverflowButtons\ overload from \AddReelButton\ as well.

Force pushed.

@swakwork
swakwork merged commit a80bf4a into crimera:dev Jul 26, 2026
1 check passed
@swakwork

Copy link
Copy Markdown
Collaborator

Just noticed MEDIA_ADD_INFO_CLASS_NAME isn't present in the Add Reels Button class

github-actions Bot pushed a commit to kuntal-devrat/piko that referenced this pull request Jul 26, 2026
## [3.9.0-dev.1](v3.8.0...v3.9.0-dev.1) (2026-07-26)

### 🐛 Bug Fixes

* **instagram:** fix comments loading indefinitely after scrolling ([a62fe8f](a62fe8f)), closes [crimera#1551](https://github.com/Flaxmbot/piko/issues/1551)
* **instagram:** pass current carousel index to reel overflow buttons ([crimera#1586](https://github.com/Flaxmbot/piko/issues/1586)) ([a80bf4a](a80bf4a))
* **Twitter:** Fix `More information on profile` fingerprint on 12.11 ([3b5c945](3b5c945))

### ✨ New Features

* **Instagram:** New patch to block onboarding permission prompts ([9b6e569](9b6e569))
github-actions Bot pushed a commit to kuntal-devrat/piko that referenced this pull request Jul 26, 2026
## [3.9.0-dev.1](v3.8.0...v3.9.0-dev.1) (2026-07-26)

### 🐛 Bug Fixes

* **instagram:** fix comments loading indefinitely after scrolling ([05cdc19](05cdc19)), closes [crimera#1551](https://github.com/Flaxmbot/piko/issues/1551)
* **instagram:** pass current carousel index to reel overflow buttons ([crimera#1586](https://github.com/Flaxmbot/piko/issues/1586)) ([a80bf4a](a80bf4a))
* **Twitter:** Fix `More information on profile` fingerprint on 12.11 ([3b5c945](3b5c945))

### ✨ New Features

* **Instagram:** New patch to block onboarding permission prompts ([9b6e569](9b6e569))
@kuntal-devrat

Copy link
Copy Markdown
Contributor Author

Just noticed MEDIA_ADD_INFO_CLASS_NAME isn't present in the Add Reels Button class

My bad 😔 and I saw that you fixed that.

I will be more careful from now on 😅

Actually I'm new into this....so please

github-actions Bot pushed a commit that referenced this pull request Jul 26, 2026
## [3.9.0-dev.1](v3.8.0...v3.9.0-dev.1) (2026-07-26)

### 🐛 Bug Fixes

* **Instagram:** Fix reels current media logic ([40836e8](40836e8))
* **Instagram:** Fix register issue while hooking reel overflow menu ([83786a8](83786a8))
* **instagram:** pass current carousel index to reel overflow buttons ([#1586](#1586)) ([a80bf4a](a80bf4a))
* **Twitter:** Fix `More information on profile` fingerprint on 12.11 ([3b5c945](3b5c945))

### ✨ New Features

* **Instagram:** New patch to block onboarding permission prompts ([9b6e569](9b6e569))

### 🚀 Updated App Support

* **Instagram:** Add support for `439.0.0.37.89` ([3e38d22](3e38d22))
* **Twitter:** Add support for `12.11.0-release.0` ([cdca6a8](cdca6a8))
github-actions Bot pushed a commit to kuntal-devrat/piko that referenced this pull request Jul 27, 2026
## [3.9.0-dev.1](v3.8.0...v3.9.0-dev.1) (2026-07-27)

### 🐛 Bug Fixes

* **instagram:** fix comments loading indefinitely after scrolling ([5551851](5551851)), closes [crimera#1551](https://github.com/Flaxmbot/piko/issues/1551)
* **Instagram:** Fix reels current media logic ([40836e8](40836e8))
* **Instagram:** Fix register issue while hooking reel overflow menu ([83786a8](83786a8))
* **instagram:** pass current carousel index to reel overflow buttons ([crimera#1586](https://github.com/Flaxmbot/piko/issues/1586)) ([a80bf4a](a80bf4a))
* **instagram:** prevent register corruption in commentButtonClickCheckPatch ([b419b19](b419b19))
* **Twitter:** Fix `More information on profile` fingerprint on 12.11 ([3b5c945](3b5c945))

### ✨ New Features

* **Instagram:** New patch to block onboarding permission prompts ([9b6e569](9b6e569))

### 🚀 Updated App Support

* **Instagram:** Add support for `439.0.0.37.89` ([3e38d22](3e38d22))
* **Twitter:** Add support for `12.11.0-release.0` ([cdca6a8](cdca6a8))
github-actions Bot pushed a commit to kuntal-devrat/piko that referenced this pull request Jul 27, 2026
## [3.9.0-dev.1](v3.8.0...v3.9.0-dev.1) (2026-07-27)

### 🐛 Bug Fixes

* **instagram:** fix comments loading indefinitely after scrolling ([5551851](5551851)), closes [crimera#1551](https://github.com/Flaxmbot/piko/issues/1551)
* **Instagram:** Fix reels current media logic ([40836e8](40836e8))
* **Instagram:** Fix register issue while hooking reel overflow menu ([83786a8](83786a8))
* **instagram:** pass current carousel index to reel overflow buttons ([crimera#1586](https://github.com/Flaxmbot/piko/issues/1586)) ([a80bf4a](a80bf4a))
* **instagram:** prevent register corruption in commentButtonClickCheckPatch ([b419b19](b419b19))
* **Twitter:** Fix `More information on profile` fingerprint on 12.11 ([3b5c945](3b5c945))

### ✨ New Features

* **Instagram:** New patch to block onboarding permission prompts ([9b6e569](9b6e569))

### 🚀 Updated App Support

* **Instagram:** Add support for `439.0.0.37.89` ([3e38d22](3e38d22))
* **Twitter:** Add support for `12.11.0-release.0` ([cdca6a8](cdca6a8))
github-actions Bot pushed a commit to kuntal-devrat/piko that referenced this pull request Jul 27, 2026
## [3.9.0-dev.1](v3.8.0...v3.9.0-dev.1) (2026-07-27)

### 🐛 Bug Fixes

* **instagram:** fix comments loading indefinitely after scrolling ([5551851](5551851)), closes [crimera#1551](https://github.com/Flaxmbot/piko/issues/1551)
* **Instagram:** Fix reels current media logic ([40836e8](40836e8))
* **Instagram:** Fix register issue while hooking reel overflow menu ([83786a8](83786a8))
* **instagram:** pass current carousel index to reel overflow buttons ([crimera#1586](https://github.com/Flaxmbot/piko/issues/1586)) ([a80bf4a](a80bf4a))
* **instagram:** prevent register corruption in commentButtonClickCheckPatch ([b419b19](b419b19))
* **Twitter:** Fix `More information on profile` fingerprint on 12.11 ([3b5c945](3b5c945))

### ✨ New Features

* **Instagram:** New patch to block onboarding permission prompts ([9b6e569](9b6e569))

### 🚀 Updated App Support

* **Instagram:** Add support for `439.0.0.37.89` ([3e38d22](3e38d22))
* **Twitter:** Add support for `12.11.0-release.0` ([cdca6a8](cdca6a8))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants