diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 10acbd6..e11db5a 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,9 +1,23 @@ +import java.util.Properties +import java.io.FileInputStream + plugins { id("com.android.application") // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } +// Release-Signing: android/key.properties (nie committen, siehe .gitignore). +// Fehlt die Datei (z.B. frischer Checkout ohne Keystore), fällt der Release- +// Build auf den Debug-Key zurück statt zu scheitern – nur auf dem +// Build-Rechner (236) ist der echte Release-Keystore hinterlegt. +val keystorePropertiesFile = rootProject.file("key.properties") +val keystoreProperties = Properties() +val hasReleaseKeystore = keystorePropertiesFile.exists() +if (hasReleaseKeystore) { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) +} + android { namespace = "de.timemaster.timemaster_kiosk" compileSdk = 36 @@ -15,25 +29,31 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "de.timemaster.timemaster_kiosk" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion - // Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION - // is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions) - // You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true` - // flag during build. versionCode = flutter.versionCode versionName = flutter.versionName } + signingConfigs { + if (hasReleaseKeystore) { + create("release") { + keyAlias = keystoreProperties["keyAlias"] as String + keyPassword = keystoreProperties["keyPassword"] as String + storeFile = rootProject.file(keystoreProperties["storeFile"] as String) + storePassword = keystoreProperties["storePassword"] as String + } + } + } + buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.getByName("debug") + signingConfig = if (hasReleaseKeystore) { + signingConfigs.getByName("release") + } else { + signingConfigs.getByName("debug") + } } } } diff --git a/lib/app_version.dart b/lib/app_version.dart index 2782b37..98286bd 100644 --- a/lib/app_version.dart +++ b/lib/app_version.dart @@ -1,3 +1,3 @@ /// Manuell mit pubspec.yaml synchron halten (siehe timemaster-mobile, /// gleiche Konvention – kein package_info_plus während aktiver Feldtests). -const String kAppVersion = '0.1.2+3'; +const String kAppVersion = '0.1.3+4'; diff --git a/lib/main.dart b/lib/main.dart index cfd2357..2c68737 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; import 'app_version.dart'; import 'services/api_client.dart'; import 'screens/enrollment_screen.dart'; @@ -44,6 +45,11 @@ Future main() async { // sichtbar machen und mit leerem Enrollment-Status weiterstarten. debugPrint('ApiClient.init() fehlgeschlagen (Kiosk $kAppVersion): $e\n$st'); } + // Kiosk-Tablet ist dauerhaft im Einsatz – Display soll nie einschlafen, + // sonst muss vor jedem Stempeln erst entsperrt werden. Fehler hier (z.B. + // Plattform-Channel nicht bereit) sind nicht kritisch genug, um den + // Start zu blockieren. + unawaited(WakelockPlus.enable().catchError((_) {})); runApp(const TimeMasterKioskApp()); }, (error, stack) { debugPrint('Unbehandelter Fehler (Kiosk $kAppVersion): $error\n$stack'); diff --git a/pubspec.yaml b/pubspec.yaml index bc27965..ecf6b3e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: timemaster_kiosk description: TimeMaster Kiosk – Stempeluhr für Android-Tablets hinter VPN publish_to: 'none' -version: 0.1.2+3 +version: 0.1.3+4 environment: sdk: '>=3.3.0 <4.0.0' @@ -13,6 +13,7 @@ dependencies: dio: ^5.7.0 flutter_secure_storage: ^9.2.2 nfc_manager: ^4.2.1 + wakelock_plus: ^1.2.8 dev_dependencies: flutter_test: