Merge branch 'VR-AppFullyOffline' into Uploader

This commit is contained in:
Thorbjoern
2026-01-16 11:19:54 +01:00
6 changed files with 20 additions and 14 deletions
@@ -55,7 +55,9 @@ namespace GhostSystem
private void Start()
{
_offlinePath = Path.Combine(Application.persistentDataPath, "offline_log.jsonl");
string now = DateTime.Now.ToString("yyyyMMdd_HHmmss");
string dateiname = now + ".jsonl";
_offlinePath = Path.Combine(Application.persistentDataPath, dateiname);
}
private void HandleSupabaseReady()
@@ -118,13 +120,15 @@ namespace GhostSystem
private async UniTaskVoid FlushBatchAsync() // Die eigentliche Methode zum Hochladen eines Batches/leeren des Buffers.
{
if (_frameBuffer.Count == 0 || !supabaseReady) return;
if (_frameBuffer.Count == 0) return;
var batch = new List<FrameModel>(_frameBuffer);
_frameBuffer.Clear();
Debug.Log("Flushing Frame Buffer");
try
await FallbackToOfflineAsync(batch);
OnUploadFinished?.Invoke(); // Die Action für das Ende des Ladescreens wird trotzdem ausgelöst.
/*try
{
var response = await SupabaseManager.instance.supabase.From<FrameModel>().Insert(batch); // Versucht, den Batch an Superbase hochzuladen
if (!response.ResponseMessage.IsSuccessStatusCode)
@@ -147,7 +151,7 @@ namespace GhostSystem
await FallbackToOfflineAsync(batch); // Bei nicht erfolgtem Upload wird der Batch lokal gescpeichert.
OnUploadFinished?.Invoke(); // Die Action für das Ende des Ladescreens wird trotzdem ausgelöst.
Debug.Log("Upload Finished");
}
}*/
}
private async UniTask FallbackToOfflineAsync(List<FrameModel> batch) // Schreibt den Buffer in eine Datei, falls Upload nicht möglich. Kann zu Rucklern führen.
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
@@ -21,7 +21,7 @@ namespace GhostSystem
public const string supabaseAnonKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNlemdoeHp0dnlnZ3dndW55aG1xIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDcyMTk5MzcsImV4cCI6MjA2Mjc5NTkzN30.vr6-3X3Ux_DjcCiw_CqG-VKP8BiBXtmCzAXjYTiA_vY";
public Client supabase { get; private set; }
public string userId => supabase?.Auth?.CurrentUser?.Id;
public string userId = "09321725-0150-4df0-92a7-029005cc75eb";
private string email;
private string password;
@@ -144,6 +144,7 @@ namespace GhostSystem
}
else
{
//textbox.text += $"\n\rSupabase health check failed: {www.error}";
Debug.LogError($"Supabase health check failed: {www.error}");
}