Skip to content

Commit

Permalink
Merge commit '42afb02af4a3ccfd0f7684c87eace2d0d270e027'
Browse files Browse the repository at this point in the history
  • Loading branch information
TagCiccone committed Jun 6, 2024
2 parents 5864da7 + 42afb02 commit c82c7ae
Show file tree
Hide file tree
Showing 44 changed files with 2,759 additions and 390 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

#IOS
Podfile
Podfile.lock
Binary file added assets/accolades/gearEye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/accolades/goat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/accolades/note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/accolades/ryanMcgoff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/extras/naz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/extras/rudy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaderboard/badges/go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaderboard/badges/gopher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaderboard/badges/java.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/leaderboard/badges/sheets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 49 additions & 19 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:io';
import 'package:green_scout/pages/home.dart';
import 'package:green_scout/pages/login_as_user.dart';
import 'package:flutter/material.dart';
import 'package:green_scout/utils/achievement_manager.dart';
import 'package:green_scout/utils/main_app_data_helper.dart';

import 'utils/app_state.dart';
Expand Down Expand Up @@ -36,7 +37,7 @@ void main() async {
// we're connected or not.
bool wasOnline = App.internetOn;

await App.httpPost("/", "", ignoreOutput: true);
await App.httpRequest("/", "", ignoreOutput: true);

if (wasOnline &&
App.internetOff &&
Expand All @@ -63,7 +64,7 @@ void main() async {

if (matches.isNotEmpty && App.internetOn) {
for (var match in matches) {
final _ = await App.httpPost("dataEntry", match);
final _ = await App.httpRequest("dataEntry", match);

MainAppData.confirmMatchMangled(match, App.responseSucceeded);
}
Expand All @@ -80,53 +81,82 @@ void main() async {
}
});

Timer.periodic(const Duration(minutes: 1), (timer) async {
if (MainAppData.loggedIn) {
MainAppData.setUserInfo();
}
});

runApp(const MyApp());

if (MainAppData.loggedIn && MainAppData.userCertificate != null) {
var connected = await App.httpPost("/", "", ignoreOutput: true);
if (MainAppData.loggedIn && MainAppData.userCertificate.isNotEmpty) {
var connected = await App.httpRequest("/", "", ignoreOutput: true);

if (connected) {
// Start up check to ensure that we're logged out when
// the certificate becomes invalid on the server.
bool postSucceeded = await App.httpPost("certificateValid", '');
bool postSucceeded = await App.httpRequest("certificateValid", '');

if (!postSucceeded) {
MainAppData.loggedIn = false;
App.gotoPage(
globalNavigatorKey.currentContext!, const LoginPageForUsers());
} else {
MainAppData.setUserInfo();
}
}
}

if (AchievementManager.appThemesUnlocked.value && MainAppData.loggedIn) {
if (!isDarkMode) {
App.setThemeMode(Brightness.light);
}
} else {
App.setThemeMode(Brightness.light);
}

Settings.update();
}

//These are the only 2 themes I bothered making. Feel free to make more if you want future devs, I'm just not great at color balancing.
var lightTheme = ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: greenMachineGreen,
brightness: Brightness.light,
),
useMaterial3: true,
);

var darkTheme = ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: greenMachineGreen,
brightness: Brightness.dark,
),
useMaterial3: true,
);

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
if (MainAppData.loggedIn) {
AchievementManager.appThemesUnlocked.value =
(App.getBool("Themes Unlocked") ?? false);
}

return MaterialApp(
navigatorKey: globalNavigatorKey,

title: appTitle,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: greenMachineGreen),
useMaterial3: true,
),
// TODO: later
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
brightness: Brightness.dark,
seedColor: greenMachineGreen,
),
),
theme: lightTheme,
darkTheme: darkTheme,
home:
!MainAppData.loggedIn ? const LoginPageForUsers() : const HomePage(),
themeAnimationCurve: Curves.easeInOut,
themeMode: ThemeMode.light,

themeMode: AchievementManager.appThemesUnlocked.value
? ThemeMode.system
: ThemeMode.light,
debugShowCheckedModeBanner: false,
);
}
Expand Down
Loading

0 comments on commit c82c7ae

Please sign in to comment.