Browse Source

harbour: Fix quick actions when app is already open

pull/23/head
jld3103 2 years ago
parent
commit
df18bf13b8
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 3
      packages/harbour/lib/app.dart
  2. 2
      packages/harbour/lib/src/blocs/apps.dart
  3. 1
      packages/harbour/lib/src/pages/home/home.dart

3
packages/harbour/lib/app.dart

@ -50,6 +50,9 @@ class _HarbourAppState extends State<HarbourApp> with WidgetsBindingObserver {
} else {
await _navigatorKey.currentState!.pushAndRemoveUntil(
MaterialPageRoute(
settings: const RouteSettings(
name: 'home',
),
builder: (final context) => HomePage(
account: activeAccount,
onThemeChanged: (final theme) {

2
packages/harbour/lib/src/blocs/apps.dart

@ -31,7 +31,7 @@ class AppsBloc extends $AppsBloc {
_$refreshEvent.listen((final _) => _loadApps);
_$setActiveAppEvent.listen((final appId) async {
final data = (await _appImplementationsSubject.firstWhere((final result) => result.data != null)).data!;
if (data.where((final app) => app.id == appId).isNotEmpty) {
if (data.where((final app) => app.id == appId).isNotEmpty && _activeAppSubject.valueOrNull != appId) {
_activeAppSubject.add(appId);
}
});

1
packages/harbour/lib/src/pages/home/home.dart

@ -157,6 +157,7 @@ class _HomePageState extends State<HomePage> with tray.TrayListener, WindowListe
if (matches.isNotEmpty) {
final appId = matches[0].group(1);
_appsBloc.setActiveApp(appId);
Navigator.of(context).popUntil((final route) => route.settings.name == 'home');
if (_platform.canUseWindowManager) {
await _showAndRestoreWindow();
}

Loading…
Cancel
Save