Merge branch 'feature/fix-veilidcore-already-started' into 'main'

Fix getting stuck on splash screen when VeilidCore is already started

See merge request veilid/veilidchat!42
This commit is contained in:
Brandon Vandegrift 2025-04-04 15:55:37 +00:00
commit f2d5c31349

View File

@ -44,8 +44,21 @@ class ProcessorRepository {
log.info('Veilid version: $veilidVersion');
final updateStream = await Veilid.instance
.startupVeilidCore(await getVeilidConfig(kIsWeb, VeilidChatApp.name));
Stream<VeilidUpdate> 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);