Skip to content

Fix #9 and #14: persistent Messenger button, back gesture, overlay/comment overlap - #17

Closed
Zokii0 wants to merge 1 commit into
mretallack:mainfrom
Zokii0:fixes-9-and-14
Closed

Zokii0 wants to merge 1 commit into
mretallack:mainfrom
Zokii0:fixes-9-and-14

Conversation

@Zokii0

@Zokii0 Zokii0 commented Oct 14, 2026

Copy link
Copy Markdown

Fixes #9.
Fixes #14.

This PR bundles three related fixes that touch the same files (MainActivity.kt, AuthorDatabase.kt, activity_main.xml). The patch was checked to apply cleanly, but the Kotlin changes are uncompiled and everything needs a quick on-device check. Items that depend on Facebook's live DOM are marked as heuristics.

Summary of changes

File Change
MainActivity.kt Messenger button wiring, new back handling, badge/button visibility, layout-fix injection, 2 new debug-menu entries
DragHelper.kt (new) Touch helper to make floating overlays draggable (position persisted)
AuthorDatabase.kt Persist overlay offsets + "show Messenger button" setting
res/layout/activity_main.xml New messengerButton; badge default margin moved up
res/drawable/ic_messenger.xml, bg_messenger_button.xml (new) Button icon / round background
assets/layout_fix.js (new) Fixes comment reaction chips overlapping following content

1. Persistent Messenger shortcut (#14)

The Messenger entry was only in Facebook's own header at the very top of the feed, so users had to scroll all the way up. A new 44dp round ImageView (messengerButton) is added in the root FrameLayout (bottom-end, above the shield badge), using the same desktop-UA redirect the in-page Message tab already uses. It is hidden in chat mode, when the composer has focus, or when disabled in settings. Debug menu gets "Hide/Show Messenger button" and "Reset button/badge positions".

2. System back gesture inside a post

Migrated from the deprecated onBackPressed() to OnBackPressedDispatcher (OnBackPressedCallback). goBackVerified() checks a page fingerprint before/after goBack() and falls back to clicking Facebook's own back control (PAGE_BACK_JS). Back exits only at feed root. The aria-label list is not exhaustive and the structural fallback is a heuristic — if Facebook changes that control, back falls through to the plain goBack()/exit behaviour, i.e. never worse than before.

3. Floating shield badge overlaps comment composer (#9)

DragHelper.kt makes the badge and Messenger button draggable (position persisted via AuthorDatabase.setOverlayOffset). Default badge bottom margin raised 12dp → 84dp to start above the composer row; Messenger button defaults 52dp above that.

4. Comment reaction chips overlap next comment / "Show previous replies"

New assets/layout_fix.js (injected on feed pages only, never chat) detects absolutely-positioned small chip elements and moves them back into normal flow (position: relative), so they reserve their own space. DOM-agnostic; runs debounced on scroll/resize/mutations; logs LAYOUT_FIX:chip-fixed:…. This is a heuristic written without access to Facebook's live DOM.

Manual test checklist

  1. Feed: round Messenger button visible; tap opens Messenger; back returns to feed.
  2. Long-press shield badge → debug menu shows the 2 new entries; hide/show and reset positions work.
  3. Drag badge and button; positions persist after restart and rotation.
  4. Open comment composer: both overlays hide with keyboard and return after.
  5. Open post, use system back: returns to feed (also from comment thread and notification-opened post).
  6. At feed root, back exits the app.
  7. Scroll comments with "Show previous replies": chips no longer overlap.

Not tested

No Gradle/Android SDK, no device. slimbook-fixes.patch applies cleanly and layout_fix.js passes node --check, but the Kotlin changes are uncompiled.

@mretallack

Copy link
Copy Markdown
Owner

Checks are failing, please check and see what's wrong.

@mretallack

Copy link
Copy Markdown
Owner

Checks are failing, please check and see what's wrong.

Actually looks like a rate limit

@Zokii0

Zokii0 commented Oct 14, 2026

Copy link
Copy Markdown
Author

As I couldn't figure it out, I guessed it's about that, and wanted to try again later

@mretallack

Copy link
Copy Markdown
Owner

Ok i have built and installed, it mostly works, but has some sequence issues, meaning the icon disapears sonetimes. So needs more testing.

@Zokii0

Zokii0 commented Oct 14, 2026 •

Copy link
Copy Markdown
Author

Want me to try fix that too and update PR? But i can do that tomorrow

@mretallack

mretallack commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

@Zokii0 to help understand how this could be implemented, what is your use-case for messanger, is it that your looking at facebook and then decide to send or check a message? Or that you open facebook to check your messages? Is this feature mostly to read incomming messages or send a message? This helps understand what your doing.

@Zokii0

Zokii0 commented Oct 15, 2026

Copy link
Copy Markdown
Author

Yes, i meant that 1st scenario where i'm scrolling on fb feed and then get on mind to send something at that moment, but honestly i only used/tried Messenger when tried your app 1st time for notifications, i'll need to test again, so i'm sorry for not checking everything first. If you want, you can ignore this PR (or parts of it related to Messenger) and just implement fix for comments overlaps and system back gesture fix. I'll be able to make new PR when get home, which won't be till evening (for more hours from now)

@mretallack

Copy link
Copy Markdown
Owner

@Zokii0 thanks, can you create a new pr with just the fix for comments overlaps and system back gesture.

@Zokii0

Zokii0 commented Oct 15, 2026

Copy link
Copy Markdown
Author

I'll create it (and test Messenger) once i get home, so will close this PR

@Zokii0 Zokii0 closed this Oct 15, 2026
@Zokii0

Zokii0 commented Oct 15, 2026

Copy link
Copy Markdown
Author

I'll try make new PR later, i tested Messenger, and have few more things to add, but Claude limit reached, so have to wait few hours, if not today, then tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants