diff --git a/lib/main.dart b/lib/main.dart index a27560e1..275d67cd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -45,6 +45,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:logging/logging.dart'; +import 'package:ox_coi/src/brandable/custom_theme.dart'; import 'package:ox_coi/src/error/error_bloc.dart'; import 'package:ox_coi/src/l10n/l10n.dart'; import 'package:ox_coi/src/lifecycle/lifecycle_bloc.dart'; @@ -59,7 +60,6 @@ import 'package:ox_coi/src/main/splash.dart'; import 'package:ox_coi/src/navigation/navigation.dart'; import 'package:ox_coi/src/push/push_bloc.dart'; import 'package:ox_coi/src/push/push_event_state.dart'; -import 'package:ox_coi/src/brandable/custom_theme.dart'; import 'package:ox_coi/src/widgets/view_switcher.dart'; void main() { @@ -191,5 +191,4 @@ class _OxCoiState extends State { _navigation.popUntilRoot(context); _mainBloc.add(AppLoaded()); } - } diff --git a/lib/src/l10n/l.dart b/lib/src/l10n/l.dart index 26f947e0..e439e1c9 100644 --- a/lib/src/l10n/l.dart +++ b/lib/src/l10n/l.dart @@ -340,6 +340,7 @@ class L { // Scan the QR code to add an verify user X (e.g. Scan this QR code to create a new contact or verify a contact with alice.) static final qrScanTextX = _translationKey("Scan this QR code to create a new contact or verify a contact with %s."); static final qrShow = _translationKey("Show QR"); + static final qrShowErrorX = _translationKey("Not possible to create qr code: %s"); static final qrCameraNotAllowed = _translationKey("Camera not ready"); static final qrCameraNotAllowedText = _translationKey("No camera permission granted."); static final qrNoValidCode = _translationKey("No valid QR code"); diff --git a/lib/src/log/log_manager.dart b/lib/src/log/log_manager.dart index 960200f9..80c7d8e5 100644 --- a/lib/src/log/log_manager.dart +++ b/lib/src/log/log_manager.dart @@ -76,7 +76,7 @@ class LogManager { get currentLogFile => _logFile; - void setup({@required bool logToFile, @required Level logLevel}) async { + Future setup({@required bool logToFile, @required Level logLevel}) async { BlocSupervisor.delegate = LogBlocDelegate(); if (logToFile) { _logFile = await _setupAndGetLogFile(); diff --git a/lib/src/notifications/local_notification_manager.dart b/lib/src/notifications/local_notification_manager.dart index 3f696f38..42daa1aa 100644 --- a/lib/src/notifications/local_notification_manager.dart +++ b/lib/src/notifications/local_notification_manager.dart @@ -137,6 +137,7 @@ class LocalNotificationManager { int senderId = await invite.getFromId(); if (!createdNotifications.contains(senderId)) { createdNotifications.add(senderId); + contactRepository.putIfAbsent(id: senderId); Contact contact = contactRepository.get(senderId); var contactName = await contact.getName(); var contactMail = await contact.getAddress(); diff --git a/lib/src/platform/system_information.dart b/lib/src/platform/system_information.dart index 32ef3545..85c3a50f 100644 --- a/lib/src/platform/system_information.dart +++ b/lib/src/platform/system_information.dart @@ -56,7 +56,7 @@ Future getDeviceName() async { Future getDeviceOsVersion() async { await getDeviceInfo(); return Platform.isIOS - ? "OS: ${iosInfo.utsname.sysname} - Release: ${iosInfo.utsname.release} - Version: ${iosInfo.utsname.version}" + ? "OS: ${iosInfo.systemName} - Version: ${iosInfo.systemVersion} - Kernel: ${iosInfo.utsname.version}" : "OS: ${androidInfo.version.baseOS} - Release: ${androidInfo.version.release} (${androidInfo.version.codename}) - SDK: ${androidInfo.version.sdkInt}"; } diff --git a/lib/src/qr/show_qr.dart b/lib/src/qr/show_qr.dart index 2e4b8d3a..92b7d38d 100644 --- a/lib/src/qr/show_qr.dart +++ b/lib/src/qr/show_qr.dart @@ -42,6 +42,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:logging/logging.dart'; import 'package:ox_coi/src/brandable/custom_theme.dart'; import 'package:ox_coi/src/extensions/string_ui.dart'; import 'package:ox_coi/src/l10n/l.dart'; @@ -65,10 +66,11 @@ class ShowQr extends StatefulWidget { } class _ShowQrState extends State { - UserBloc _userBloc = UserBloc(); - QrBloc _qrBloc = QrBloc(); + final _logger = Logger("show_qr"); + final UserBloc _userBloc = UserBloc(); + final QrBloc _qrBloc = QrBloc(); + final Navigation _navigation = Navigation(); String _qrText; - Navigation _navigation = Navigation(); @override void initState() { @@ -140,7 +142,19 @@ class _ShowQrState extends State { data: qrText, size: qrImageSize, backgroundColor: CustomTheme.of(context).white, - version: 6, + version: 8, + errorStateBuilder: (context, error) { + _logger.info(L10n.getFormatted(L.qrShowErrorX, [error])); + return Container( + child: Center( + child: Text( + L10n.getFormatted(L.qrShowErrorX, [error]), + style: Theme.of(context).textTheme.body2.apply(color: CustomTheme.of(context).error), + textAlign: TextAlign.center, + ), + ), + ); + }, ); } }