Fix background svc; Add end time logging to trips

This commit is contained in:
zontreck 2025-05-20 09:21:13 -07:00
parent 1e01384d9b
commit 35863780f6
6 changed files with 99 additions and 15 deletions

View file

@ -151,9 +151,17 @@ class _HomePageState extends State<HomePage> {
Center(
child: ElevatedButton(
onPressed: () async {
setState(() {
SessionData.Login();
});
var result = await SessionData.Login();
if (!result) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
"Fatal Error: Could not establish the background service for keeping the app alive.",
),
),
);
}
setState(() {});
},
child: Text("ENGAGE"),
),

View file

@ -28,6 +28,15 @@ class _WorkData extends State<WorkDataPage> {
super.dispose();
}
Widget GetDurationWidgets() {
return Column(
children: [
Text("Paid Driving Hours: ${SessionData.GetPaidHours()}"),
Text("Unpaid Driving Hours: ${SessionData.GetUnpaidHours()}"),
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -77,6 +86,15 @@ class _WorkData extends State<WorkDataPage> {
),
tileColor: LibACFlutterConstants.TITLEBAR_COLOR,
),
if (SessionData.ContainsTripTimes) GetDurationWidgets(),
if (!SessionData.ContainsTripTimes)
ListTile(
title: Text("ERROR"),
subtitle: Text(
"This TTX session file is older than Beta 13. It does not contain trip end times. For that reason, the app cannot display the paid driving hours and unpaid driving hours.",
),
tileColor: LibACFlutterConstants.TITLEBAR_COLOR,
),
if (SessionData.TotalPay != null)
Text(
"Total Pay: \$${SessionData.TotalPay!}",