Merge branch 'main' into feature/iOSBuildFixes

This commit is contained in:
Anton Stubenbord
2023-02-11 13:20:19 +01:00
committed by GitHub
80 changed files with 451 additions and 669 deletions

View File

@@ -35,13 +35,11 @@ import 'package:paperless_mobile/core/service/file_service.dart';
import 'package:paperless_mobile/features/app_intro/application_intro_slideshow.dart';
import 'package:paperless_mobile/features/home/view/home_page.dart';
import 'package:paperless_mobile/features/home/view/widget/verify_identity_page.dart';
import 'package:paperless_mobile/features/login/bloc/authentication_cubit.dart';
import 'package:paperless_mobile/features/login/bloc/authentication_state.dart';
import 'package:paperless_mobile/features/login/cubit/authentication_cubit.dart';
import 'package:paperless_mobile/features/login/services/authentication_service.dart';
import 'package:paperless_mobile/features/login/view/login_page.dart';
import 'package:paperless_mobile/features/notifications/services/local_notification_service.dart';
import 'package:paperless_mobile/features/settings/bloc/application_settings_cubit.dart';
import 'package:paperless_mobile/features/settings/bloc/application_settings_state.dart';
import 'package:paperless_mobile/features/settings/cubit/application_settings_cubit.dart';
import 'package:paperless_mobile/features/sharing/share_intent_queue.dart';
import 'package:paperless_mobile/features/tasks/cubit/task_status_cubit.dart';
import 'package:paperless_mobile/generated/l10n.dart';
@@ -142,14 +140,6 @@ void main() async {
appSettingsCubit.stream.listen((event) => languageHeaderInterceptor
.preferredLocaleSubtag = event.preferredLocaleSubtag);
if (Platform.isAndroid) {
// Temporary Fix: Can be removed if the flutter engine implements the fix itself
// Activate the highest availabe refresh rate on the device
await FlutterDisplayMode.setHighRefreshRate();
}
runApp(
MultiProvider(
providers: [
@@ -288,15 +278,37 @@ class _AuthenticationWrapperState extends State<AuthenticationWrapper> {
@override
void initState() {
super.initState();
// Temporary Fix: Can be removed if the flutter engine implements the fix itself
// Activate the highest supported refresh rate on the device
if (Platform.isAndroid) {
_setOptimalDisplayMode();
}
initializeDateFormatting();
// For sharing files coming from outside the app while the app is still opened
ReceiveSharingIntent.getMediaStream()
.listen(ShareIntentQueue.instance.addAll);
// For sharing files coming from outside the app while the app is closed
// TODO: This does not work currently, app does not have permission to access the shared file
ReceiveSharingIntent.getInitialMedia()
.then(ShareIntentQueue.instance.addAll);
}
Future<void> _setOptimalDisplayMode() async {
final List<DisplayMode> supported = await FlutterDisplayMode.supported;
final DisplayMode active = await FlutterDisplayMode.active;
final List<DisplayMode> sameResolution = supported
.where((m) => m.width == active.width && m.height == active.height)
.toList()
..sort((a, b) => b.refreshRate.compareTo(a.refreshRate));
final DisplayMode mostOptimalMode =
sameResolution.isNotEmpty ? sameResolution.first : active;
debugPrint('Setting refresh rate to ${mostOptimalMode.refreshRate}');
await FlutterDisplayMode.setPreferredMode(mostOptimalMode);
}
@override
Widget build(BuildContext context) {
return BlocConsumer<AuthenticationCubit, AuthenticationState>(