mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 12:07:58 -06:00
Externalized API and models as own package
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:paperless_mobile/core/model/paperless_server_information.dart';
|
||||
import 'package:paperless_mobile/core/service/paperless_server_information_service.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/bloc/paperless_server_information_state.dart';
|
||||
|
||||
@singleton
|
||||
class PaperlessServerInformationCubit
|
||||
extends Cubit<PaperlessServerInformation> {
|
||||
final PaperlessServerInformationService service;
|
||||
extends Cubit<PaperlessServerInformationState> {
|
||||
final PaperlessServerStatsApi service;
|
||||
|
||||
PaperlessServerInformationCubit(this.service)
|
||||
: super(PaperlessServerInformation());
|
||||
: super(PaperlessServerInformationState());
|
||||
|
||||
Future<void> updateInformtion() async {
|
||||
emit(await service.getInformation());
|
||||
final information = await service.getServerInformation();
|
||||
emit(PaperlessServerInformationState(
|
||||
isLoaded: true,
|
||||
information: information,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
11
lib/core/bloc/paperless_server_information_state.dart
Normal file
11
lib/core/bloc/paperless_server_information_state.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
|
||||
class PaperlessServerInformationState {
|
||||
final bool isLoaded;
|
||||
final PaperlessServerInformationModel? information;
|
||||
|
||||
PaperlessServerInformationState({
|
||||
this.isLoaded = false,
|
||||
this.information,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user