Fixed visual bugs, added notifications on document upload success, enabled editing in inbox, added hints

This commit is contained in:
Anton Stubenbord
2023-01-11 18:28:42 +01:00
parent a4c4726c16
commit 4d7af3fffb
34 changed files with 1046 additions and 627 deletions

View File

@@ -0,0 +1,8 @@
enum OsErrorCodes {
serverUnreachable(101),
hostNotFound(7),
invalidClientCertConfig(318767212);
const OsErrorCodes(this.code);
final int code;
}

View File

@@ -11,23 +11,24 @@ class DioHttpErrorInterceptor extends Interceptor {
// try to parse contained error message, otherwise return response
final dynamic data = err.response?.data;
if (data is Map<String, dynamic>) {
_handlePaperlessValidationError(data, handler, err);
return _handlePaperlessValidationError(data, handler, err);
} else if (data is String) {
_handlePlainError(data, handler, err);
return _handlePlainError(data, handler, err);
}
} else if (err.error is SocketException) {
// Offline
handler.reject(
final ex = err.error as SocketException;
if (ex.osError?.errorCode == _OsErrorCodes.serverUnreachable.code) {
return handler.reject(
DioError(
error: const PaperlessServerException(ErrorCode.deviceOffline),
requestOptions: err.requestOptions,
type: DioErrorType.connectTimeout,
),
);
} else {
handler.reject(err);
}
}
return handler.reject(err);
}
void _handlePaperlessValidationError(
Map<String, dynamic> json,
@@ -73,3 +74,11 @@ class DioHttpErrorInterceptor extends Interceptor {
}
}
}
enum _OsErrorCodes {
serverUnreachable(101),
hostNotFound(7);
const _OsErrorCodes(this.code);
final int code;
}

View File

@@ -0,0 +1,60 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:paperless_mobile/core/global/os_error_codes.dart';
import 'package:paperless_mobile/features/login/model/reachability_status.dart';
class ServerReachabilityErrorInterceptor extends Interceptor {
static const _missingClientCertText = "No required SSL certificate was sent";
@override
void onError(DioError err, ErrorInterceptorHandler handler) {
if (err.response?.statusCode == 400) {
final message = err.response?.data;
if (message is String && message.contains(_missingClientCertText)) {
return _rejectWithStatus(
ReachabilityStatus.missingClientCertificate,
err,
handler,
);
}
}
if (err.type == DioErrorType.connectTimeout) {
return _rejectWithStatus(
ReachabilityStatus.connectionTimeout,
err,
handler,
);
}
final error = err.error;
if (error is SocketException) {
final code = error.osError?.errorCode;
if (code == OsErrorCodes.serverUnreachable.code ||
code == OsErrorCodes.hostNotFound.code) {
return _rejectWithStatus(
ReachabilityStatus.unknownHost,
err,
handler,
);
}
}
return _rejectWithStatus(
ReachabilityStatus.notReachable,
err,
handler,
);
}
}
void _rejectWithStatus(
ReachabilityStatus reachabilityStatus,
DioError err,
ErrorInterceptorHandler handler,
) {
handler.reject(DioError(
error: reachabilityStatus,
requestOptions: err.requestOptions,
response: err.response,
type: DioErrorType.other,
));
}

View File

@@ -26,7 +26,6 @@ class SessionManager {
(client) => client..badCertificateCallback = (cert, host, port) => true;
dio.interceptors.addAll([
...interceptors,
DioHttpErrorInterceptor(),
PrettyDioLogger(
compact: true,
responseBody: false,

View File

@@ -1,8 +1,12 @@
import 'dart:developer';
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:dio/adapter.dart';
import 'package:dio/dio.dart';
import 'package:paperless_mobile/core/global/os_error_codes.dart';
import 'package:paperless_mobile/core/interceptor/server_reachability_error_interceptor.dart';
import 'package:paperless_mobile/core/security/session_manager.dart';
import 'package:paperless_mobile/features/login/model/client_certificate.dart';
import 'package:paperless_mobile/features/login/model/reachability_status.dart';
@@ -63,51 +67,30 @@ class ConnectivityStatusServiceImpl implements ConnectivityStatusService {
if (!RegExp(r"^https?://.*").hasMatch(serverAddress)) {
return ReachabilityStatus.unknown;
}
late SecurityContext context = SecurityContext();
try {
if (clientCertificate != null) {
context
..usePrivateKeyBytes(
clientCertificate.bytes,
password: clientCertificate.passphrase,
)
..useCertificateChainBytes(
clientCertificate.bytes,
password: clientCertificate.passphrase,
)
..setTrustedCertificatesBytes(
clientCertificate.bytes,
password: clientCertificate.passphrase,
);
}
SessionManager manager =
SessionManager([ServerReachabilityErrorInterceptor()])
..updateSettings(clientCertificate: clientCertificate)
..client.options.connectTimeout = 5000
..client.options.receiveTimeout = 5000;
final adapter = DefaultHttpClientAdapter()
..onHttpClientCreate = (client) => HttpClient(context: context)
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
final Dio dio = Dio()..httpClientAdapter = adapter;
final response = await dio.get('$serverAddress/api/');
final response = await manager.client.get('$serverAddress/api/');
if (response.statusCode == 200) {
return ReachabilityStatus.reachable;
}
return ReachabilityStatus.notReachable;
} on DioError catch (error) {
if (error.error is String) {
if (error.response?.data is String) {
if ((error.response!.data as String)
.contains("No required SSL certificate was sent")) {
return ReachabilityStatus.missingClientCertificate;
if (error.type == DioErrorType.other &&
error.error is ReachabilityStatus) {
return error.error as ReachabilityStatus;
}
}
}
return ReachabilityStatus.notReachable;
} on TlsException catch (error) {
if (error.osError?.errorCode == 318767212) {
//INCORRECT_PASSWORD for certificate
final code = error.osError?.errorCode;
if (code == OsErrorCodes.invalidClientCertConfig.code) {
// Missing client cert passphrase
return ReachabilityStatus.invalidClientCertificateConfiguration;
}
}
return ReachabilityStatus.notReachable;
}
}
}

View File

@@ -1,6 +1,7 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
import 'package:shimmer/shimmer.dart';
class DocumentsListLoadingWidget extends StatelessWidget {
@@ -19,34 +20,25 @@ class DocumentsListLoadingWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
return ListView(
children: <Widget>[
Expanded(
child: Shimmer.fromColors(
...above,
...List.generate(25, (idx) {
final r = Random(idx);
final tagCount = r.nextInt(tags.length + 1);
final correspondentLength =
correspondentLengths[r.nextInt(correspondentLengths.length - 1)];
final titleLength = titleLengths[r.nextInt(titleLengths.length - 1)];
return Shimmer.fromColors(
baseColor: Theme.of(context).brightness == Brightness.light
? Colors.grey[300]!
: Colors.grey[900]!,
highlightColor: Theme.of(context).brightness == Brightness.light
? Colors.grey[100]!
: Colors.grey[600]!,
child: Column(
children: [
...above,
Expanded(
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
final r = Random(index);
final tagCount = r.nextInt(tags.length + 1);
final correspondentLength = correspondentLengths[
r.nextInt(correspondentLengths.length - 1)];
final titleLength =
titleLengths[r.nextInt(titleLengths.length - 1)];
return ListTile(
child: ListTile(
contentPadding: const EdgeInsets.all(8),
dense: true,
isThreeLine: true,
leading: ClipRRect(
borderRadius: BorderRadius.circular(8),
@@ -69,8 +61,7 @@ class DocumentsListLoadingWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
padding:
const EdgeInsets.symmetric(vertical: 2.0),
padding: const EdgeInsets.symmetric(vertical: 2.0),
height: fontSize,
width: titleLength,
color: Colors.white,
@@ -83,22 +74,15 @@ class DocumentsListLoadingWidget extends StatelessWidget {
label: Text(tags[r.nextInt(tags.length)]),
),
),
),
).paddedOnly(top: 4),
],
),
),
),
);
},
itemCount: 25,
),
),
}).toList(),
...below,
],
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
import 'package:paperless_mobile/generated/l10n.dart';
class HintCard extends StatelessWidget {
final String hintText;
final double elevation;
final VoidCallback onHintAcknowledged;
final bool show;
const HintCard({
super.key,
required this.hintText,
required this.onHintAcknowledged,
this.elevation = 1,
required this.show,
});
@override
Widget build(BuildContext context) {
return AnimatedCrossFade(
sizeCurve: Curves.elasticOut,
crossFadeState:
show ? CrossFadeState.showFirst : CrossFadeState.showSecond,
secondChild: const SizedBox.shrink(),
duration: const Duration(milliseconds: 500),
firstChild: Card(
elevation: elevation,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.tips_and_updates_outlined,
color: Theme.of(context).hintColor,
).padded(),
Align(
alignment: Alignment.center,
child: Text(
hintText,
softWrap: true,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall,
),
),
Align(
alignment: Alignment.bottomRight,
child: TextButton(
child: Text(S.of(context).genericAcknowledgeLabel),
onPressed: onHintAcknowledged,
),
),
],
).padded(),
).padded(),
);
}
}

View File

@@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/bloc/connectivity_cubit.dart';
import 'package:paperless_mobile/core/widgets/highlighted_text.dart';
import 'package:paperless_mobile/core/widgets/hint_card.dart';
import 'package:paperless_mobile/core/widgets/offline_widget.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
import 'package:paperless_mobile/features/document_details/bloc/document_details_cubit.dart';
@@ -77,7 +78,7 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
color: Colors.white,
),
),
badgeColor: Theme.of(context).colorScheme.error,
badgeColor: Colors.red,
//TODO: Wait for stable version of m3, then use AlignmentDirectional.topEnd
);
},
@@ -190,18 +191,16 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
children: [
_buildDocumentOverview(
state.document,
widget.titleAndContentQueryString,
),
_buildDocumentContentView(
state.document,
widget.titleAndContentQueryString,
state,
),
_buildDocumentMetaDataView(
state.document,
),
].padded(),
);
],
).paddedSymmetrically(horizontal: 8);
},
),
),
@@ -216,7 +215,9 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
Navigator.push<bool>(
context,
MaterialPageRoute(
builder: (context) => BlocProvider.value(
builder: (_) => MultiBlocProvider(
providers: [
BlocProvider.value(
value: EditDocumentCubit(
document,
documentsApi: context.read(),
@@ -225,14 +226,23 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
storagePathRepository: context.read(),
tagRepository: context.read(),
),
),
BlocProvider<DocumentDetailsCubit>.value(
value: cubit,
),
],
child: BlocListener<EditDocumentCubit, EditDocumentState>(
listenWhen: (previous, current) =>
previous.document != current.document,
listener: (context, state) {
cubit.replaceDocument(state.document);
},
child: DocumentEditPage(
suggestions: cubit.state.suggestions,
child: BlocBuilder<DocumentDetailsCubit, DocumentDetailsState>(
builder: (context, state) {
return DocumentEditPage(
suggestions: state.suggestions,
);
},
),
),
),
@@ -273,8 +283,9 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
.documentArchiveSerialNumberPropertyLongLabel,
content: document.archiveSerialNumber != null
? Text(document.archiveSerialNumber.toString())
: OutlinedButton(
child: Text(S
: TextButton.icon(
icon: const Icon(Icons.archive),
label: Text(S
.of(context)
.documentDetailsPageAssignAsnButtonLabel),
onPressed: widget.allowEdit
@@ -321,38 +332,46 @@ class _DocumentDetailsPageState extends State<DocumentDetailsPage> {
Widget _buildDocumentContentView(
DocumentModel document,
String? match,
DocumentDetailsState state,
) {
return ListView(
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
HighlightedText(
text: (state.isFullContentLoaded
? state.fullContent
: document.content) ??
"",
highlights: match == null ? [] : match.split(" "),
highlights: widget.titleAndContentQueryString != null
? widget.titleAndContentQueryString!.split(" ")
: [],
style: Theme.of(context).textTheme.bodyMedium,
caseSensitive: false,
),
if (!state.isFullContentLoaded && (document.content ?? '').isNotEmpty)
TextButton(
child: Text("Show full content ..."),
Align(
alignment: Alignment.bottomCenter,
child: TextButton(
child:
Text(S.of(context).documentDetailsPageLoadFullContentLabel),
onPressed: () {
context.read<DocumentDetailsCubit>().loadFullContent();
},
),
),
],
).paddedOnly(top: 8);
).padded(8).paddedOnly(top: 14),
);
}
Widget _buildDocumentOverview(DocumentModel document, String? match) {
Widget _buildDocumentOverview(DocumentModel document) {
return ListView(
children: [
_DetailsItem(
content: HighlightedText(
text: document.title,
highlights: match?.split(" ") ?? <String>[],
highlights: widget.titleAndContentQueryString?.split(" ") ?? [],
style: Theme.of(context).textTheme.bodyLarge,
),
label: S.of(context).documentTitlePropertyLabel,

View File

@@ -54,7 +54,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
floatingActionButton: FloatingActionButton.extended(
onPressed: () => _onSubmit(state.document),
icon: const Icon(Icons.save),
label: Text(S.of(context).genericActionSaveLabel),
label: Text(S.of(context).genericActionUpdateLabel),
),
appBar: AppBar(
title: Text(S.of(context).documentEditPageTitle),
@@ -75,7 +75,8 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
),
child: FormBuilder(
key: _formKey,
child: ListView(children: [
child: ListView(
children: [
_buildTitleFormField(state.document.title).padded(),
_buildCreatedAtFormField(state.document.created).padded(),
_buildDocumentTypeFormField(
@@ -98,8 +99,32 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
excludeAllowed: false,
name: fkTags,
selectableOptions: state.tags,
suggestions: widget.suggestions.hasSuggestedTags
? _buildSuggestionsSkeleton<int>(
suggestions: widget.suggestions.storagePaths,
itemBuilder: (context, itemData) => ActionChip(
label: Text(state.tags[itemData]!.name),
onPressed: () {
final currentTags = _formKey.currentState
?.fields[fkTags] as TagsQuery;
if (currentTags is IdsTagsQuery) {
_formKey.currentState?.fields[fkTags]
?.didChange((IdsTagsQuery.fromIds(
[...currentTags.ids, itemData])));
} else {
_formKey.currentState?.fields[fkTags]
?.didChange(
(IdsTagsQuery.fromIds([itemData])));
}
},
),
)
: null,
).padded(),
]),
const SizedBox(
height: 64), // Prevent tags from being hidden by fab
],
),
),
));
},
@@ -267,7 +292,7 @@ class _DocumentEditPageState extends State<DocumentEditPage> {
_buildSuggestionsSkeleton<DateTime>(
suggestions: widget.suggestions.dates,
itemBuilder: (context, itemData) => ActionChip(
label: Text(DateFormat.yMd().format(itemData)),
label: Text(DateFormat.yMMMd().format(itemData)),
onPressed: () => _formKey.currentState?.fields[fkCreatedDate]
?.didChange(itemData),
),

View File

@@ -14,6 +14,7 @@ import 'package:paperless_mobile/features/documents/view/widgets/documents_empty
import 'package:paperless_mobile/features/documents/view/widgets/list/adaptive_documents_view.dart';
import 'package:paperless_mobile/features/documents/view/widgets/new_items_loading_widget.dart';
import 'package:paperless_mobile/features/documents/view/widgets/search/document_filter_panel.dart';
import 'package:paperless_mobile/features/documents/view/widgets/selection/bulk_delete_confirmation_dialog.dart';
import 'package:paperless_mobile/features/documents/view/widgets/sort_documents_button.dart';
import 'package:paperless_mobile/features/home/view/widget/info_drawer.dart';
import 'package:paperless_mobile/features/labels/bloc/providers/labels_bloc_provider.dart';
@@ -95,7 +96,26 @@ class _DocumentsPageState extends State<DocumentsPage> {
@override
Widget build(BuildContext context) {
return BlocConsumer<ConnectivityCubit, ConnectivityState>(
return BlocListener<TaskStatusCubit, TaskStatusState>(
listenWhen: (previous, current) =>
!previous.isSuccess && current.isSuccess,
listener: (context, state) {
showSnackBar(
context,
S.of(context).documentsPageNewDocumentAvailableText,
action: SnackBarActionConfig(
label: S
.of(context)
.documentUploadProcessingSuccessfulReloadActionText,
onPressed: () {
context.read<TaskStatusCubit>().acknowledgeCurrentTask();
context.read<DocumentsCubit>().reload();
},
),
duration: const Duration(seconds: 10),
);
},
child: BlocConsumer<ConnectivityCubit, ConnectivityState>(
listenWhen: (previous, current) =>
previous != ConnectivityState.connected &&
current == ConnectivityState.connected,
@@ -121,6 +141,7 @@ class _DocumentsPageState extends State<DocumentsPage> {
),
child: BlocBuilder<DocumentsCubit, DocumentsState>(
builder: (context, state) {
if (state.selection.isEmpty) {
return AppBar(
title: Text(
"${S.of(context).documentsPageTitle} (${_formatDocumentCount(state.count)})",
@@ -150,13 +171,30 @@ class _DocumentsPageState extends State<DocumentsPage> {
),
],
bottom: PreferredSize(
preferredSize:
const Size.fromHeight(linearProgressIndicatorHeight),
preferredSize: const Size.fromHeight(
linearProgressIndicatorHeight),
child: state.isLoading
? const LinearProgressIndicator()
: const SizedBox(height: 4.0),
),
);
} else {
return AppBar(
leading: IconButton(
icon: const Icon(Icons.close),
onPressed: () =>
context.read<DocumentsCubit>().resetSelection(),
),
title: Text(
'${state.selection.length} ${S.of(context).documentsSelectedText}'),
actions: [
IconButton(
icon: const Icon(Icons.delete),
onPressed: () => _onDelete(context, state),
),
],
);
}
},
),
),
@@ -173,7 +211,7 @@ class _DocumentsPageState extends State<DocumentsPage> {
),
),
animationType: b.BadgeAnimationType.fade,
badgeColor: Theme.of(context).colorScheme.error,
badgeColor: Colors.red,
child: FloatingActionButton(
child: const Icon(Icons.filter_alt_outlined),
onPressed: _openDocumentFilter,
@@ -215,10 +253,6 @@ class _DocumentsPageState extends State<DocumentsPage> {
},
),
),
if (taskState.task != null &&
taskState.isSuccess &&
!taskState.task!.acknowledged)
_buildNewDocumentAvailableButton(context),
],
);
},
@@ -227,24 +261,31 @@ class _DocumentsPageState extends State<DocumentsPage> {
),
);
},
),
);
}
Align _buildNewDocumentAvailableButton(BuildContext context) {
return Align(
alignment: Alignment.bottomLeft,
child: FilledButton(
style: ButtonStyle(
backgroundColor:
MaterialStatePropertyAll(Theme.of(context).colorScheme.error),
),
child: Text("New document available!"),
onPressed: () {
context.read<TaskStatusCubit>().acknowledgeCurrentTask();
context.read<DocumentsCubit>().reload();
},
).paddedOnly(bottom: 24, left: 24),
void _onDelete(BuildContext context, DocumentsState documentsState) async {
final shouldDelete = await showDialog<bool>(
context: context,
builder: (context) =>
BulkDeleteConfirmationDialog(state: documentsState),
) ??
false;
if (shouldDelete) {
try {
await context
.read<DocumentsCubit>()
.bulkRemove(documentsState.selection);
showSnackBar(
context,
S.of(context).documentsPageBulkDeleteSuccessfulText,
);
context.read<DocumentsCubit>().resetSelection();
} on PaperlessServerException catch (error, stackTrace) {
showErrorMessage(context, error, stackTrace);
}
}
}
void _openDocumentFilter() async {

View File

@@ -42,6 +42,7 @@ class AdaptiveDocumentsView extends StatelessWidget {
Widget build(BuildContext context) {
return CustomScrollView(
controller: scrollController,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
SliverToBoxAdapter(child: beforeItems),
if (viewType == ViewType.list) _buildListView() else _buildGridView(),

View File

@@ -38,7 +38,6 @@ class DocumentListItem extends StatelessWidget {
Widget build(BuildContext context) {
return SizedBox(
child: ListTile(
trailing: Text("${document.id}"),
dense: true,
selected: isSelected,
onTap: () => _onTap(),

View File

@@ -65,7 +65,7 @@ class EditLabelForm<T extends Label> extends StatelessWidget {
initialValue: label,
fromJsonT: fromJsonT,
submitButtonConfig: SubmitButtonConfig<T>(
icon: const Icon(Icons.done),
icon: const Icon(Icons.save),
label: Text(S.of(context).genericActionUpdateLabel),
onSubmit: context.read<EditLabelCubit<T>>().update,
),

View File

@@ -20,10 +20,8 @@ import 'package:paperless_mobile/features/settings/bloc/application_settings_cub
import 'package:paperless_mobile/features/settings/view/settings_page.dart';
import 'package:paperless_mobile/generated/l10n.dart';
import 'package:paperless_mobile/util.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/link.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:collection/collection.dart';
class InfoDrawer extends StatefulWidget {
final VoidCallback? afterInboxClosed;
@@ -115,11 +113,17 @@ class _InfoDrawerState extends State<InfoDrawer> {
),
child: Drawer(
shape: const RoundedRectangleBorder(
borderRadius: const BorderRadius.only(
borderRadius: BorderRadius.only(
topRight: Radius.circular(16.0),
bottomRight: Radius.circular(16.0),
),
),
child: Theme(
data: Theme.of(context).copyWith(
listTileTheme: ListTileThemeData(
tileColor: Colors.transparent,
),
),
child: ListView(
children: [
DrawerHeader(
@@ -139,8 +143,9 @@ class _InfoDrawerState extends State<InfoDrawer> {
'assets/logos/paperless_logo_white.png',
height: 32,
width: 32,
color:
Theme.of(context).colorScheme.onPrimaryContainer,
color: Theme.of(context)
.colorScheme
.onPrimaryContainer,
).paddedOnly(right: 8.0),
Text(
S.of(context).appTitleText,
@@ -171,9 +176,12 @@ class _InfoDrawerState extends State<InfoDrawer> {
contentPadding: EdgeInsets.zero,
dense: true,
title: Text(
S.of(context).appDrawerHeaderLoggedInAsText +
S
.of(context)
.appDrawerHeaderLoggedInAsText +
(info.username ?? '?'),
style: Theme.of(context).textTheme.bodyMedium,
style:
Theme.of(context).textTheme.bodyMedium,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
maxLines: 1,
@@ -192,8 +200,9 @@ class _InfoDrawerState extends State<InfoDrawer> {
),
Text(
'${S.of(context).serverInformationPaperlessVersionText} ${info.version} (API v${info.apiVersion})',
style:
Theme.of(context).textTheme.bodySmall,
style: Theme.of(context)
.textTheme
.bodySmall,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
maxLines: 1,
@@ -235,6 +244,10 @@ class _InfoDrawerState extends State<InfoDrawer> {
),
),
),
const Divider(
indent: 16,
endIndent: 16,
),
ListTile(
leading: const Icon(Icons.bug_report),
title: Text(S.of(context).appDrawerReportBugLabel),
@@ -263,6 +276,7 @@ class _InfoDrawerState extends State<InfoDrawer> {
),
),
),
),
);
}
@@ -295,11 +309,10 @@ class _InfoDrawerState extends State<InfoDrawer> {
create: (context) => InboxCubit(
context.read<LabelRepository<Tag, TagRepositoryState>>(),
context.read<PaperlessDocumentsApi>(),
)..loadInbox(),
)..initializeInbox(),
child: const InboxPage(),
),
),
maintainState: false,
),
);
widget.afterInboxClosed?.call();

View File

@@ -1,10 +1,11 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/repository/label_repository.dart';
import 'package:paperless_mobile/core/repository/state/impl/tag_repository_state.dart';
import 'package:paperless_mobile/features/inbox/bloc/state/inbox_state.dart';
class InboxCubit extends Cubit<InboxState> {
class InboxCubit extends HydratedCubit<InboxState> {
final LabelRepository<Tag, TagRepositoryState> _tagsRepository;
final PaperlessDocumentsApi _documentsApi;
@@ -14,17 +15,20 @@ class InboxCubit extends Cubit<InboxState> {
///
/// Fetches inbox tag ids and loads the inbox items (documents).
///
Future<void> loadInbox() async {
Future<void> initializeInbox() async {
if (state.isLoaded) return;
final inboxTags = await _tagsRepository.findAll().then(
(tags) => tags.where((t) => t.isInboxTag ?? false).map((t) => t.id!),
);
if (inboxTags.isEmpty) {
// no inbox tags = no inbox items.
return emit(const InboxState(
return emit(
state.copyWith(
isLoaded: true,
inboxItems: [],
inboxTags: [],
));
),
);
}
final inboxDocuments = await _documentsApi
.findAll(DocumentFilter(
@@ -32,7 +36,7 @@ class InboxCubit extends Cubit<InboxState> {
sortField: SortField.added,
))
.then((psr) => psr.results);
final newState = InboxState(
final newState = state.copyWith(
isLoaded: true,
inboxItems: inboxDocuments,
inboxTags: inboxTags,
@@ -57,9 +61,8 @@ class InboxCubit extends Cubit<InboxState> {
),
);
emit(
InboxState(
state.copyWith(
isLoaded: true,
inboxTags: state.inboxTags,
inboxItems: state.inboxItems.where((doc) => doc.id != document.id),
),
);
@@ -79,14 +82,11 @@ class InboxCubit extends Cubit<InboxState> {
overwriteTags: true,
);
await _documentsApi.update(updatedDoc);
emit(
InboxState(
emit(state.copyWith(
isLoaded: true,
inboxItems: [...state.inboxItems, updatedDoc]
..sort((d1, d2) => d2.added.compareTo(d1.added)),
inboxTags: state.inboxTags,
),
);
));
}
///
@@ -99,12 +99,40 @@ class InboxCubit extends Cubit<InboxState> {
state.inboxTags,
),
);
emit(
InboxState(
emit(state.copyWith(
isLoaded: true,
inboxTags: state.inboxTags,
inboxItems: [],
),
));
}
void replaceUpdatedDocument(DocumentModel document) {
if (document.tags.any((id) => state.inboxTags.contains(id))) {
// If replaced document still has inbox tag assigned:
emit(state.copyWith(
inboxItems:
state.inboxItems.map((e) => e.id == document.id ? document : e),
));
} else {
// Remove tag from inbox.
emit(
state.copyWith(
inboxItems:
state.inboxItems.where((element) => element.id != document.id)),
);
}
}
void acknowledgeHint() {
emit(state.copyWith(isHintAcknowledged: true));
}
@override
InboxState fromJson(Map<String, dynamic> json) {
return InboxState.fromJson(json);
}
@override
Map<String, dynamic> toJson(InboxState state) {
return state.toJson();
}
}

View File

@@ -1,17 +1,54 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:json_annotation/json_annotation.dart';
part 'inbox_state.g.dart';
@JsonSerializable()
class InboxState with EquatableMixin {
@JsonKey(ignore: true)
final bool isLoaded;
@JsonKey(ignore: true)
final Iterable<int> inboxTags;
@JsonKey(ignore: true)
final Iterable<DocumentModel> inboxItems;
final bool isHintAcknowledged;
const InboxState({
this.isLoaded = false,
this.inboxTags = const [],
this.inboxItems = const [],
this.isHintAcknowledged = false,
});
@override
List<Object?> get props => [isLoaded, inboxTags, inboxItems];
List<Object?> get props => [
isLoaded,
inboxTags,
inboxItems,
isHintAcknowledged,
];
InboxState copyWith({
bool? isLoaded,
Iterable<int>? inboxTags,
Iterable<DocumentModel>? inboxItems,
bool? isHintAcknowledged,
}) {
return InboxState(
isLoaded: isLoaded ?? this.isLoaded,
inboxItems: inboxItems ?? this.inboxItems,
inboxTags: inboxTags ?? this.inboxTags,
isHintAcknowledged: isHintAcknowledged ?? this.isHintAcknowledged,
);
}
factory InboxState.fromJson(Map<String, dynamic> json) =>
_$InboxStateFromJson(json);
Map<String, dynamic> toJson() => _$InboxStateToJson(this);
}

View File

@@ -0,0 +1,16 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'inbox_state.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
InboxState _$InboxStateFromJson(Map<String, dynamic> json) => InboxState(
isHintAcknowledged: json['isHintAcknowledged'] as bool? ?? false,
);
Map<String, dynamic> _$InboxStateToJson(InboxState instance) =>
<String, dynamic>{
'isHintAcknowledged': instance.isHintAcknowledged,
};

View File

@@ -5,6 +5,7 @@ import 'package:intl/date_symbol_data_local.dart';
import 'package:intl/intl.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/widgets/documents_list_loading_widget.dart';
import 'package:paperless_mobile/core/widgets/hint_card.dart';
import 'package:paperless_mobile/extensions/dart_extensions.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
import 'package:paperless_mobile/features/inbox/bloc/inbox_cubit.dart';
@@ -113,7 +114,6 @@ class _InboxPageState extends State<InboxPage> {
delegate: SliverChildBuilderDelegate(
childCount: entry.value.length,
(context, index) => _buildListItem(
context,
entry.value[index],
),
),
@@ -124,7 +124,7 @@ class _InboxPageState extends State<InboxPage> {
.toList();
return RefreshIndicator(
onRefresh: () => context.read<InboxCubit>().loadInbox(),
onRefresh: () => context.read<InboxCubit>().initializeInbox(),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -132,11 +132,12 @@ class _InboxPageState extends State<InboxPage> {
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: Text(
S.of(context).inboxPageUsageHintText,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall,
).padded(),
child: HintCard(
show: !state.isHintAcknowledged,
hintText: S.of(context).inboxPageUsageHintText,
onHintAcknowledged: () =>
context.read<InboxCubit>().acknowledgeHint(),
),
),
...slivers
],
@@ -150,7 +151,7 @@ class _InboxPageState extends State<InboxPage> {
);
}
Widget _buildListItem(BuildContext context, DocumentModel doc) {
Widget _buildListItem(DocumentModel doc) {
return Dismissible(
direction: DismissDirection.endToStart,
background: Row(
@@ -170,7 +171,12 @@ class _InboxPageState extends State<InboxPage> {
).padded(),
confirmDismiss: (_) => _onItemDismissed(doc),
key: UniqueKey(),
child: InboxItem(document: doc),
child: InboxItem(
document: doc,
onDocumentUpdated: (document) {
context.read<InboxCubit>().replaceUpdatedDocument(document);
},
),
);
}

View File

@@ -16,7 +16,7 @@ class InboxEmptyWidget extends StatelessWidget {
Widget build(BuildContext context) {
return RefreshIndicator(
key: _emptyStateRefreshIndicatorKey,
onRefresh: () => context.read<InboxCubit>().loadInbox(),
onRefresh: () => context.read<InboxCubit>().initializeInbox(),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.max,

View File

@@ -6,16 +6,18 @@ import 'package:paperless_mobile/core/repository/provider/label_repositories_pro
import 'package:paperless_mobile/features/document_details/bloc/document_details_cubit.dart';
import 'package:paperless_mobile/features/document_details/view/pages/document_details_page.dart';
import 'package:paperless_mobile/features/documents/view/widgets/document_preview.dart';
import 'package:paperless_mobile/features/inbox/bloc/inbox_cubit.dart';
import 'package:paperless_mobile/features/labels/tags/view/widgets/tags_widget.dart';
class InboxItem extends StatelessWidget {
static const _a4AspectRatio = 1 / 1.4142;
final void Function(DocumentModel model) onDocumentUpdated;
final DocumentModel document;
const InboxItem({
super.key,
required this.document,
required this.onDocumentUpdated,
});
@override
@@ -45,7 +47,8 @@ class InboxItem extends StatelessWidget {
),
],
),
onTap: () => Navigator.push(
onTap: () async {
final returnedDocument = await Navigator.push<DocumentModel?>(
context,
MaterialPageRoute(
builder: (context) => BlocProvider(
@@ -55,13 +58,16 @@ class InboxItem extends StatelessWidget {
),
child: const LabelRepositoriesProvider(
child: DocumentDetailsPage(
allowEdit: false,
isLabelClickable: false,
),
),
),
),
),
);
if (returnedDocument != null) {
onDocumentUpdated(returnedDocument);
}
},
);
}
}

View File

@@ -63,7 +63,8 @@ class _StoragePathAutofillFormBuilderFieldState
),
Wrap(
alignment: WrapAlignment.start,
spacing: 8.0,
spacing: 4.0,
runSpacing: 4.0,
children: [
InputChip(
label: Text(

View File

@@ -1,3 +1,5 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
@@ -5,6 +7,7 @@ import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/repository/label_repository.dart';
import 'package:paperless_mobile/core/repository/state/impl/tag_repository_state.dart';
import 'package:paperless_mobile/extensions/flutter_extensions.dart';
import 'package:paperless_mobile/features/edit_label/view/impl/add_tag_page.dart';
import 'package:paperless_mobile/generated/l10n.dart';
@@ -16,6 +19,7 @@ class TagFormField extends StatefulWidget {
final bool anyAssignedSelectable;
final bool excludeAllowed;
final Map<int, Tag> selectableOptions;
final Widget? suggestions;
const TagFormField({
super.key,
@@ -26,6 +30,7 @@ class TagFormField extends StatefulWidget {
this.anyAssignedSelectable = true,
this.excludeAllowed = true,
required this.selectableOptions,
this.suggestions,
});
@override
@@ -37,7 +42,7 @@ class _TagFormFieldState extends State<TagFormField> {
static const _anyAssignedId = -2;
late final TextEditingController _textEditingController;
bool _showCreationSuffixIcon = true;
bool _showCreationSuffixIcon = false;
bool _showClearSuffixIcon = false;
@override
@@ -46,14 +51,19 @@ class _TagFormFieldState extends State<TagFormField> {
_textEditingController = TextEditingController()
..addListener(() {
setState(() {
_showCreationSuffixIcon = widget.selectableOptions.values
.where(
(item) => item.name.toLowerCase().startsWith(
_showCreationSuffixIcon = widget.selectableOptions.values.where(
(item) {
log(item.name
.toLowerCase()
.startsWith(
_textEditingController.text.toLowerCase(),
),
)
.isEmpty ||
_textEditingController.text.isEmpty;
.toString());
return item.name.toLowerCase().startsWith(
_textEditingController.text.toLowerCase(),
);
},
).isEmpty;
});
setState(
() => _showClearSuffixIcon = _textEditingController.text.isNotEmpty,
@@ -124,23 +134,33 @@ class _TagFormFieldState extends State<TagFormField> {
getImmediateSuggestions: true,
animationStart: 1,
itemBuilder: (context, data) {
if (data == _onlyNotAssignedId) {
return ListTile(
title: Text(S.of(context).labelNotAssignedText),
);
} else if (data == _anyAssignedId) {
return ListTile(
title: Text(S.of(context).labelAnyAssignedText),
);
late String? title;
switch (data) {
case _onlyNotAssignedId:
title = S.of(context).labelNotAssignedText;
break;
case _anyAssignedId:
title = S.of(context).labelAnyAssignedText;
break;
default:
title = widget.selectableOptions[data]?.name;
}
final tag = widget.selectableOptions[data]!;
final tag = widget.selectableOptions[data];
return ListTile(
leading: Icon(
Icons.circle,
color: tag.color,
dense: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
style: ListTileStyle.list,
leading: data != _onlyNotAssignedId && data != _anyAssignedId
? Icon(
Icons.circle,
color: tag?.color,
)
: null,
title: Text(
tag.name,
title ?? '',
style: TextStyle(
color: Theme.of(context).colorScheme.onBackground),
),
@@ -165,10 +185,11 @@ class _TagFormFieldState extends State<TagFormField> {
direction: AxisDirection.up,
),
if (field.value is OnlyNotAssignedTagsQuery) ...[
_buildNotAssignedTag(field)
_buildNotAssignedTag(field).padded()
] else if (field.value is AnyAssignedTagsQuery) ...[
_buildAnyAssignedTag(field)
_buildAnyAssignedTag(field).padded()
] else ...[
if (widget.suggestions != null) widget.suggestions!,
// field.value is IdsTagsQuery
Wrap(
alignment: WrapAlignment.start,
@@ -183,7 +204,7 @@ class _TagFormFieldState extends State<TagFormField> {
),
)
.toList(),
),
).padded(),
]
],
);
@@ -266,6 +287,7 @@ class _TagFormFieldState extends State<TagFormField> {
tag.name,
style: TextStyle(
color: tag.textColor,
decorationColor: tag.textColor,
decoration: !isIncludedTag ? TextDecoration.lineThrough : null,
decorationThickness: 2.0,
),

View File

@@ -25,9 +25,6 @@ class _LinkedDocumentsPageState extends State<LinkedDocumentsPage> {
),
body: BlocBuilder<LinkedDocumentsCubit, LinkedDocumentsState>(
builder: (context, state) {
if (!state.isLoaded) {
return const DocumentsListLoadingWidget();
}
return Column(
children: [
Text(
@@ -35,8 +32,12 @@ class _LinkedDocumentsPageState extends State<LinkedDocumentsPage> {
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall,
),
if (!state.isLoaded)
Expanded(child: const DocumentsListLoadingWidget())
else
Expanded(
child: ListView.builder(
itemCount: state.documents?.results.length,
itemBuilder: (context, index) {
return DocumentListItem(
isLabelClickable: false,

View File

@@ -5,4 +5,5 @@ enum ReachabilityStatus {
unknownHost,
missingClientCertificate,
invalidClientCertificateConfiguration,
connectionTimeout;
}

View File

@@ -17,6 +17,20 @@ class ServerAddressFormField extends StatefulWidget {
}
class _ServerAddressFormFieldState extends State<ServerAddressFormField> {
bool _canClear = false;
@override
void initState() {
super.initState();
_textEditingController.addListener(() {
if (_textEditingController.text.isNotEmpty) {
setState(() {
_canClear = true;
});
}
});
}
final TextEditingController _textEditingController = TextEditingController();
@override
@@ -25,12 +39,30 @@ class _ServerAddressFormFieldState extends State<ServerAddressFormField> {
key: const ValueKey('login-server-address'),
controller: _textEditingController,
name: ServerAddressFormField.fkServerAddress,
validator: FormBuilderValidators.required(
errorText: S.of(context).loginPageServerUrlValidatorMessageRequiredText,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(
errorText:
S.of(context).loginPageServerUrlValidatorMessageRequiredText,
),
FormBuilderValidators.match(
r"https?://.*",
errorText:
S.of(context).loginPageServerUrlValidatorMessageMissingSchemeText,
)
]),
decoration: InputDecoration(
hintText: "http://192.168.1.50:8000",
labelText: S.of(context).loginPageServerUrlFieldLabel,
suffixIcon: _canClear
? IconButton(
icon: Icon(Icons.clear),
color: Theme.of(context).iconTheme.color,
onPressed: () {
_textEditingController.clear();
},
)
: null,
),
onSubmitted: (value) {
if (value == null) return;

View File

@@ -24,20 +24,29 @@ class ServerConnectionPage extends StatefulWidget {
}
class _ServerConnectionPageState extends State<ServerConnectionPage> {
bool _isCheckingConnection = false;
ReachabilityStatus _reachabilityStatus = ReachabilityStatus.unknown;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
toolbarHeight: kToolbarHeight - 4,
title: Text(S.of(context).loginPageTitle),
bottom: PreferredSize(
child: _isCheckingConnection
? const LinearProgressIndicator()
: const SizedBox(height: 4.0),
preferredSize: const Size.fromHeight(4.0),
),
),
resizeToAvoidBottomInset: true,
body: Column(
body: SingleChildScrollView(
child: Column(
children: [
ServerAddressFormField(
onDone: (address) {
_updateReachability();
_updateReachability(address);
},
).padded(),
ClientCertificateFormField(
@@ -46,6 +55,7 @@ class _ServerConnectionPageState extends State<ServerConnectionPage> {
_buildStatusIndicator(),
],
).padded(),
),
bottomNavigationBar: BottomAppBar(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
@@ -62,20 +72,30 @@ class _ServerConnectionPageState extends State<ServerConnectionPage> {
);
}
Future<void> _updateReachability() async {
Future<void> _updateReachability([String? address]) async {
setState(() {
_isCheckingConnection = true;
});
final status = await context
.read<ConnectivityStatusService>()
.isPaperlessServerReachable(
address ??
widget.formBuilderKey.currentState!
.getRawValue(ServerAddressFormField.fkServerAddress),
widget.formBuilderKey.currentState?.getRawValue(
ClientCertificateFormField.fkClientCertificate,
),
);
setState(() => _reachabilityStatus = status);
setState(() {
_isCheckingConnection = false;
_reachabilityStatus = status;
});
}
Widget _buildStatusIndicator() {
if (_isCheckingConnection) {
return const ListTile();
}
Color errorColor = Theme.of(context).colorScheme.error;
switch (_reachabilityStatus) {
case ReachabilityStatus.unknown:
@@ -112,6 +132,12 @@ class _ServerConnectionPageState extends State<ServerConnectionPage> {
.loginPageReachabilityInvalidClientCertificateConfigurationText,
errorColor,
);
case ReachabilityStatus.connectionTimeout:
return _buildIconText(
Icons.close,
S.of(context).loginPageReachabilityConnectionTimeoutText,
errorColor,
);
}
}

View File

@@ -91,15 +91,16 @@ class LocalNotificationService {
progress: progress,
actions: status == TaskStatus.success
? [
AndroidNotificationAction(
NotificationResponseAction.openCreatedDocument.name,
"Open",
showsUserInterface: true,
),
AndroidNotificationAction(
NotificationResponseAction.acknowledgeCreatedDocument.name,
"Acknowledge",
),
//TODO: Implement once moved to new routing
// AndroidNotificationAction(
// NotificationResponseAction.openCreatedDocument.name,
// "Open",
// showsUserInterface: true,
// ),
// AndroidNotificationAction(
// NotificationResponseAction.acknowledgeCreatedDocument.name,
// "Acknowledge",
// ),
]
: [],
),

View File

@@ -17,6 +17,7 @@ import 'package:paperless_mobile/core/repository/state/impl/document_type_reposi
import 'package:paperless_mobile/core/repository/state/impl/tag_repository_state.dart';
import 'package:paperless_mobile/core/service/file_service.dart';
import 'package:paperless_mobile/core/store/local_vault.dart';
import 'package:paperless_mobile/core/widgets/hint_card.dart';
import 'package:paperless_mobile/core/widgets/offline_banner.dart';
import 'package:paperless_mobile/features/document_upload/cubit/document_upload_cubit.dart';
import 'package:paperless_mobile/features/document_upload/view/document_upload_preparation_page.dart';

View File

@@ -60,6 +60,8 @@
"@documentDeleteSuccessMessage": {},
"documentDetailsPageAssignAsnButtonLabel": "Přiřadit",
"@documentDetailsPageAssignAsnButtonLabel": {},
"documentDetailsPageLoadFullContentLabel": "",
"@documentDetailsPageLoadFullContentLabel": {},
"documentDetailsPageSimilarDocumentsLabel": "Podobné dokumenty",
"@documentDetailsPageSimilarDocumentsLabel": {},
"documentDetailsPageTabContentLabel": "Obsah",
@@ -154,6 +156,8 @@
"@documentsPageEmptyStateNothingHereText": {},
"documentsPageEmptyStateOopsText": "Ajaj.",
"@documentsPageEmptyStateOopsText": {},
"documentsPageNewDocumentAvailableText": "",
"@documentsPageNewDocumentAvailableText": {},
"documentsPageOrderByLabel": "Řadit dle",
"@documentsPageOrderByLabel": {},
"documentsPageSelectionBulkDeleteDialogContinueText": "Tuto akci nelze vrátit zpět. Opravdu chcete pokračovat?",
@@ -336,6 +340,8 @@
"count": {}
}
},
"genericAcknowledgeLabel": "",
"@genericAcknowledgeLabel": {},
"genericActionCancelLabel": "Zrušit",
"@genericActionCancelLabel": {},
"genericActionCreateLabel": "Vytvořit",
@@ -442,6 +448,8 @@
"@loginPagePasswordFieldLabel": {},
"loginPagePasswordValidatorMessageText": "Heslo nesmí být prázdné.",
"@loginPagePasswordValidatorMessageText": {},
"loginPageReachabilityConnectionTimeoutText": "",
"@loginPageReachabilityConnectionTimeoutText": {},
"loginPageReachabilityInvalidClientCertificateConfigurationText": "",
"@loginPageReachabilityInvalidClientCertificateConfigurationText": {},
"loginPageReachabilityMissingClientCertificateText": "",
@@ -456,6 +464,8 @@
"@loginPageServerUrlFieldLabel": {},
"loginPageServerUrlValidatorMessageInvalidAddressText": "",
"@loginPageServerUrlValidatorMessageInvalidAddressText": {},
"loginPageServerUrlValidatorMessageMissingSchemeText": "",
"@loginPageServerUrlValidatorMessageMissingSchemeText": {},
"loginPageServerUrlValidatorMessageRequiredText": "Adresa serveru nesmí být prázdná.",
"@loginPageServerUrlValidatorMessageRequiredText": {},
"loginPageSignInButtonLabel": "",

View File

@@ -60,6 +60,8 @@
"@documentDeleteSuccessMessage": {},
"documentDetailsPageAssignAsnButtonLabel": "Zuweisen",
"@documentDetailsPageAssignAsnButtonLabel": {},
"documentDetailsPageLoadFullContentLabel": "Lade gesamten Inhalt",
"@documentDetailsPageLoadFullContentLabel": {},
"documentDetailsPageSimilarDocumentsLabel": "Similar Documents",
"@documentDetailsPageSimilarDocumentsLabel": {},
"documentDetailsPageTabContentLabel": "Inhalt",
@@ -154,6 +156,8 @@
"@documentsPageEmptyStateNothingHereText": {},
"documentsPageEmptyStateOopsText": "Ups.",
"@documentsPageEmptyStateOopsText": {},
"documentsPageNewDocumentAvailableText": "Neues Dokument verfügbar!",
"@documentsPageNewDocumentAvailableText": {},
"documentsPageOrderByLabel": "Sortiere nach",
"@documentsPageOrderByLabel": {},
"documentsPageSelectionBulkDeleteDialogContinueText": "Diese Aktion ist unwiderruflich. Möchtest Du trotzdem fortfahren?",
@@ -336,6 +340,8 @@
"count": {}
}
},
"genericAcknowledgeLabel": "Verstanden!",
"@genericAcknowledgeLabel": {},
"genericActionCancelLabel": "Abbrechen",
"@genericActionCancelLabel": {},
"genericActionCreateLabel": "Erstellen",
@@ -372,7 +378,7 @@
"@inboxPageNoNewDocumentsText": {},
"inboxPageTodayText": "Heute",
"@inboxPageTodayText": {},
"inboxPageUndoRemoveText": "UNDO",
"inboxPageUndoRemoveText": "Undo",
"@inboxPageUndoRemoveText": {},
"inboxPageUnseenText": "ungesehen",
"@inboxPageUnseenText": {},
@@ -442,6 +448,8 @@
"@loginPagePasswordFieldLabel": {},
"loginPagePasswordValidatorMessageText": "Passwort darf nicht leer sein.",
"@loginPagePasswordValidatorMessageText": {},
"loginPageReachabilityConnectionTimeoutText": "Zeitüberschreitung der Verbindung.",
"@loginPageReachabilityConnectionTimeoutText": {},
"loginPageReachabilityInvalidClientCertificateConfigurationText": "Inkorrekte oder fehlende Zertifikatspassphrase.",
"@loginPageReachabilityInvalidClientCertificateConfigurationText": {},
"loginPageReachabilityMissingClientCertificateText": "Ein Client-Zertifikat wurde erwartet aber nicht gesendet. Bitte stelle ein Zertifikat zur Verfügung.",
@@ -450,12 +458,14 @@
"@loginPageReachabilityNotReachableText": {},
"loginPageReachabilitySuccessText": "Verbindung erfolgreich hergestellt.",
"@loginPageReachabilitySuccessText": {},
"loginPageReachabilityUnresolvedHostText": "Der Host konnte nicht aufgelöst werden. Bitte überprüfe die Server-Adresse.",
"loginPageReachabilityUnresolvedHostText": "Der Host konnte nicht aufgelöst werden. Bitte überprüfe die Server-Adresse und deine Internetverbindung.",
"@loginPageReachabilityUnresolvedHostText": {},
"loginPageServerUrlFieldLabel": "Server-Adresse",
"@loginPageServerUrlFieldLabel": {},
"loginPageServerUrlValidatorMessageInvalidAddressText": "Ungültige Adresse.",
"@loginPageServerUrlValidatorMessageInvalidAddressText": {},
"loginPageServerUrlValidatorMessageMissingSchemeText": "Server-Adresse muss ein Schema enthalten.",
"@loginPageServerUrlValidatorMessageMissingSchemeText": {},
"loginPageServerUrlValidatorMessageRequiredText": "Server-Addresse darf nicht leer sein.",
"@loginPageServerUrlValidatorMessageRequiredText": {},
"loginPageSignInButtonLabel": "Anmelden",

View File

@@ -60,6 +60,8 @@
"@documentDeleteSuccessMessage": {},
"documentDetailsPageAssignAsnButtonLabel": "Assign",
"@documentDetailsPageAssignAsnButtonLabel": {},
"documentDetailsPageLoadFullContentLabel": "Load full content",
"@documentDetailsPageLoadFullContentLabel": {},
"documentDetailsPageSimilarDocumentsLabel": "Similar Documents",
"@documentDetailsPageSimilarDocumentsLabel": {},
"documentDetailsPageTabContentLabel": "Content",
@@ -154,6 +156,8 @@
"@documentsPageEmptyStateNothingHereText": {},
"documentsPageEmptyStateOopsText": "Oops.",
"@documentsPageEmptyStateOopsText": {},
"documentsPageNewDocumentAvailableText": "New document available!",
"@documentsPageNewDocumentAvailableText": {},
"documentsPageOrderByLabel": "Order By",
"@documentsPageOrderByLabel": {},
"documentsPageSelectionBulkDeleteDialogContinueText": "This action is irreversible. Do you wish to proceed anyway?",
@@ -336,6 +340,8 @@
"count": {}
}
},
"genericAcknowledgeLabel": "Got it!",
"@genericAcknowledgeLabel": {},
"genericActionCancelLabel": "Cancel",
"@genericActionCancelLabel": {},
"genericActionCreateLabel": "Create",
@@ -372,7 +378,7 @@
"@inboxPageNoNewDocumentsText": {},
"inboxPageTodayText": "Today",
"@inboxPageTodayText": {},
"inboxPageUndoRemoveText": "UNDO",
"inboxPageUndoRemoveText": "Undo",
"@inboxPageUndoRemoveText": {},
"inboxPageUnseenText": "unseen",
"@inboxPageUnseenText": {},
@@ -442,6 +448,8 @@
"@loginPagePasswordFieldLabel": {},
"loginPagePasswordValidatorMessageText": "Password must not be empty.",
"@loginPagePasswordValidatorMessageText": {},
"loginPageReachabilityConnectionTimeoutText": "Connection timed out.",
"@loginPageReachabilityConnectionTimeoutText": {},
"loginPageReachabilityInvalidClientCertificateConfigurationText": "Incorrect or missing client certificate passphrase.",
"@loginPageReachabilityInvalidClientCertificateConfigurationText": {},
"loginPageReachabilityMissingClientCertificateText": "A client certificate was expected but not sent. Please provide a certificate.",
@@ -450,12 +458,14 @@
"@loginPageReachabilityNotReachableText": {},
"loginPageReachabilitySuccessText": "Connection successfully established.",
"@loginPageReachabilitySuccessText": {},
"loginPageReachabilityUnresolvedHostText": "Host could not be resolved. Please check the server address.",
"loginPageReachabilityUnresolvedHostText": "Host could not be resolved. Please check the server address and your internet connection. ",
"@loginPageReachabilityUnresolvedHostText": {},
"loginPageServerUrlFieldLabel": "Server Address",
"@loginPageServerUrlFieldLabel": {},
"loginPageServerUrlValidatorMessageInvalidAddressText": "Invalid address.",
"@loginPageServerUrlValidatorMessageInvalidAddressText": {},
"loginPageServerUrlValidatorMessageMissingSchemeText": "Server address must include a scheme.",
"@loginPageServerUrlValidatorMessageMissingSchemeText": {},
"loginPageServerUrlValidatorMessageRequiredText": "Server address must not be empty.",
"@loginPageServerUrlValidatorMessageRequiredText": {},
"loginPageSignInButtonLabel": "Sign In",

View File

@@ -14,6 +14,7 @@ import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/core/bloc/bloc_changes_observer.dart';
import 'package:paperless_mobile/core/bloc/connectivity_cubit.dart';
import 'package:paperless_mobile/core/bloc/paperless_server_information_cubit.dart';
import 'package:paperless_mobile/core/interceptor/dio_http_error_interceptor.dart';
import 'package:paperless_mobile/core/interceptor/language_header.interceptor.dart';
import 'package:paperless_mobile/core/repository/impl/correspondent_repository_impl.dart';
import 'package:paperless_mobile/core/repository/impl/document_type_repository_impl.dart';
@@ -76,7 +77,10 @@ void main() async {
appSettingsCubit.state.preferredLocaleSubtag,
);
// Manages security context, required for self signed client certificates
final sessionManager = SessionManager([languageHeaderInterceptor]);
final sessionManager = SessionManager([
DioHttpErrorInterceptor(),
languageHeaderInterceptor,
]);
// Initialize Paperless APIs
final authApi = PaperlessAuthenticationApiImpl(sessionManager.client);
@@ -219,6 +223,9 @@ class _PaperlessMobileEntrypointState extends State<PaperlessMobileEntrypoint> {
chipTheme: ChipThemeData(
backgroundColor: Colors.lightGreen[50],
),
listTileTheme: const ListTileThemeData(
tileColor: Colors.transparent,
),
);
final _darkTheme = ThemeData(
@@ -241,6 +248,9 @@ class _PaperlessMobileEntrypointState extends State<PaperlessMobileEntrypoint> {
chipTheme: ChipThemeData(
backgroundColor: Colors.green[900],
),
listTileTheme: const ListTileThemeData(
tileColor: Colors.transparent,
),
);
@override

View File

@@ -33,12 +33,14 @@ void showSnackBar(
String message, {
String? details,
SnackBarActionConfig? action,
Duration duration = const Duration(seconds: 5),
}) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
..showSnackBar(
SnackBar(
content: RichText(
content: (details != null)
? RichText(
maxLines: 5,
text: TextSpan(
text: message,
@@ -46,7 +48,6 @@ void showSnackBar(
color: Theme.of(context).colorScheme.onInverseSurface,
),
children: <TextSpan>[
if (details != null)
TextSpan(
text: "\n$details",
style: const TextStyle(
@@ -56,7 +57,8 @@ void showSnackBar(
),
],
),
),
)
: Text(message),
action: action != null
? SnackBarAction(
label: action.label,
@@ -64,7 +66,7 @@ void showSnackBar(
textColor: Theme.of(context).colorScheme.onInverseSurface,
)
: null,
duration: const Duration(seconds: 5),
duration: duration,
),
);
}

View File

@@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.1+12
version: 1.5.0+13
environment:
sdk: '>=3.0.0-35.0.dev <4.0.0'