Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors app/service initialization and platform abstractions, updates the desktop auto-updater to be feature-flag driven, improves Android VPN lifecycle robustness, and removes Sentry from the project.
Changes:
- Removed
sentry_flutterdependency and its generated platform registrations (Windows/Linux/macOS/iOS). - Reworked initialization flow:
LanternCoreServicenow has aninit()contract;injectServices()performs more structured async setup; timezone init is moved off the critical path. - Updated desktop
Updaterto fetch/parse feature flags viaLanternServiceand respectautoUpdateEnabled; improved Android VPN teardown/startup checks and warning logging.
Reviewed changes
Copilot reviewed 18 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| windows/flutter/generated_plugins.cmake | Drops Sentry/jni entries from generated Windows plugin lists. |
| windows/flutter/generated_plugin_registrant.cc | Removes Sentry plugin registration on Windows. |
| linux/flutter/generated_plugins.cmake | Drops Sentry/jni entries from generated Linux plugin lists. |
| linux/flutter/generated_plugin_registrant.cc | Removes Sentry plugin registration on Linux. |
| macos/Podfile.lock | Removes Sentry CocoaPods entries for macOS. |
| ios/Podfile.lock | Removes Sentry CocoaPods entries for iOS. |
| macos/Flutter/GeneratedPluginRegistrant.swift | Removes Sentry (and currently also PathProvider) registration from macOS registrant. |
| pubspec.yaml | Removes sentry_flutter dependency. |
| pubspec.lock | Removes sentry_flutter, sentry, and jni packages. |
| lib/main.dart | Moves timezone config to background; simplifies startup and updater init call flow. |
| lib/lantern_app.dart | Removes deep link debug logging noise. |
| lib/lantern/lantern_core_service.dart | Adds init() to the core service interface. |
| lib/lantern/lantern_service.dart | Implements init() delegating to FFI vs platform service; refactors method formatting/signatures. |
| lib/lantern/lantern_platform_service.dart | Adjusts init behavior (no eager enabled-app snapshot refresh). |
| lib/lantern/lantern_ffi_service.dart | Adds init() override marker and provides no-op init for the mock service. |
| lib/core/services/injection_container.dart | Refactors DI/service initialization ordering, concurrency, and logging. |
| lib/core/updater/updater.dart | Fetches feature flags from LanternService, parses JSON, and gates auto-updater by flag. |
| lib/core/models/feature_flags.dart | Removes Sentry flag; reorders/retains update flag. |
| lib/core/common/app_secrets.dart | Removes Sentry DSN configuration helper. |
| android/app/src/main/kotlin/org/getlantern/lantern/utils/LanternLogger.kt | Includes stack traces in WARN log persistence. |
| android/app/src/main/kotlin/org/getlantern/lantern/service/LanternVpnService.kt | Hardens VPN teardown/start logic around Radiance/VPN connection checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sl.registerSingleton<LanternService>(lanternService); | ||
| } catch (e) { | ||
| appLogger.error('LanternService init failed', e); | ||
| } |
There was a problem hiding this comment.
Isn’t the safer pattern here to register LanternService first, then call init()?
With the current flow, if init() fails, LanternService is never registered and later sl() lookups can hard-crash startup
There was a problem hiding this comment.
Fixed. Now, if even if init fails, we still register services
This pull request introduces several improvements and refactors across the codebase, focusing mainly on service initialization, platform abstraction, and reliability enhancements. The most important changes are grouped below by theme.
Service Initialization & Dependency Injection:
injectServicesinlib/core/services/injection_container.dartto initialize services more robustly and asynchronously, with improved error handling and logging. Services are now registered as singletons after successful initialization, and Stripe/notification services are handled together for Android.initmethod to theLanternCoreServiceinterface and implemented it inLanternFFIService,MockLanternFFIService,LanternPlatformService, andLanternServiceto ensure proper initialization of platform and FFI services. Initialization is now lazy and avoids blocking UI rendering. [1] [2] [3] [4] [5] [6]Platform Abstraction & Method Refactoring:
LanternServicefor payment, split tunnel, and login methods to use named parameters for clarity and consistency. [1] [2] [3] [4] [5] [6]Updater Logic & Feature Flags:
Updaterlogic to fetch feature flags directly fromLanternService, parse them from JSON, and respect theautoUpdateEnabledflag with a default value. Improved error handling and logging for update checks. [1] [2]Reliability Improvements (Android VPN Service):
LanternVpnService.ktto only callMobile.stopVPN()if Radiance IPC is connected, preventing misleading errors and unnecessary calls. Also, ensured Radiance setup is retried before starting the VPN tunnel if it was killed by the OS. [1] [2]stopVPNTunnelto skip stopping the VPN if it is not connected, improving robustness.Logging Enhancements:
LanternLogger.ktto include stack traces for better debugging and visibility.These changes collectively improve reliability, maintainability, and clarity in service initialization, platform abstraction, and error handling throughout the application.