mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-01-23 05:51:06 -05:00
things compile
This commit is contained in:
parent
a551791f97
commit
45ab494969
@ -59,8 +59,7 @@ class VeilidChatApp extends StatelessWidget {
|
|||||||
child: BackgroundTicker(
|
child: BackgroundTicker(
|
||||||
builder: (context) => MaterialApp.router(
|
builder: (context) => MaterialApp.router(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
routerConfig:
|
routerConfig: context.watch<RouterCubit>().router(),
|
||||||
BlocProvider.of<RouterCubit>(context).router(),
|
|
||||||
title: translate('app.title'),
|
title: translate('app.title'),
|
||||||
theme: theme,
|
theme: theme,
|
||||||
localizationsDelegates: [
|
localizationsDelegates: [
|
||||||
|
@ -127,6 +127,9 @@ class RouterCubit extends Cubit<RouterState> {
|
|||||||
if (!state.hasAnyAccount) {
|
if (!state.hasAnyAccount) {
|
||||||
return '/new_account';
|
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(
|
if (responsiveVisibility(
|
||||||
context: context,
|
context: context,
|
||||||
tablet: false,
|
tablet: false,
|
||||||
@ -141,6 +144,9 @@ class RouterCubit extends Cubit<RouterState> {
|
|||||||
if (!state.hasAnyAccount) {
|
if (!state.hasAnyAccount) {
|
||||||
return '/new_account';
|
return '/new_account';
|
||||||
}
|
}
|
||||||
|
if (!state.hasActiveChat) {
|
||||||
|
return '/home/no_active';
|
||||||
|
}
|
||||||
if (responsiveVisibility(
|
if (responsiveVisibility(
|
||||||
context: context,
|
context: context,
|
||||||
tablet: false,
|
tablet: false,
|
||||||
@ -153,6 +159,21 @@ class RouterCubit extends Cubit<RouterState> {
|
|||||||
return '/home';
|
return '/home';
|
||||||
}
|
}
|
||||||
return null;
|
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':
|
case '/settings':
|
||||||
return null;
|
return null;
|
||||||
case '/developer':
|
case '/developer':
|
||||||
@ -163,7 +184,12 @@ class RouterCubit extends Cubit<RouterState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Make a GoRouter instance that uses this cubit
|
/// 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,
|
navigatorKey: _rootNavKey,
|
||||||
refreshListenable: StreamListenable(stream.startWith(state).distinct()),
|
refreshListenable: StreamListenable(stream.startWith(state).distinct()),
|
||||||
debugLogDiagnostics: kDebugMode,
|
debugLogDiagnostics: kDebugMode,
|
||||||
@ -171,9 +197,11 @@ class RouterCubit extends Cubit<RouterState> {
|
|||||||
routes: routes,
|
routes: routes,
|
||||||
redirect: redirect,
|
redirect: redirect,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
|
|
||||||
late final StreamSubscription<AccountRepositoryChange>
|
late final StreamSubscription<AccountRepositoryChange>
|
||||||
_accountRepositorySubscription;
|
_accountRepositorySubscription;
|
||||||
|
GoRouter? _router;
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,13 @@ class LockPreference with _$LockPreference {
|
|||||||
|
|
||||||
// Theme supports multiple translations
|
// Theme supports multiple translations
|
||||||
enum LanguagePreference {
|
enum LanguagePreference {
|
||||||
englishUS;
|
englishUs;
|
||||||
|
|
||||||
factory LanguagePreference.fromJson(dynamic j) =>
|
factory LanguagePreference.fromJson(dynamic j) =>
|
||||||
LanguagePreference.values.byName((j as String).toCamelCase());
|
LanguagePreference.values.byName((j as String).toCamelCase());
|
||||||
String toJson() => name.toPascalCase();
|
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
|
// 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);
|
await preferencesRepository.set(newPrefs);
|
||||||
switcher.changeTheme(theme: newThemePrefs.themeData());
|
switcher.changeTheme(theme: newThemePrefs.themeData());
|
||||||
onChanged();
|
onChanged();
|
||||||
|
|
||||||
onChanged();
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ Widget waitingPage({String? text}) => Builder(
|
|||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
buildProgressIndicator(),
|
buildProgressIndicator().expanded(),
|
||||||
if (text != null) Text(text)
|
if (text != null) Text(text)
|
||||||
]))));
|
]))));
|
||||||
|
|
||||||
|
@ -230,6 +230,8 @@ class DHTRecordPool with TableDBBacked<DHTRecordPoolAllocations> {
|
|||||||
final dhtctx = routingContext ?? _routingContext;
|
final dhtctx = routingContext ?? _routingContext;
|
||||||
final recordDescriptor = await dhtctx.createDHTRecord(schema);
|
final recordDescriptor = await dhtctx.createDHTRecord(schema);
|
||||||
|
|
||||||
|
await _locks.lockTag(recordDescriptor.key);
|
||||||
|
|
||||||
final rec = DHTRecord(
|
final rec = DHTRecord(
|
||||||
routingContext: dhtctx,
|
routingContext: dhtctx,
|
||||||
recordDescriptor: recordDescriptor,
|
recordDescriptor: recordDescriptor,
|
||||||
|
Loading…
Reference in New Issue
Block a user