From 746e5ccc64b29f40c4d1789de738b0923f1baa75 Mon Sep 17 00:00:00 2001 From: Brandon Vandegrift <798832-bmv437@users.noreply.gitlab.com> Date: Thu, 3 Apr 2025 13:51:14 -0400 Subject: [PATCH] Fix getting stuck on splash screen when veilid is already started --- .../repository/processor_repository.dart | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/veilid_processor/repository/processor_repository.dart b/lib/veilid_processor/repository/processor_repository.dart index 7ff2482..a92347c 100644 --- a/lib/veilid_processor/repository/processor_repository.dart +++ b/lib/veilid_processor/repository/processor_repository.dart @@ -44,8 +44,21 @@ class ProcessorRepository { log.info('Veilid version: $veilidVersion'); - final updateStream = await Veilid.instance - .startupVeilidCore(await getVeilidConfig(kIsWeb, VeilidChatApp.name)); + Stream updateStream; + + try { + log.debug('Starting VeilidCore'); + updateStream = await Veilid.instance + .startupVeilidCore(await getVeilidConfig(kIsWeb, VeilidChatApp.name)); + } on VeilidAPIExceptionAlreadyInitialized catch (_) { + log.debug( + 'VeilidCore is already started, shutting down and restarting...'); + startedUp = true; + await shutdown(); + updateStream = await Veilid.instance + .startupVeilidCore(await getVeilidConfig(kIsWeb, VeilidChatApp.name)); + } + _updateSubscription = updateStream.listen((update) { if (update is VeilidLog) { processLog(update);