Externalized API and models as own package

This commit is contained in:
Anton Stubenbord
2022-12-02 01:48:13 +01:00
parent 60d1a2e62a
commit ec7707e4a4
143 changed files with 1496 additions and 1339 deletions

View File

@@ -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,
));
}
}

View 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,
});
}