mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 10:07:51 -06:00
fix: Improve receiving shares
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:open_filex/open_filex.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
|
||||
import 'package:paperless_mobile/core/notifier/document_changed_notifier.dart';
|
||||
import 'package:paperless_mobile/core/repository/label_repository.dart';
|
||||
import 'package:paperless_mobile/core/service/file_description.dart';
|
||||
@@ -120,6 +121,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
|
||||
Future<void> downloadDocument({
|
||||
bool downloadOriginal = false,
|
||||
required String locale,
|
||||
required String userId,
|
||||
}) async {
|
||||
if (state.metaData == null) {
|
||||
await loadMetaData();
|
||||
@@ -141,6 +143,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
|
||||
filePath: filePath,
|
||||
finished: true,
|
||||
locale: locale,
|
||||
userId: userId,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -150,6 +153,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
|
||||
filePath: filePath,
|
||||
finished: false,
|
||||
locale: locale,
|
||||
userId: userId,
|
||||
);
|
||||
|
||||
await _api.downloadToFile(
|
||||
@@ -163,6 +167,7 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
|
||||
filePath: filePath,
|
||||
finished: true,
|
||||
locale: locale,
|
||||
userId: userId,
|
||||
);
|
||||
debugPrint("Downloaded file to $filePath");
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/config/hive/hive_config.dart';
|
||||
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
|
||||
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
|
||||
import 'package:paperless_mobile/features/document_details/cubit/document_details_cubit.dart';
|
||||
import 'package:paperless_mobile/features/document_details/view/dialogs/select_file_type_dialog.dart';
|
||||
@@ -90,9 +91,11 @@ class _DocumentDownloadButtonState extends State<DocumentDownloadButton> {
|
||||
}
|
||||
|
||||
setState(() => _isDownloadPending = true);
|
||||
final userId = context.read<LocalUserAccount>().id;
|
||||
await context.read<DocumentDetailsCubit>().downloadDocument(
|
||||
downloadOriginal: original,
|
||||
locale: globalSettings.preferredLocaleSubtag,
|
||||
userId: userId,
|
||||
);
|
||||
// showSnackBar(context, S.of(context)!.documentSuccessfullyDownloaded);
|
||||
} on PaperlessApiException catch (error, stackTrace) {
|
||||
|
||||
Reference in New Issue
Block a user