Attempt to patch php patch method.

This commit is contained in:
zontreck 2025-07-22 13:31:30 -07:00
parent 845e35fe74
commit 3756383fa8
5 changed files with 36 additions and 12 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.35";
static const VERSION = "1.0.0-beta.36";
static bool UPDATE_AVAILABLE = false;
static UpdateChannel UPDATE_CHANNEL = UpdateChannel.beta;

View file

@ -237,7 +237,7 @@ class SessionData {
androidConfig: androidConfig,
);
FlutterBackground.enableBackgroundExecution();
if (success) FlutterBackground.enableBackgroundExecution();
WakelockPlus.enable();
if (!success) {
@ -314,15 +314,14 @@ class SessionData {
FlutterBackground.disableBackgroundExecution();
WakelockPlus.disable();
var saveData = await _serializeToNBT();
ResetAppSession();
print(SnbtIo.writeToString(saveData));
Uint8List nbtData = await NbtIo.writeToStream(saveData);
//var saveData = await _serializeToNBT();
//ResetAppSession();
//print(SnbtIo.writeToString(saveData));
//Uint8List nbtData = await NbtIo.writeToStream(saveData);
Trips = [];
positions = [];
_performPatch();
_upload(nbtData);
//_upload(nbtData);
}
/// v2 Create function.
@ -367,7 +366,7 @@ class SessionData {
/// Deprecated: This function uploads using the v1 API, and is intended to be called at the conclusion of data recording.
@Deprecated(
"This function utilizes the Protocol v1 Create method, which has been replaced by createv2 and patch. This function will be removed.",
"This function utilizes the Protocol v1 Create method, which has been replaced by createv2 and patch. This function will be removed. DO NOT USE",
)
static Future<void> _upload(List<int> nbtData) async {
Dio dio = Dio();

View file

@ -16,6 +16,8 @@ class HomePage extends StatefulWidget {
}
class _HomePageState extends State<HomePage> {
int UPLOAD_STATE = -1;
@override
void didChangeDependencies() {
setState(() {});
@ -421,6 +423,8 @@ class _HomePageState extends State<HomePage> {
SessionData.DirtyState = true;
SessionData.ActionPerformed();
ShowUploadProgress();
},
child: Text("Yes"),
),
@ -446,6 +450,26 @@ class _HomePageState extends State<HomePage> {
);
}
Future<void> ShowUploadProgress() async {
UPLOAD_STATE = 0;
_advanceUpload();
}
Future<void> _advanceUpload() async {
if (UPLOAD_STATE == 0) {
// We're now going to show the modal indicating the data is being compiled to NBT
showDialog(
context: context,
builder: (buildx) {
return AlertDialog.adaptive(
title: Text("Upload in progress"),
content: Column(children: [Text("Compiling NBT Session Data...")]),
);
},
);
}
}
Widget GetLoggedInWidgets() {
return Column(
children: [

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.35
version: 1.0.0-beta.36
environment:
sdk: ^3.7.2

View file

@ -90,8 +90,9 @@ function update_version($DB, $sesisonId, $newVer) {
}
function pushNewData($DB, $sessionId, $data) {
$null = NULL;
$stmt = $DB->prepare("UPDATE `data` SET `SessionData` = ? WHERE `ID` = ?");
$stmt->bind_param("bs", NULL, $sessionId);
$stmt->bind_param("bs", $null, $sessionId);
$stmt->send_long_data(0, $data);
if(!$stmt->execute()) {
return false;