mirror of
https://github.com/usetrmnl/trmnl-android.git
synced 2026-04-29 13:35:26 -07:00
fix: Include deviceId when saving config after validation
The device ID was being fetched and saved to DataStore during BYOD device validation, but it wasn't included in the TrmnlDeviceConfig object when saving the full configuration. This caused the device ID to be null in the loaded config, resulting in battery reporting being skipped with 'device ID is null' warnings. Now we retrieve the device ID from DataStore before saving the full config and include it in the TrmnlDeviceConfig object for BYOD devices.
This commit is contained in:
@@ -552,6 +552,14 @@ class AppSettingsPresenter
|
||||
TrmnlDeviceType.TRMNL -> false
|
||||
}
|
||||
|
||||
// For BYOD devices, retrieve the device ID that was fetched during validation
|
||||
val deviceId =
|
||||
if (deviceType == TrmnlDeviceType.BYOD) {
|
||||
deviceConfigStore.getDeviceId()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
deviceConfigStore.saveDeviceConfig(
|
||||
TrmnlDeviceConfig(
|
||||
type = deviceType,
|
||||
@@ -566,6 +574,8 @@ class AppSettingsPresenter
|
||||
// We still persist the token here; any invalid or expired token will be
|
||||
// detected and surfaced via downstream API error handling.
|
||||
userApiToken = userApiToken.ifBlank { null },
|
||||
// Include device ID for BYOD devices (fetched during validation)
|
||||
deviceId = deviceId,
|
||||
),
|
||||
)
|
||||
trmnlWorkScheduler.updateRefreshInterval(result.refreshRateSecs)
|
||||
|
||||
Reference in New Issue
Block a user