mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 16:07:57 -06:00
feat: Externalize settings into LocalUserAppState, fix bugs
This commit is contained in:
@@ -2,35 +2,37 @@ import 'package:hive_flutter/adapters.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/config/hive/custom_adapters/theme_mode_adapter.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/global_settings.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/user_app_state.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_app_state.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/user_credentials.dart';
|
||||
import 'package:paperless_mobile/features/login/model/authentication_information.dart';
|
||||
import 'package:paperless_mobile/features/login/model/client_certificate.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/user_account.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
|
||||
import 'package:paperless_mobile/features/settings/model/color_scheme_option.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/user_settings.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_settings.dart';
|
||||
import 'package:paperless_mobile/features/settings/model/view_type.dart';
|
||||
|
||||
class HiveBoxes {
|
||||
HiveBoxes._();
|
||||
static const globalSettings = 'globalSettings';
|
||||
static const authentication = 'authentication';
|
||||
static const userCredentials = 'userCredentials';
|
||||
static const userAccount = 'userAccount';
|
||||
static const userAppState = 'userAppState';
|
||||
static const userSettings = 'userSettings';
|
||||
static const localUserCredentials = 'localUserCredentials';
|
||||
static const localUserAccount = 'localUserAccount';
|
||||
static const localUserAppState = 'localUserAppState';
|
||||
static const localUserSettings = 'localUserSettings';
|
||||
}
|
||||
|
||||
class HiveTypeIds {
|
||||
HiveTypeIds._();
|
||||
static const globalSettings = 0;
|
||||
static const userSettings = 1;
|
||||
static const localUserSettings = 1;
|
||||
static const themeMode = 2;
|
||||
static const colorSchemeOption = 3;
|
||||
static const authentication = 4;
|
||||
static const clientCertificate = 5;
|
||||
static const userCredentials = 6;
|
||||
static const userAccount = 7;
|
||||
static const userAppState = 8;
|
||||
static const localUserCredentials = 6;
|
||||
static const localUserAccount = 7;
|
||||
static const localUserAppState = 8;
|
||||
static const viewType = 9;
|
||||
}
|
||||
|
||||
void registerHiveAdapters() {
|
||||
@@ -40,10 +42,11 @@ void registerHiveAdapters() {
|
||||
Hive.registerAdapter(GlobalSettingsAdapter());
|
||||
Hive.registerAdapter(AuthenticationInformationAdapter());
|
||||
Hive.registerAdapter(ClientCertificateAdapter());
|
||||
Hive.registerAdapter(UserSettingsAdapter());
|
||||
Hive.registerAdapter(LocalUserSettingsAdapter());
|
||||
Hive.registerAdapter(UserCredentialsAdapter());
|
||||
Hive.registerAdapter(UserAccountAdapter());
|
||||
Hive.registerAdapter(UserAppStateAdapter());
|
||||
Hive.registerAdapter(LocalUserAccountAdapter());
|
||||
Hive.registerAdapter(LocalUserAppStateAdapter());
|
||||
Hive.registerAdapter(ViewTypeAdapter());
|
||||
}
|
||||
|
||||
extension HiveSingleValueBox<T> on Box<T> {
|
||||
|
||||
Reference in New Issue
Block a user