Skip to content

feat(Instagram): Add Focus Lock patch - #1928

Merged
naoverse06 merged 1 commit into
crimera:devfrom
jonasradke:pr/focus-lock
Sep 26, 2026
Merged

naoverse06 merged 1 commit into
crimera:devfrom
jonasradke:pr/focus-lock

Conversation

@jonasradke

@jonasradke jonasradke commented Sep 21, 2026 •

Copy link
Copy Markdown

Summary

Adds a Focus Lock patch for Instagram. It is aimed at people who turn Reels off and then keep turning them back on.

You pick what to block (Reels, Explore) and how long for, from 1 day up to 3 months, then press Lock now. While the lock is on:

  • The Reels tab is gone from the navigation bar and Reels scrolling is off. Reels someone sends you in a DM, a story or a notification still open normally.
  • Explore is off, if you picked it.
  • The switches it enforces show as on and greyed out. It never writes to the stored value, so whatever you had set comes back once the lock ends.
  • Reset Piko settings and Import settings are refused, because either one would wipe the lock.

To unlock early you press Request unlock, wait 24 hours, then confirm. A pending request can be cancelled.

Notes

  • FocusLock holds the lock state. Enforcement is OR-ed into the existing Pref getters, so nothing in the existing patches changes shape.
  • The Reels tab is removed in NavigationBarPatch.applyFocusLock, after the config is saved, so the user's saved layout is left alone.
  • Reels are not blocked at the network layer, on purpose. /api/v1/clips/discover/stream/ serves both the Reels tab and a single shared reel, so blocking it breaks reels opened from a story or the notifications tab.
  • The settings live at the top of the Distraction free section.
  • Uninstalling the app or moving the system clock clears the lock. That is out of scope. The point is friction, not DRM.

Test plan

Tested on a patched Instagram build:

  • Lock, app restarts, Reels tab gone, enforced switches greyed out
  • Reels open from DMs, stories and the notifications tab, and swiping to the next one is blocked
  • CI buildAndroid passes on top of dev

Comment thread README.md Outdated
@vippium

vippium commented Sep 24, 2026

Copy link
Copy Markdown

What about app uninstallation and reinstall ?? Will this surpass the mode ??

@jonasradke

jonasradke commented Sep 24, 2026 •

Copy link
Copy Markdown
Author

@vippium yes. Uninstalling and reinstalling clears the app's shared preferences, so the lock goes with it. Moving the system clock forward does the same.

That is by design rather than something I tried to close. The patch can only add friction, because the data lives inside the app it is patching. What it does cover is the impulse path, which is the one that actually gets used at 11pm: flipping the switch back, resetting Piko settings, or importing an older settings file. A hard stop needs something outside the app.

@jonasradke

jonasradke commented Sep 24, 2026 •

Copy link
Copy Markdown
Author

Fixed the deep link bug. /api/v1/clips/discover/stream/ serves both the Reels tab feed and a single reel opened from a story or the notifications tab, so blocking it broke those. There is no way to tell the two apart by URL, so Focus Lock no longer blocks Reels at the network layer. Removing the tab and disabling scrolling already cover the endless feed. Explore blocking is unchanged.

Confirmed working on device. The branch is squashed into a single commit.

Comment thread extensions/instagram/src/main/java/app/morphe/extension/instagram/utils/Pref.java Outdated
Commitment mode for cutting down on Instagram usage. The user picks what to
block (Reels, Explore) and a duration (1 day to 3 months). While locked:

- The Reels tab is removed from the navigation bar and Reels scrolling is
  disabled. Reels shared with you in a DM, story or notification still open
- Explore is disabled (optional)
- The enforced switches are shown checked and greyed out in settings, without
  writing to the stored value, so the user's own choices return afterwards
- Reset settings and import settings are refused, since either would drop the lock

Unlocking early requires requesting an unlock and waiting a 24 hour
cooling-off period before confirming, so the decision cannot be made on impulse.

Blocked URIs are logged when Piko debug is on.
@naoverse06

Copy link
Copy Markdown
Collaborator

lgtm

@naoverse06
naoverse06 merged commit 2b6b5ac into crimera:dev Sep 26, 2026
1 check passed
@jonasradke

Copy link
Copy Markdown
Author

thanks for the merge. opened #1953 as a follow up, it lets the lock hold any distraction free setting instead of just reels and explore.

github-actions Bot pushed a commit to Xiaorui-Huang/piko that referenced this pull request Sep 27, 2026
## [3.10.0-personal.4](v3.10.0-personal.3...v3.10.0-personal.4) (2026-09-27)

### 🐛 Bug Fixes

* **Instagram:** add auto-scroll persistence flag to recommended flags ([crimera#1957](https://github.com/Xiaorui-Huang/piko/issues/1957)) ([096ea87](096ea87)), closes [crimera#1746](https://github.com/Xiaorui-Huang/piko/issues/1746)
* **Instagram:** invoke reflected methods on the correct receiver ([crimera#1960](https://github.com/Xiaorui-Huang/piko/issues/1960)) ([e4a9464](e4a9464))
* **Instagram:** remove forced HDR brightness on photos and Reels ([crimera#1955](https://github.com/Xiaorui-Huang/piko/issues/1955)) ([0084136](0084136)), closes [crimera#1817](https://github.com/Xiaorui-Huang/piko/issues/1817)
* **Instagram:** Restore skip-and-toast when a download already exists ([50d0b6b](50d0b6b)), closes [crimera#1923](https://github.com/Xiaorui-Huang/piko/issues/1923)

### ✨ New Features

* **Instagram:** Add `Focus Lock` patch ([crimera#1928](https://github.com/Xiaorui-Huang/piko/issues/1928)) ([2b6b5ac](2b6b5ac))
* **Instagram:** Add download buttons to Reels and Stories ([a5ad0da](a5ad0da))
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.

4 participants