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 { android {
namespace = "dev.zontreck.timetrack" namespace = "dev.zontreck.timetrack"
compileSdk = flutter.compileSdkVersion compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion ndkVersion = "27.0.12077973"
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_11 sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11
isCoreLibraryDesugaringEnabled = true
} }
kotlinOptions { kotlinOptions {
@ -28,6 +30,8 @@ android {
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode versionCode = flutter.versionCode
versionName = flutter.versionName versionName = flutter.versionName
multiDexEnabled = true
} }
buildTypes { 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 { flutter {
source = "../.." source = "../.."
} }

View file

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

View file

@ -1,11 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:libacflutter/Constants.dart'; import 'package:libacflutter/Constants.dart';
import 'package:ota_update/ota_update.dart'; import 'package:ota_update/ota_update.dart';
import 'package:timetrack/consts.dart'; import 'package:timetrack/consts.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
HomePage({super.key}); const HomePage({super.key});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -29,6 +28,7 @@ class _HomePageState extends State<HomePage> {
), ),
drawer: Drawer( drawer: Drawer(
elevation: 8, elevation: 8,
child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
DrawerHeader( DrawerHeader(
@ -48,6 +48,12 @@ class _HomePageState extends State<HomePage> {
Text( Text(
"* ${TTConsts.UPDATE_AVAILABLE ? "Update Is Available" : "You are up to date!"} *", "* ${TTConsts.UPDATE_AVAILABLE ? "Update Is Available" : "You are up to date!"} *",
), ),
],
),
),
DrawerHeader(
child: Column(
children: [
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
await TTConsts.checkUpdate(); await TTConsts.checkUpdate();
@ -56,6 +62,7 @@ class _HomePageState extends State<HomePage> {
}, },
child: Text("Check for Update"), child: Text("Check for Update"),
), ),
if (TTConsts.UPDATE_AVAILABLE)
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
OtaUpdate() OtaUpdate()
@ -75,6 +82,7 @@ class _HomePageState extends State<HomePage> {
], ],
), ),
), ),
),
); );
} }
} }

View file

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

View file

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