mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 16:07:58 -06:00
feat: Externalize settings into LocalUserAppState, fix bugs
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/bloc/paperless_server_information_state.dart';
|
||||
|
||||
class PaperlessServerInformationCubit
|
||||
extends Cubit<PaperlessServerInformationState> {
|
||||
final PaperlessServerStatsApi _api;
|
||||
|
||||
PaperlessServerInformationCubit(this._api)
|
||||
: super(PaperlessServerInformationState());
|
||||
|
||||
Future<void> updateInformtion() async {
|
||||
final information = await _api.getServerInformation();
|
||||
emit(PaperlessServerInformationState(
|
||||
isLoaded: true,
|
||||
information: information,
|
||||
));
|
||||
}
|
||||
}
|
||||
17
lib/core/bloc/server_information_cubit.dart
Normal file
17
lib/core/bloc/server_information_cubit.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/bloc/server_information_state.dart';
|
||||
|
||||
class ServerInformationCubit extends Cubit<ServerInformationState> {
|
||||
final PaperlessServerStatsApi _api;
|
||||
|
||||
ServerInformationCubit(this._api) : super(ServerInformationState());
|
||||
|
||||
Future<void> updateInformation() async {
|
||||
final information = await _api.getServerInformation();
|
||||
emit(ServerInformationState(
|
||||
isLoaded: true,
|
||||
information: information,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
|
||||
class PaperlessServerInformationState {
|
||||
class ServerInformationState {
|
||||
final bool isLoaded;
|
||||
final PaperlessServerInformationModel? information;
|
||||
|
||||
PaperlessServerInformationState({
|
||||
ServerInformationState({
|
||||
this.isLoaded = false,
|
||||
this.information,
|
||||
});
|
||||
Reference in New Issue
Block a user