Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/android/app/src/main/java/net/aurboda/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,12 @@ fun HealthConnectScreen(
// Re-check permissions in case user changed them in system settings
refreshPermissions()
fetchHealthData(context)
if (backgroundSyncEnabled && (healthRecords.isNotEmpty() || pendingDeletionIds.isNotEmpty())) {
// Always send pending data when app comes to foreground
if (healthRecords.isNotEmpty() || pendingDeletionIds.isNotEmpty()) {
sendPendingDataToServer(context)
}
// Refresh widget with latest data
net.aurboda.widget.HrZoneWidgetProvider.triggerUpdate(context)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ fun LiveScreen(
isScanning = false
},
onConnectDevice = { device ->
// Stop scanning once a device is being connected
isScanning = false

// Check Health Connect write permission based on device type
val hasPermission = when (device.sensorType) {
SensorType.HEART_RATE -> hasHrWritePermission
Expand Down Expand Up @@ -745,10 +748,76 @@ private fun ScannerSection(
}
} else if (!isScanning && discoveredDevices.isEmpty()) {
Text(
text = "Tap 'Scan for Devices' to find heart rate monitors and step sensors.",
text = "Tap 'Scan for Devices' to find nearby Bluetooth sensors.",
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Spacer(modifier = Modifier.height(12.dp))
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Card(
modifier = Modifier.weight(1f),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant
)
) {
Column(
modifier = Modifier.padding(12.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = Icons.Default.Favorite,
contentDescription = null,
tint = MaterialTheme.colorScheme.error
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = "Heart Rate Monitor",
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
)
Text(
text = "Tracks heart rate and HRV in real time",
style = MaterialTheme.typography.bodySmall,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
Card(
modifier = Modifier.weight(1f),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant
)
) {
Column(
modifier = Modifier.padding(12.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = Icons.Default.PlayArrow,
contentDescription = null,
tint = MaterialTheme.colorScheme.primary
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = "Step Sensor",
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center
)
Text(
text = "Tracks cadence and steps from a footpod",
style = MaterialTheme.typography.bodySmall,
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
}
}
}
}
Expand Down
Loading