Implemented error reporting solution

This commit is contained in:
Anton Stubenbord
2022-11-14 00:08:07 +01:00
parent b5aac36b2b
commit 511f8ca3f4
33 changed files with 475 additions and 110 deletions

View File

@@ -1,22 +1,22 @@
import 'dart:developer';
import 'dart:io';
import 'package:encrypted_shared_preferences/encrypted_shared_preferences.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart';
import 'package:intl/intl_standalone.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:paperless_mobile/core/bloc/connectivity_cubit.dart';
import 'package:paperless_mobile/core/bloc/label_bloc_provider.dart';
import 'package:paperless_mobile/core/bloc/paperless_server_information_cubit.dart';
import 'package:paperless_mobile/core/global/asset_images.dart';
import 'package:paperless_mobile/core/global/constants.dart';
import 'package:paperless_mobile/core/global/http_self_signed_certificate_override.dart';
import 'package:paperless_mobile/core/logic/error_code_localization_mapper.dart';
import 'package:paperless_mobile/core/model/error_message.dart';
import 'package:paperless_mobile/core/service/file_service.dart';
import 'package:paperless_mobile/core/util.dart';
import 'package:paperless_mobile/di_initializer.dart';
import 'package:paperless_mobile/features/app_intro/application_intro_slideshow.dart';
import 'package:paperless_mobile/features/documents/bloc/documents_cubit.dart';
@@ -28,11 +28,6 @@ import 'package:paperless_mobile/features/settings/bloc/application_settings_cub
import 'package:paperless_mobile/features/settings/model/application_settings_state.dart';
import 'package:paperless_mobile/generated/l10n.dart';
import 'package:paperless_mobile/util.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:intl/intl.dart';
import 'package:intl/intl_standalone.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
void main() async {
@@ -46,29 +41,14 @@ void main() async {
configureDependencies();
// Remove temporarily downloaded files.
(await FileService.temporaryDirectory).deleteSync(recursive: true);
if (kDebugMode) {
_printDeviceInformation();
}
kPackageInfo = await PackageInfo.fromPlatform();
// Load application settings and stored authentication data
getIt<ConnectivityCubit>().initialize();
await getIt<ApplicationSettingsCubit>().initialize();
await getIt<AuthenticationCubit>().initialize();
// Ogaylesgo
runApp(const MyApp());
}
void _printDeviceInformation() async {
final tempPath = await FileService.temporaryDirectory;
log('[DEVICE INFO] Temporary ${tempPath.absolute}');
final docsPath = await FileService.documentsDirectory;
log('[DEVICE INFO] Documents ${docsPath?.absolute}');
final downloadPath = await FileService.downloadsDirectory;
log('[DEVICE INFO] Download ${downloadPath?.absolute}');
final scanPath = await FileService.scanDirectory;
log('[DEVICE INFO] Scan ${scanPath?.absolute}');
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@@ -83,6 +63,7 @@ class _MyAppState extends State<MyApp> {
providers: [
BlocProvider.value(value: getIt<ConnectivityCubit>()),
BlocProvider.value(value: getIt<AuthenticationCubit>()),
BlocProvider.value(value: getIt<PaperlessServerInformationCubit>()),
],
child: BlocBuilder<ApplicationSettingsCubit, ApplicationSettingsState>(
bloc: getIt<ApplicationSettingsCubit>(),
@@ -186,7 +167,6 @@ class _AuthenticationWrapperState extends State<AuthenticationWrapper> {
super.initState();
// For sharing files coming from outside the app while the app is still opened
ReceiveSharingIntent.getMediaStream().listen(handleReceivedFiles);
// For sharing files coming from outside the app while the app is closed
ReceiveSharingIntent.getInitialMedia().then(handleReceivedFiles);
}