Added resetConfig function

This commit is contained in:
Felix Kirchner
2025-05-03 15:48:15 +02:00
parent 037a1e2cd7
commit 639cc4638c
2 changed files with 11 additions and 1 deletions

View File

@@ -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<void> resetConfig() async {
Globals.pointLimit = _defaultPointLimit;
Globals.caboPenalty = _defaultCaboPenalty;
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(_keyPointLimit, _defaultPointLimit);
await prefs.setInt(_keyCaboPenalty, _defaultCaboPenalty);
}
}

View File

@@ -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