aboutsummaryrefslogtreecommitdiffstats
path: root/lib/presentation/screens
diff options
context:
space:
mode:
authorHiroyuki Ishii <ishii.hiroyuki002@jp.panasonic.com>2024-10-07 16:25:28 +0900
committerScott Murray <scott.murray@konsulko.com>2024-10-18 20:18:59 +0000
commitd8c6d9b56cb17fc7d2487734837249c3a54472f8 (patch)
treeb5807f841d2f2e6f504100d09ceec8a3c06430ea /lib/presentation/screens
parentcb266d2c9e972c72db10c5102f003ed8609060b2 (diff)
Settings: Parse version strings from text files
Version strings displayed on the settings page were tentatively implemented as constant strings and were not updated. Let's implement a small piece of code to parse text files, similar to how the Qt-version of settings app did. Bug-AGL: SPEC-5256 Change-Id: I6d3669bff5299c818c3a9f1c5439ddf1ab952760 Signed-off-by: Hiroyuki Ishii <ishii.hiroyuki002@jp.panasonic.com> (cherry picked from commit 4d058d87aebaa1d3d47a835559dfa0fe0d8b7b74)
Diffstat (limited to 'lib/presentation/screens')
-rw-r--r--lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart b/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart
index fce1837..c5e571d 100644
--- a/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart
+++ b/lib/presentation/screens/settings/settings_screens/version_info/version_info_screend.dart
@@ -1,6 +1,32 @@
import 'package:flutter_ics_homescreen/export.dart';
class VersionInfoPage extends ConsumerWidget {
+ static String aglVersionFilePath = '/etc/os-release';
+ static String kernelVersionFilePath = '/proc/version';
+
+ static String aglVersion() {
+ try {
+ final file = File(aglVersionFilePath);
+ final data = file.readAsStringSync().split("\n");
+ if (!data[1].contains('Automotive Grade Linux')) {
+ throw 'Non-AGL distribution';
+ }
+ return "AGL: " + data[2].split('"')[1];
+ } catch (_) {
+ return '<AGL version not found>';
+ }
+ }
+
+ static String kernelVersion() {
+ try {
+ final file = File(kernelVersionFilePath);
+ final data = file.readAsStringSync().split(" ");
+ return "Kernel: " + data[2];
+ } catch (_) {
+ return '<Kernel version not found>';
+ }
+ }
+
const VersionInfoPage({super.key});
static Page<void> page() =>
@@ -43,7 +69,7 @@ class VersionInfoPage extends ConsumerWidget {
child: ListTile(
contentPadding: const EdgeInsets.only(top: 50, left: 25),
leading: Text(
- aglVeriosn,
+ aglVersion(),
style: Theme.of(context).textTheme.titleMedium,
),
),
@@ -64,7 +90,7 @@ class VersionInfoPage extends ConsumerWidget {
contentPadding: const EdgeInsets.only(top: 50, left: 25),
leading: Text(
- kernelVeriosn,
+ kernelVersion(),
style: Theme.of(context).textTheme.titleMedium,
),
),