HydroFlux 0.1.0
This commit is contained in:
@@ -10,6 +10,33 @@ export class Dashboard {
|
|||||||
render() {
|
render() {
|
||||||
if (!this.container) return;
|
if (!this.container) return;
|
||||||
|
|
||||||
|
// --- VERSION MIGRATION LOGIC ---
|
||||||
|
const APP_VERSION = '5.0';
|
||||||
|
const currentVersion = localStorage.getItem('hydroflux_version');
|
||||||
|
|
||||||
|
if (currentVersion !== APP_VERSION) {
|
||||||
|
console.log(`Migrating from ${currentVersion} to ${APP_VERSION}`);
|
||||||
|
|
||||||
|
// Force reset of settings for V5 to ensure new defaults (3.0L goal) are applied
|
||||||
|
// But try to keep history if possible
|
||||||
|
const oldHistory = localStorage.getItem('hydroflux_water_history');
|
||||||
|
|
||||||
|
// Clear Data
|
||||||
|
localStorage.removeItem('hydroflux_data');
|
||||||
|
// We don't clear 'hydroflux_health_data' as that comes from sync, but maybe good to refresh it
|
||||||
|
|
||||||
|
// Set Defaults
|
||||||
|
localStorage.setItem('hydroflux_data', JSON.stringify({ current: 0, goal: 3.0 })); // Force 3.0L Goal
|
||||||
|
|
||||||
|
if (oldHistory) {
|
||||||
|
localStorage.setItem('hydroflux_water_history', oldHistory);
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem('hydroflux_version', APP_VERSION);
|
||||||
|
localStorage.setItem('hydroflux_drink_size', '250'); // Default drink size
|
||||||
|
}
|
||||||
|
// -------------------------------
|
||||||
|
|
||||||
// Data Retrieval (Keeping persistence)
|
// Data Retrieval (Keeping persistence)
|
||||||
const waterData = JSON.parse(localStorage.getItem('hydroflux_data') || '{"current":0,"goal":3.0}');
|
const waterData = JSON.parse(localStorage.getItem('hydroflux_data') || '{"current":0,"goal":3.0}');
|
||||||
|
|
||||||
@@ -53,7 +80,10 @@ export class Dashboard {
|
|||||||
|
|
||||||
<!-- Title and DateTime -->
|
<!-- Title and DateTime -->
|
||||||
<div class="flex flex-col items-center flex-1">
|
<div class="flex flex-col items-center flex-1">
|
||||||
<h1 class="text-2xl font-bold text-gray-800 mb-1">Hydro Flux</h1>
|
<div class="flex items-center gap-2">
|
||||||
|
<h1 class="text-2xl font-bold text-gray-800 mb-1">Hydro Flux</h1>
|
||||||
|
<span class="bg-gray-100 text-gray-400 text-[10px] px-1.5 py-0.5 rounded-md border border-gray-200">v5.0</span>
|
||||||
|
</div>
|
||||||
<div id="currentDate" class="text-sm text-gray-600"></div>
|
<div id="currentDate" class="text-sm text-gray-600"></div>
|
||||||
<div id="currentTime" class="text-sm text-gray-500"></div>
|
<div id="currentTime" class="text-sm text-gray-500"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export class SleepView {
|
|||||||
render() {
|
render() {
|
||||||
// Real Sleep Data from Health Connect
|
// Real Sleep Data from Health Connect
|
||||||
const healthData = JSON.parse(localStorage.getItem('hydroflux_health_data') || '{"steps": 0, "sleep": 0}');
|
const healthData = JSON.parse(localStorage.getItem('hydroflux_health_data') || '{"steps": 0, "sleep": 0}');
|
||||||
|
console.log("Rendering Sleep View with Data:", healthData); // Debug
|
||||||
const sleepHoursTotal = healthData.sleep; // e.g. 7.5
|
const sleepHoursTotal = healthData.sleep; // e.g. 7.5
|
||||||
|
|
||||||
// Calculate Stages (Estimated breakdown if not provided by native yet)
|
// Calculate Stages (Estimated breakdown if not provided by native yet)
|
||||||
|
|||||||
BIN
Hydroflux/releases/HydroFlux V5.apk
Normal file
BIN
Hydroflux/releases/HydroFlux V5.apk
Normal file
Binary file not shown.
Reference in New Issue
Block a user