From 639cc4638c6bcb2ed680692ff4211d8e490568c7 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Sat, 3 May 2025 15:48:15 +0200 Subject: [PATCH] Added resetConfig function --- lib/services/config_service.dart | 10 ++++++++++ pubspec.yaml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/services/config_service.dart b/lib/services/config_service.dart index 67c2e9d..1c8275a 100644 --- a/lib/services/config_service.dart +++ b/lib/services/config_service.dart @@ -1,3 +1,4 @@ +import 'package:cabo_counter/utility/globals.dart'; import 'package:shared_preferences/shared_preferences.dart'; /// This class handles the configuration settings for the app. @@ -44,4 +45,13 @@ class ConfigService { final prefs = await SharedPreferences.getInstance(); await prefs.setInt(_keyCaboPenalty, newCaboPenalty); } + + /// Resets the configuration to default values. + static Future resetConfig() async { + Globals.pointLimit = _defaultPointLimit; + Globals.caboPenalty = _defaultCaboPenalty; + final prefs = await SharedPreferences.getInstance(); + await prefs.setInt(_keyPointLimit, _defaultPointLimit); + await prefs.setInt(_keyCaboPenalty, _defaultCaboPenalty); + } } diff --git a/pubspec.yaml b/pubspec.yaml index c1bfc76..0ae0eb6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.1.6+124 +version: 0.1.6+128 environment: sdk: ^3.5.4