Resetting filter doesn't reset sorting, some bugfixes and UI updates

This commit is contained in:
Anton Stubenbord
2022-12-14 17:57:01 +01:00
parent a3c3810d35
commit 4bf4ff1cbd
23 changed files with 327 additions and 253 deletions

View File

@@ -1,3 +1,4 @@
import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
@@ -34,6 +35,7 @@ import 'package:paperless_mobile/features/document_upload/cubit/document_upload_
import 'package:paperless_mobile/features/document_upload/view/document_upload_preparation_page.dart';
import 'package:paperless_mobile/features/home/view/home_page.dart';
import 'package:paperless_mobile/features/login/bloc/authentication_cubit.dart';
import 'package:paperless_mobile/features/login/services/authentication_service.dart';
import 'package:paperless_mobile/features/login/view/login_page.dart';
import 'package:paperless_mobile/features/settings/bloc/application_settings_cubit.dart';
import 'package:paperless_mobile/features/settings/model/application_settings_state.dart';
@@ -57,7 +59,13 @@ void main() async {
// Load application settings and stored authentication data
await getIt<ConnectivityCubit>().initialize();
await getIt<ApplicationSettingsCubit>().initialize();
await getIt<AuthenticationCubit>().initialize();
final authCubit = AuthenticationCubit(
getIt<LocalVault>(),
getIt<LocalAuthenticationService>(),
getIt<PaperlessAuthenticationApi>(),
);
await authCubit.restoreSessionState();
// Create repositories
final LabelRepository<Tag> tagRepository =
@@ -80,13 +88,17 @@ void main() async {
RepositoryProvider.value(value: storagePathRepository),
RepositoryProvider.value(value: savedViewRepository),
],
child: const PaperlessMobileEntrypoint(),
child: PaperlessMobileEntrypoint(authenticationCubit: authCubit),
),
);
}
class PaperlessMobileEntrypoint extends StatefulWidget {
const PaperlessMobileEntrypoint({Key? key}) : super(key: key);
final AuthenticationCubit authenticationCubit;
const PaperlessMobileEntrypoint({
Key? key,
required this.authenticationCubit,
}) : super(key: key);
@override
State<PaperlessMobileEntrypoint> createState() =>
@@ -165,8 +177,8 @@ class _PaperlessMobileEntrypointState extends State<PaperlessMobileEntrypoint> {
GlobalWidgetsLocalizations.delegate,
FormBuilderLocalizations.delegate,
],
home: BlocProvider<AuthenticationCubit>.value(
value: getIt<AuthenticationCubit>(),
home: BlocProvider.value(
value: widget.authenticationCubit,
child: const AuthenticationWrapper(),
),
);
@@ -291,10 +303,10 @@ class _AuthenticationWrapperState extends State<AuthenticationWrapper> {
if (authentication.isAuthenticated) {
return const HomePage();
} else {
// if (authentication.wasLoginStored &&
// !(authentication.wasLocalAuthenticationSuccessful ?? false)) {
// return const BiometricAuthenticationPage();
// }
if (authentication.wasLoginStored &&
!(authentication.wasLocalAuthenticationSuccessful ?? false)) {
return const BiometricAuthenticationPage();
}
return const LoginPage();
}
},