mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-14 16:12:20 -06:00
Removed suggestions from inbox, added translations, added paging to inbox, visual updates, changed default matching algorithm to auto
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/service/file_service.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
part 'document_details_state.dart';
|
||||
|
||||
@@ -41,6 +47,23 @@ class DocumentDetailsCubit extends Cubit<DocumentDetailsState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> openDocumentInSystemViewer() async {
|
||||
final downloadDir = await FileService.temporaryDirectory;
|
||||
final metaData = await _api.getMetaData(state.document);
|
||||
final docBytes = await _api.download(state.document);
|
||||
File f = File('${downloadDir.path}/${metaData.mediaFilename}');
|
||||
f.writeAsBytes(docBytes);
|
||||
final url = Uri(
|
||||
scheme: "file",
|
||||
path: f.path,
|
||||
);
|
||||
log(url.toString());
|
||||
if (await canLaunchUrl(url)) {
|
||||
return launchUrl(url);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void replaceDocument(DocumentModel document) {
|
||||
emit(state.copyWith(document: document));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user