mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2024-12-26 16:19:31 -05:00
42 lines
1022 B
Dart
42 lines
1022 B
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:veilid_support/veilid_support.dart';
|
|
|
|
import 'account_manager/account_manager.dart';
|
|
import 'app.dart';
|
|
import 'tools/tools.dart';
|
|
import 'veilid_processor/veilid_processor.dart';
|
|
|
|
final Completer<void> eventualInitialized = Completer<void>();
|
|
|
|
// Initialize Veilid
|
|
Future<void> initializeVeilid() async {
|
|
// Init Veilid
|
|
Veilid.instance.initializeVeilidCore(
|
|
getDefaultVeilidPlatformConfig(kIsWeb, VeilidChatApp.name));
|
|
|
|
// Veilid logging
|
|
initVeilidLog(kDebugMode);
|
|
|
|
// DHT Record Pool
|
|
await DHTRecordPool.init();
|
|
|
|
// Startup Veilid
|
|
await ProcessorRepository.instance.startup();
|
|
}
|
|
|
|
// Initialize repositories
|
|
Future<void> initializeRepositories() async {
|
|
await AccountRepository.instance.init();
|
|
}
|
|
|
|
Future<void> initializeVeilidChat() async {
|
|
log.info('Initializing Veilid');
|
|
await initializeVeilid();
|
|
log.info('Initializing Repositories');
|
|
await initializeRepositories();
|
|
|
|
eventualInitialized.complete();
|
|
}
|