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

@ -8,11 +8,13 @@ plugins {
android {
namespace = "dev.zontreck.timetrack"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = "27.0.12077973"
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true
}
kotlinOptions {
@ -28,6 +30,8 @@ android {
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
multiDexEnabled = true
}
buildTypes {
@ -39,6 +43,15 @@ android {
}
}
dependencies {
// For AGP 7.4+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
// For AGP 7.3
// coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.3'
// For AGP 4.0 to 7.2
// coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.9'
}
flutter {
source = "../.."
}

View file

@ -5,7 +5,7 @@ import 'package:dio/dio.dart';
class TTConsts {
static const UPDATE_URL =
"https://git.zontreck.com/AriasCreations/TimeTracker/raw/branch/main/latest-releases.json";
static const VERSION = "1.0.0-dev.2";
static const VERSION = "1.0.0-dev.3";
static bool UPDATE_AVAILABLE = false;
static UpdateChannel UPDATE_CHANNEL = UpdateChannel.alpha;
@ -18,9 +18,10 @@ class TTConsts {
if (VERSION == serverVersion) {
// Up to date
UPDATE_AVAILABLE = false;
} else
} else {
UPDATE_AVAILABLE = true;
}
}
}
enum UpdateChannel {

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,6 +28,7 @@ class _HomePageState extends State<HomePage> {
),
drawer: Drawer(
elevation: 8,
child: SingleChildScrollView(
child: Column(
children: [
DrawerHeader(
@ -48,6 +48,12 @@ class _HomePageState extends State<HomePage> {
Text(
"* ${TTConsts.UPDATE_AVAILABLE ? "Update Is Available" : "You are up to date!"} *",
),
],
),
),
DrawerHeader(
child: Column(
children: [
ElevatedButton(
onPressed: () async {
await TTConsts.checkUpdate();
@ -56,6 +62,7 @@ class _HomePageState extends State<HomePage> {
},
child: Text("Check for Update"),
),
if (TTConsts.UPDATE_AVAILABLE)
ElevatedButton(
onPressed: () async {
OtaUpdate()
@ -75,6 +82,7 @@ class _HomePageState extends State<HomePage> {
],
),
),
),
);
}
}

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:timetrack/pages/HomePage.dart';
class MainApp extends StatefulWidget {
MainApp({super.key});
const MainApp({super.key});
@override
State<StatefulWidget> createState() {

View file

@ -5,7 +5,6 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:timetrack/pages/MainApp.dart';
@ -16,15 +15,15 @@ void main() {
await tester.pumpWidget(MainApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
//expect(find.text('0'), findsOneWidget);
//expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
//await tester.tap(find.byIcon(Icons.add));
//await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
//expect(find.text('0'), findsNothing);
//expect(find.text('1'), findsOneWidget);
});
}