Fix up more of the update functions

This commit is contained in:
zontreck 2025-05-14 19:32:03 -07:00
parent d0ad9c9364
commit fcf5348f96
5 changed files with 75 additions and 55 deletions

View file

@ -1,11 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:libacflutter/Constants.dart';
import 'package:ota_update/ota_update.dart';
import 'package:timetrack/consts.dart';
class HomePage extends StatefulWidget {
HomePage({super.key});
const HomePage({super.key});
@override
State<StatefulWidget> createState() {
@ -29,50 +28,59 @@ class _HomePageState extends State<HomePage> {
),
drawer: Drawer(
elevation: 8,
child: Column(
children: [
DrawerHeader(
child: Column(
children: [
Text("Time Tracker"),
Text("Created by Tara Piccari"),
Text("Copyright 2025 - Present"),
],
child: SingleChildScrollView(
child: Column(
children: [
DrawerHeader(
child: Column(
children: [
Text("Time Tracker"),
Text("Created by Tara Piccari"),
Text("Copyright 2025 - Present"),
],
),
),
),
DrawerHeader(
child: Column(
children: [
Text("Version: ${TTConsts.VERSION}"),
Text("Update Channel: ${TTConsts.UPDATE_CHANNEL}"),
Text(
"* ${TTConsts.UPDATE_AVAILABLE ? "Update Is Available" : "You are up to date!"} *",
),
ElevatedButton(
onPressed: () async {
await TTConsts.checkUpdate();
DrawerHeader(
child: Column(
children: [
Text("Version: ${TTConsts.VERSION}"),
Text("Update Channel: ${TTConsts.UPDATE_CHANNEL}"),
Text(
"* ${TTConsts.UPDATE_AVAILABLE ? "Update Is Available" : "You are up to date!"} *",
),
],
),
),
DrawerHeader(
child: Column(
children: [
ElevatedButton(
onPressed: () async {
await TTConsts.checkUpdate();
setState(() {});
},
child: Text("Check for Update"),
),
ElevatedButton(
onPressed: () async {
OtaUpdate()
.execute(
"https://ci.zontreck.com/job/Projects/job/Dart/job/Time%20Tracker/job/main/lastSuccessfulBuild/artifact/build/app/outputs/flutter-apk/timetrack.apk",
destinationFilename: "timetrack.apk",
)
.listen((OtaEvent event) {
//setState(() => currentEvent = event);
});
},
child: Text("Install Update"),
),
],
setState(() {});
},
child: Text("Check for Update"),
),
if (TTConsts.UPDATE_AVAILABLE)
ElevatedButton(
onPressed: () async {
OtaUpdate()
.execute(
"https://ci.zontreck.com/job/Projects/job/Dart/job/Time%20Tracker/job/main/lastSuccessfulBuild/artifact/build/app/outputs/flutter-apk/timetrack.apk",
destinationFilename: "timetrack.apk",
)
.listen((OtaEvent event) {
//setState(() => currentEvent = event);
});
},
child: Text("Install Update"),
),
],
),
),
),
],
],
),
),
),
);