mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-31 18:28:48 -04:00
checkpoint
This commit is contained in:
parent
c22d6fcff8
commit
8c22bf8cc0
24 changed files with 673 additions and 56 deletions
63
lib/veilid_support/init.dart
Normal file
63
lib/veilid_support/init.dart
Normal file
|
@ -0,0 +1,63 @@
|
|||
import 'package:veilid/veilid.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'processor.dart';
|
||||
|
||||
Future<String> getVeilidVersion() async {
|
||||
String veilidVersion;
|
||||
try {
|
||||
veilidVersion = Veilid.instance.veilidVersionString();
|
||||
} on Exception {
|
||||
veilidVersion = 'Failed to get veilid version.';
|
||||
}
|
||||
return veilidVersion;
|
||||
}
|
||||
|
||||
// Initialize Veilid
|
||||
// Call only once.
|
||||
void _init() {
|
||||
if (kIsWeb) {
|
||||
var platformConfig = VeilidWASMConfig(
|
||||
logging: VeilidWASMConfigLogging(
|
||||
performance: VeilidWASMConfigLoggingPerformance(
|
||||
enabled: true,
|
||||
level: VeilidConfigLogLevel.debug,
|
||||
logsInTimings: true,
|
||||
logsInConsole: false),
|
||||
api: VeilidWASMConfigLoggingApi(
|
||||
enabled: true, level: VeilidConfigLogLevel.info)));
|
||||
Veilid.instance.initializeVeilidCore(platformConfig.json);
|
||||
} else {
|
||||
var platformConfig = VeilidFFIConfig(
|
||||
logging: VeilidFFIConfigLogging(
|
||||
terminal: VeilidFFIConfigLoggingTerminal(
|
||||
enabled: false,
|
||||
level: VeilidConfigLogLevel.debug,
|
||||
),
|
||||
otlp: VeilidFFIConfigLoggingOtlp(
|
||||
enabled: false,
|
||||
level: VeilidConfigLogLevel.trace,
|
||||
grpcEndpoint: "localhost:4317",
|
||||
serviceName: "VeilidChat"),
|
||||
api: VeilidFFIConfigLoggingApi(
|
||||
enabled: true, level: VeilidConfigLogLevel.info)));
|
||||
Veilid.instance.initializeVeilidCore(platformConfig.json);
|
||||
}
|
||||
}
|
||||
|
||||
// Called from FlutterFlow stub initialize() function upon Main page load
|
||||
bool initialized = false;
|
||||
Processor processor = Processor();
|
||||
|
||||
Future<void> initializeVeilid() async {
|
||||
if (initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Init Veilid
|
||||
_init();
|
||||
|
||||
// Startup Veilid
|
||||
await processor.startup();
|
||||
|
||||
initialized = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue