Skip to content

Commit

Permalink
Merge branch 'feature/go_router_migration' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
astubenbord committed Oct 5, 2023
2 parents e3e7ac4 + a2c5ced commit c9177de
Show file tree
Hide file tree
Showing 213 changed files with 10,305 additions and 6,599 deletions.
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<application android:label="Paperless Mobile"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:requestLegacyExternalStorage="true">
android:requestLegacyExternalStorage="true"
>
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
1 change: 1 addition & 0 deletions assets/images/github-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
project_id: "568557"
files: [
{
"source" : "/lib/l10n/intl_en.arb",
Expand Down
73 changes: 39 additions & 34 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PODS:
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- edge_detection (1.1.1):
- edge_detection (1.1.2):
- Flutter
- WeScan
- file_picker (0.0.1):
Expand All @@ -48,14 +48,16 @@ PODS:
- Flutter
- flutter_native_splash (0.0.1):
- Flutter
- flutter_pdfview (1.0.2):
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- in_app_review (0.2.0):
- Flutter
- integration_test (0.0.1):
- Flutter
- local_auth_ios (0.0.1):
Expand All @@ -67,9 +69,9 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- pdfx (1.0.0):
- permission_handler_apple (9.1.1):
- Flutter
- permission_handler_apple (9.0.4):
- printing (1.0.0):
- Flutter
- ReachabilitySwift (5.0.0)
- receive_sharing_intent (0.0.1):
Expand All @@ -79,16 +81,15 @@ PODS:
- SDWebImage/Core (5.13.5)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- SwiftyGif (5.4.3)
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter
- WeScan (1.7.0)

DEPENDENCIES:
Expand All @@ -100,20 +101,21 @@ DEPENDENCIES:
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
- flutter_pdfview (from `.symlinks/plugins/flutter_pdfview/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- in_app_review (from `.symlinks/plugins/in_app_review/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
- open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- pdfx (from `.symlinks/plugins/pdfx/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- printing (from `.symlinks/plugins/printing/ios`)
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -143,10 +145,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
flutter_native_splash:
:path: ".symlinks/plugins/flutter_native_splash/ios"
flutter_pdfview:
:path: ".symlinks/plugins/flutter_pdfview/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios"
in_app_review:
:path: ".symlinks/plugins/in_app_review/ios"
integration_test:
:path: ".symlinks/plugins/integration_test/ios"
local_auth_ios:
Expand All @@ -156,54 +160,55 @@ EXTERNAL SOURCES:
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
pdfx:
:path: ".symlinks/plugins/pdfx/ios"
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
printing:
:path: ".symlinks/plugins/printing/ios"
receive_sharing_intent:
:path: ".symlinks/plugins/receive_sharing_intent/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
edge_detection: fa02aa120e00d87ada0ca2430b6c6087a501b1e9
edge_detection: b4fb239b018cefa79515a024d0bf3e559336de4e
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
flutter_pdfview: 25f53dd6097661e6395b17de506e6060585946bd
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
local_auth_ios: 0d333dde7780f669e66f19d2ff6005f3ea84008d
integration_test: 13825b8a9334a850581300559b8839134b124670
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
pdfx: 7b876b09de8b7a0bf444a4f82b439ffcff4ee1ec
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
printing: 233e1b73bd1f4a05615548e9b5a324c98588640b
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
SDWebImage: 23d714cd599354ee7906dbae26dff89b421c4370
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
url_launcher_ios: fb12c43172927bb5cf75aeebd073f883801f1993
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
WeScan: fed582f6c38014d529afb5aa9ffd1bad38fc72b7

PODFILE CHECKSUM: 7daa35cc908d9fba025075df27cb57a1ba1ebf13

COCOAPODS: 1.11.3
COCOAPODS: 1.12.0
8 changes: 0 additions & 8 deletions lib/core/bloc/document_status_cubit.dart

This file was deleted.

2 changes: 0 additions & 2 deletions lib/core/config/hive/hive_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ import 'package:paperless_mobile/features/settings/model/view_type.dart';
class HiveBoxes {
HiveBoxes._();
static const globalSettings = 'globalSettings';
static const authentication = 'authentication';
static const localUserCredentials = 'localUserCredentials';
static const localUserAccount = 'localUserAccount';
static const localUserAppState = 'localUserAppState';
static const localUserSettings = 'localUserSettings';
static const hosts = 'hosts';
}

Expand Down
25 changes: 23 additions & 2 deletions lib/core/config/hive/hive_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import 'dart:typed_data';

import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:paperless_mobile/core/config/hive/hive_config.dart';
import 'package:paperless_mobile/core/database/tables/global_settings.dart';
import 'package:paperless_mobile/core/database/tables/local_user_account.dart';
import 'package:paperless_mobile/core/database/tables/local_user_app_state.dart';

///
/// Opens an encrypted box, calls [callback] with the now opened box, awaits
/// [callback] to return and returns the calculated value. Closes the box after.
///
Future<R?> withEncryptedBox<T, R>(
String name, FutureOr<R?> Function(Box<T> box) callback) async {
String name,
FutureOr<R?> Function(Box<T> box) callback,
) async {
final key = await _getEncryptedBoxKey();
final box = await Hive.openBox<T>(
name,
Expand All @@ -22,7 +28,11 @@ Future<R?> withEncryptedBox<T, R>(
}

Future<Uint8List> _getEncryptedBoxKey() async {
const secureStorage = FlutterSecureStorage();
const secureStorage = FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
),
);
if (!await secureStorage.containsKey(key: 'key')) {
final key = Hive.generateSecureKey();

Expand All @@ -34,3 +44,14 @@ Future<Uint8List> _getEncryptedBoxKey() async {
final key = (await secureStorage.read(key: 'key'))!;
return base64Decode(key);
}

extension HiveBoxAccessors on HiveInterface {
Box<GlobalSettings> get settingsBox =>
box<GlobalSettings>(HiveBoxes.globalSettings);
Box<LocalUserAccount> get localUserAccountBox =>
box<LocalUserAccount>(HiveBoxes.localUserAccount);
Box<LocalUserAppState> get localUserAppStateBox =>
box<LocalUserAppState>(HiveBoxes.localUserAppState);
Box<GlobalSettings> get globalSettingsBox =>
box<GlobalSettings>(HiveBoxes.globalSettings);
}
8 changes: 6 additions & 2 deletions lib/core/database/tables/global_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GlobalSettings with HiveObjectMixin {
bool showOnboarding;

@HiveField(4)
String? currentLoggedInUser;
String? loggedInUserId;

@HiveField(5)
FileDownloadType defaultDownloadType;
Expand All @@ -32,14 +32,18 @@ class GlobalSettings with HiveObjectMixin {
@HiveField(7, defaultValue: false)
bool enforceSinglePagePdfUpload;

@HiveField(8, defaultValue: false)
bool skipDocumentPreprarationOnUpload;

GlobalSettings({
required this.preferredLocaleSubtag,
this.preferredThemeMode = ThemeMode.system,
this.preferredColorSchemeOption = ColorSchemeOption.classic,
this.showOnboarding = true,
this.currentLoggedInUser,
this.loggedInUserId,
this.defaultDownloadType = FileDownloadType.alwaysAsk,
this.defaultShareType = FileDownloadType.alwaysAsk,
this.enforceSinglePagePdfUpload = false,
this.skipDocumentPreprarationOnUpload = false,
});
}
13 changes: 6 additions & 7 deletions lib/core/database/tables/local_user_account.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:hive_flutter/adapters.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/global_settings.dart';
import 'package:paperless_mobile/core/database/tables/local_user_settings.dart';
import 'package:paperless_api/paperless_api.dart';

part 'local_user_account.g.dart';

Expand All @@ -20,16 +19,16 @@ class LocalUserAccount extends HiveObject {
@HiveField(7)
UserModel paperlessUser;

@HiveField(8, defaultValue: 2)
int apiVersion;

LocalUserAccount({
required this.id,
required this.serverUrl,
required this.settings,
required this.paperlessUser,
required this.apiVersion,
});

static LocalUserAccount get current =>
Hive.box<LocalUserAccount>(HiveBoxes.localUserAccount).get(
Hive.box<GlobalSettings>(HiveBoxes.globalSettings)
.getValue()!
.currentLoggedInUser)!;
bool get hasMultiUserSupport => apiVersion >= 3;
}
2 changes: 1 addition & 1 deletion lib/core/database/tables/local_user_app_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LocalUserAppState extends HiveObject {
final currentLocalUserId =
Hive.box<GlobalSettings>(HiveBoxes.globalSettings)
.getValue()!
.currentLoggedInUser!;
.loggedInUserId!;
return Hive.box<LocalUserAppState>(HiveBoxes.localUserAppState)
.get(currentLocalUserId)!;
}
Expand Down
9 changes: 8 additions & 1 deletion lib/core/global/constants.dart
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
const supportedFileExtensions = ['pdf', 'png', 'tiff', 'gif', 'jpg', 'jpeg'];
const supportedFileExtensions = [
'.pdf',
'.png',
'.tiff',
'.gif',
'.jpg',
'.jpeg'
];
2 changes: 0 additions & 2 deletions lib/core/interceptor/dio_http_error_interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class DioHttpErrorInterceptor extends Interceptor {
),
);
}
} else {
return handler.next(err);
}
}
}
12 changes: 12 additions & 0 deletions lib/core/model/info_message_exception.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:paperless_api/paperless_api.dart';

class InfoMessageException implements Exception {
final ErrorCode code;
final String? message;
final StackTrace? stackTrace;
InfoMessageException({
required this.code,
this.message,
this.stackTrace,
});
}
Loading

0 comments on commit c9177de

Please sign in to comment.