Add a small banner to web view that says what format the data is in.

This commit is contained in:
zontreck 2025-05-25 16:14:28 -07:00
parent e69a4c9732
commit cbe676a359
4 changed files with 16 additions and 2 deletions

View file

@ -9,7 +9,7 @@ class TTConsts {
static get SESSION_SERVER =>
"https://api.zontreck.com/timetrack/$UPDATE_CHANNEL/timetrack.php";
static const VERSION = "1.0.0-beta.25";
static const VERSION = "1.0.0-beta.26";
static bool UPDATE_AVAILABLE = false;
static UpdateChannel UPDATE_CHANNEL = UpdateChannel.beta;

View file

@ -40,6 +40,8 @@ class SessionData {
static String DisplayError = "";
static double? TotalPay;
static bool ContainsTripTimes = true;
static bool IsSavedData = false;
static String SaveDataType = "";
/// Is true if the try-catch is tripped or if not running on Android
static bool isWeb = false;
@ -472,6 +474,8 @@ class SessionData {
String cType = reply.headers.value("Content-Type") ?? "application/json";
if (cType == "application/json") {
IsSavedData = true;
SaveDataType = "JSON";
return LoadData(reply.data as Map<String, dynamic>);
} else if (cType == "application/nbt") {
print("Data is in NBT Format");
@ -482,6 +486,8 @@ class SessionData {
IsReadOnly = true;
isWeb = true;
IsSavedData = true;
SaveDataType = "NBT";
return true;
} else
return false;

View file

@ -124,6 +124,14 @@ class _WebMain extends State<WebMain> {
Text(
"Use the top left menu to show the various pages for the data viewer.",
),
if (SessionData.IsSavedData)
ListTile(
title: Text("You are viewing saved data"),
subtitle: Text(
"This data was saved in the ${SessionData.SaveDataType} format.\n\nThis data is read-only. You will not be able to edit it.",
),
tileColor: const Color.fromARGB(255, 7, 123, 255),
),
ElevatedButton(
onPressed: () async {
await showDialog(

View file

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0-beta.25
version: 1.0.0-beta.26
environment:
sdk: ^3.7.2