Added initating Settings from QR-Code

main
Kai Mannweiler 2023-02-27 17:15:34 +01:00
parent 074ebb1871
commit b96604103d
1 changed files with 6 additions and 0 deletions

View File

@ -1,8 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:provider/provider.dart';
import 'package:smoke_cess_app/models/settings.dart'; import 'package:smoke_cess_app/models/settings.dart';
import 'package:smoke_cess_app/services/json_service.dart'; import 'package:smoke_cess_app/services/json_service.dart';
import 'package:smoke_cess_app/services/settings_service.dart'; import 'package:smoke_cess_app/services/settings_service.dart';
import '../providers/settings_provider.dart';
import '../services/notification_service.dart';
import '../widgets/missing_config_popup.dart'; import '../widgets/missing_config_popup.dart';
class MyScanner extends StatefulWidget { class MyScanner extends StatefulWidget {
@ -35,6 +38,9 @@ class MyScannerState extends State<MyScanner> {
Map<String, dynamic> json = stringToJSON(qrText); Map<String, dynamic> json = stringToJSON(qrText);
Settings settings = Settings.fromJson(json); Settings settings = Settings.fromJson(json);
saveSettings(settings); saveSettings(settings);
var settingsModel = context.read<SettingsProvider>();
settingsModel.initSettings();
NotificationService().setAllNotifications();
setState(() { setState(() {
scanning = false; scanning = false;
showDialog( showDialog(