Skip to content

Fetch newest commits when the Log tab is selected again - #151

Closed
arzola wants to merge 5 commits into
NativePHP:mainfrom
arzola:feat/log-tab-reselect
Closed

arzola wants to merge 5 commits into
NativePHP:mainfrom
arzola:feat/log-tab-reselect

Conversation

@arzola

@arzola arzola commented Nov 2, 2026

Copy link
Copy Markdown

Tapping the already-selected Log tab in the bottom bar now takes the current log back to the top and fetches the newest commits. Commits already waiting in the new-commits pill go in immediately; Trending re-ranks like pull-to-refresh.

What changed

  • Adds Tab::onReselect() to NativePHP's bottom-tab API and wires the on_reselect callback in both native renderers.
  • Android sends the callback when the selected tab is tapped at its root URI.
  • iOS needs a small UITabBar tap observer because SwiftUI's TabView does not report a tap on the already-selected tab. The observer only watches; it leaves the bar and its delegate alone.
  • Log::backToTopAndFetchNewest() resets the list key, applies the pill on Following/Latest, and calls the existing load() refresh.
  • The tab reselect only acts at the tab root. Tapping Log on a pushed commit/profile screen stays a no-op; the iOS bar is hidden there anyway.

The NativePHP patch

on_reselect is not in a released NativePHP version yet, so the app carries a version-pinned patch for nativephp/mobile 4.7.x:

  • patches/nativephp-mobile-tab-reselect.patch (PHP side, applied in the staged on-device copy too)
  • patches/nativephp-mobile-tab-reselect-native.patch (iOS/Android renderers)
  • scripts/apply-nativephp-patches.php, wired into Composer's post-install-cmd and post-update-cmd

The script fails loudly on a NativePHP version bump, and warns when native:install --force has not copied the patched renderers into nativephp/ios / nativephp/android. The long-term fix is an upstream PR to NativePHP/mobile-air; once released, the patch and hook can be deleted.

Tests

  • php artisan test --compact — 1708 passed, 2 deprecated, 1 skipped.
  • vendor/bin/pint --dirty --format agent — passed.
  • iOS build and launch on the iPhone 17 Pro simulator: succeeds, no boot fatals.

Android was not built because no emulator was running; the Compose path is patched but still needs a device check. The iOS tap was also not confirmed after the final observer fix, so this is a draft until the manual check passes.

Screenshots

  • No visible change

Behavior-only change: no screen looks different. Once the iOS tap is confirmed, a short recording of the gesture can be added if reviewers want it.

@arzola arzola closed this Nov 2, 2026
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.

1 participant