Removed suggestions from inbox, added translations, added paging to inbox, visual updates, changed default matching algorithm to auto

This commit is contained in:
Anton Stubenbord
2023-01-20 00:34:18 +01:00
parent bfbf0a6f0e
commit f9dfddf704
56 changed files with 1748 additions and 766 deletions

View File

@@ -26,6 +26,18 @@ class ConnectivityCubit extends Cubit<ConnectivityState> {
}
}
void reload() async {
if (_sub == null) {
initialize();
} else {
final bool isConnected =
await connectivityStatusService.isConnectedToInternet();
emit(isConnected
? ConnectivityState.connected
: ConnectivityState.notConnected);
}
}
@override
Future<void> close() {
_sub?.cancel();

View File

@@ -8,8 +8,8 @@ class SavedViewRepositoryImpl extends SavedViewRepository {
SavedViewRepositoryImpl(this._api) : super(const SavedViewRepositoryState());
@override
Future<SavedView> create(SavedView view) async {
final created = await _api.save(view);
Future<SavedView> create(SavedView object) async {
final created = await _api.save(object);
final updatedState = {...state.values}
..putIfAbsent(created.id!, () => created);
emit(SavedViewRepositoryState(values: updatedState, hasLoaded: true));

View File

@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:paperless_api/paperless_api.dart';
import 'package:paperless_mobile/generated/l10n.dart';
String translateMatchingAlgorithm(
BuildContext context, MatchingAlgorithm algorithm) {
switch (algorithm) {
case MatchingAlgorithm.anyWord:
return S.of(context).matchingAlgorithmAnyDescription;
case MatchingAlgorithm.allWords:
return S.of(context).matchingAlgorithmAllDescription;
case MatchingAlgorithm.exactMatch:
return S.of(context).matchingAlgorithmExactDescription;
case MatchingAlgorithm.regex:
return S.of(context).matchingAlgorithmRegexDescription;
case MatchingAlgorithm.fuzzy:
return S.of(context).matchingAlgorithmFuzzyDescription;
case MatchingAlgorithm.auto:
return S.of(context).matchingAlgorithmAutoDescription;
}
}