Add app source and tests
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
28
lib/Peach/see/splash/ViewSplash.dart
Normal file
28
lib/Peach/see/splash/ViewSplash.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import '../parent/ParentViewModel.dart';
|
||||
import 'ConnectSplash.dart';
|
||||
|
||||
class ViewSplash extends ParentViewModel {
|
||||
ConnectSplash connection;
|
||||
|
||||
ViewSplash(super.context, this.connection);
|
||||
|
||||
/// Reads the stored servers, deployment history and theme preference, then
|
||||
/// hands them to the screen. The splash is deliberately held for a minimum
|
||||
/// duration so a fast read doesn't make it flash.
|
||||
void bootstrap() async {
|
||||
final started = DateTime.now();
|
||||
try {
|
||||
final servers = await getDataManager().getServers();
|
||||
final history = await getDataManager().getDeployments();
|
||||
final themeMode = await getDataManager().getThemeMode();
|
||||
|
||||
const minShow = Duration(milliseconds: 1300);
|
||||
final elapsed = DateTime.now().difference(started);
|
||||
if (elapsed < minShow) await Future.delayed(minShow - elapsed);
|
||||
|
||||
connection.onBootstrapped(servers, history, themeMode);
|
||||
} catch (error) {
|
||||
handleError(error, bootstrap, () {}, "Retry");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user