Skip to content

System tray changes#8568

Merged
jigar-f merged 5 commits intomainfrom
jigar/sys-tray-back
Mar 24, 2026
Merged

System tray changes#8568
jigar-f merged 5 commits intomainfrom
jigar/sys-tray-back

Conversation

@jigar-f
Copy link
Contributor

@jigar-f jigar-f commented Mar 24, 2026

Added back the sys tray changes that got removed on #8447

This pull request refactors how server location state is managed and consumed across the application. The main change is converting the serverLocationProvider from an asynchronous provider to a synchronous notifier, simplifying how server location data is accessed and updated. The system tray logic is also significantly improved, adding richer menu options and better state handling for location and routing mode.

Key changes include:

State Management Refactor:

  • Refactored serverLocationProvider from an AsyncNotifier to a synchronous Notifier, removing the need for .when, .value, and handling of loading/error states throughout the codebase. This impacts how server location is read and updated in all consumers. [1] [2] [3]
  • Updated provider usages in home.dart, home_notifier.dart, and location_setting.dart to directly use the synchronous value from serverLocationProvider instead of handling async states. [1] [2] [3] [4]
  • Updated VpnNotifier to read the server location synchronously, removing null checks and async handling.

System Tray Enhancements:

  • Improved the system tray menu to show the current location (with flag emoji), allow smart location selection, and provide routing mode options (Smart/Full Tunnel) directly in the tray. Added listeners for server location and routing mode changes to keep the tray menu in sync. [1] [2] [3] [4] [5]
  • Added a utility to convert country codes to flag emojis for display in the tray.

Code Cleanup and Consistency:

  • Removed unnecessary async handling and error/loading UI branches now that server location is always available synchronously. [1] [2] [3] [4]
  • Updated generated provider files to match the new synchronous notifier pattern. [1] [2] [3]

These changes make the codebase simpler, more predictable, and enhance the user experience in the system tray.

Copilot AI review requested due to automatic review settings March 24, 2026 13:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores and enhances desktop system tray functionality while simplifying VPN server-location state handling by refactoring serverLocationProvider from async to synchronous state.

Changes:

  • Refactored serverLocationProvider to a synchronous Notifier, updating consumers to remove AsyncValue handling.
  • Enhanced the desktop system tray menu with current location display, smart location selection, and routing mode toggles.
  • Added isTagAvailable() to LanternCoreService and used it to fall back to auto VPN when a selected server tag is unavailable.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/lantern/lantern_service_notifier.g.dart Regenerated provider hash after service API changes.
lib/lantern/lantern_service.dart Routes new isTagAvailable() call to FFI vs platform implementation.
lib/lantern/lantern_platform_service.dart Implements method-channel isTagAvailable() for non-FFI platforms.
lib/lantern/lantern_generated_bindings.dart Adds generated FFI binding symbol for isTagAvailable.
lib/lantern/lantern_ffi_service.dart Implements FFI-based isTagAvailable() used by VPN start flow.
lib/lantern/lantern_core_service.dart Extends core service interface with isTagAvailable().
lib/features/vpn/server_selection.dart Updates UI to consume synchronous serverLocationProvider.
lib/features/vpn/provider/vpn_notifier.g.dart Regenerated provider hash after notifier changes.
lib/features/vpn/provider/vpn_notifier.dart Uses synchronous server location and checks tag availability before connecting.
lib/features/vpn/provider/server_location_notifier.g.dart Regenerated provider as synchronous NotifierProvider.
lib/features/vpn/provider/server_location_notifier.dart Makes server location state synchronous and updates mutation logic accordingly.
lib/features/vpn/location_setting.dart Simplifies settings tile by removing async when branches.
lib/features/system_tray/provider/system_tray_notifier.g.dart Regenerated provider hash after tray logic changes.
lib/features/system_tray/provider/system_tray_notifier.dart Adds richer tray menu + listeners for server location and routing mode, plus flag emoji utility.
lib/features/home/provider/home_notifier.dart Simplifies reset logic using synchronous serverLocationProvider.
lib/features/home/home.dart Simplifies body rendering by consuming synchronous server location directly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jigar-f jigar-f merged commit 1eac47d into main Mar 24, 2026
8 checks passed
@jigar-f jigar-f deleted the jigar/sys-tray-back branch March 24, 2026 14:11
atavism added a commit that referenced this pull request Mar 24, 2026
* Update radiance + lantern-box for bandit distributed tracing (#8566)

- radiance: picks up lantern-box v0.0.51
- lantern-box v0.0.51: propagates traceparent from bandit callback URLs,
  enabling contiguous distributed tracing across the feedback loop

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* System tray changes (#8568)

* added back sys tray changes

* server location changes

* add flags only on desktop versions.

* code review updates (#8569)

* Update lantern_platform_service.dart

---------

Co-authored-by: atavism <atavism@users.noreply.github.com>

* Update radiance with bandit callback fixes (#8570)

Picks up:
- Pre-test uses live network config (not stale disk config)
- updateGroup fires SetURLOverrides + CheckOutbounds on repeat configs
- Pre-test timeout 5s → 15s for proxy callback tests

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* code review updates

---------

Co-authored-by: Myles Horton <afisk@getlantern.org>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: jigar-f <132374182+jigar-f@users.noreply.github.com>
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.

3 participants