mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-01-22 21:41:07 -05:00
things compile
This commit is contained in:
parent
a551791f97
commit
45ab494969
@ -59,8 +59,7 @@ class VeilidChatApp extends StatelessWidget {
|
||||
child: BackgroundTicker(
|
||||
builder: (context) => MaterialApp.router(
|
||||
debugShowCheckedModeBanner: false,
|
||||
routerConfig:
|
||||
BlocProvider.of<RouterCubit>(context).router(),
|
||||
routerConfig: context.watch<RouterCubit>().router(),
|
||||
title: translate('app.title'),
|
||||
theme: theme,
|
||||
localizationsDelegates: [
|
||||
|
@ -127,6 +127,9 @@ class RouterCubit extends Cubit<RouterState> {
|
||||
if (!state.hasAnyAccount) {
|
||||
return '/new_account';
|
||||
}
|
||||
if (!state.hasActiveChat) { xxx stop using hasActiveChat here... we need a pager for the accounts and a way to get the current account state maybe a 'activeAccountCubit' or something, we may have this alraeady but it needs to work even if logged out.``
|
||||
return '/home/no_active';
|
||||
}
|
||||
if (responsiveVisibility(
|
||||
context: context,
|
||||
tablet: false,
|
||||
@ -141,6 +144,9 @@ class RouterCubit extends Cubit<RouterState> {
|
||||
if (!state.hasAnyAccount) {
|
||||
return '/new_account';
|
||||
}
|
||||
if (!state.hasActiveChat) {
|
||||
return '/home/no_active';
|
||||
}
|
||||
if (responsiveVisibility(
|
||||
context: context,
|
||||
tablet: false,
|
||||
@ -153,6 +159,21 @@ class RouterCubit extends Cubit<RouterState> {
|
||||
return '/home';
|
||||
}
|
||||
return null;
|
||||
case '/home/no_active':
|
||||
if (state.hasActiveChat) {
|
||||
return '/home';
|
||||
}
|
||||
return null;
|
||||
case '/home/account_missing':
|
||||
if (!state.hasActiveChat) {
|
||||
return '/home/no_active';
|
||||
}
|
||||
return null;
|
||||
case '/home/account_locked':
|
||||
if (!state.hasActiveChat) {
|
||||
return '/home/no_active';
|
||||
}
|
||||
return null;
|
||||
case '/settings':
|
||||
return null;
|
||||
case '/developer':
|
||||
@ -163,7 +184,12 @@ class RouterCubit extends Cubit<RouterState> {
|
||||
}
|
||||
|
||||
/// Make a GoRouter instance that uses this cubit
|
||||
GoRouter router() => GoRouter(
|
||||
GoRouter router() {
|
||||
final r = _router;
|
||||
if (r != null) {
|
||||
return r;
|
||||
}
|
||||
return _router = GoRouter(
|
||||
navigatorKey: _rootNavKey,
|
||||
refreshListenable: StreamListenable(stream.startWith(state).distinct()),
|
||||
debugLogDiagnostics: kDebugMode,
|
||||
@ -171,9 +197,11 @@ class RouterCubit extends Cubit<RouterState> {
|
||||
routes: routes,
|
||||
redirect: redirect,
|
||||
);
|
||||
}
|
||||
|
||||
////////////////
|
||||
|
||||
late final StreamSubscription<AccountRepositoryChange>
|
||||
_accountRepositorySubscription;
|
||||
GoRouter? _router;
|
||||
}
|
||||
|
@ -28,13 +28,13 @@ class LockPreference with _$LockPreference {
|
||||
|
||||
// Theme supports multiple translations
|
||||
enum LanguagePreference {
|
||||
englishUS;
|
||||
englishUs;
|
||||
|
||||
factory LanguagePreference.fromJson(dynamic j) =>
|
||||
LanguagePreference.values.byName((j as String).toCamelCase());
|
||||
String toJson() => name.toPascalCase();
|
||||
|
||||
static const LanguagePreference defaults = LanguagePreference.englishUS;
|
||||
static const LanguagePreference defaults = LanguagePreference.englishUs;
|
||||
}
|
||||
|
||||
// Preferences are stored in a table locally and globally affect all
|
||||
|
@ -49,7 +49,5 @@ Widget buildSettingsPageColorPreferences({required void Function() onChanged}) {
|
||||
await preferencesRepository.set(newPrefs);
|
||||
switcher.changeTheme(theme: newThemePrefs.themeData());
|
||||
onChanged();
|
||||
|
||||
onChanged();
|
||||
}));
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ Widget waitingPage({String? text}) => Builder(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: Center(
|
||||
child: Column(children: [
|
||||
buildProgressIndicator(),
|
||||
buildProgressIndicator().expanded(),
|
||||
if (text != null) Text(text)
|
||||
]))));
|
||||
|
||||
|
@ -230,6 +230,8 @@ class DHTRecordPool with TableDBBacked<DHTRecordPoolAllocations> {
|
||||
final dhtctx = routingContext ?? _routingContext;
|
||||
final recordDescriptor = await dhtctx.createDHTRecord(schema);
|
||||
|
||||
await _locks.lockTag(recordDescriptor.key);
|
||||
|
||||
final rec = DHTRecord(
|
||||
routingContext: dhtctx,
|
||||
recordDescriptor: recordDescriptor,
|
||||
|
Loading…
Reference in New Issue
Block a user