Skip to content

Commit 9a7909c

Browse files
committed
spotless! this code is super friggen spotless now~
1 parent f1d7cfd commit 9a7909c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

core/data/src/main/kotlin/org/meshtastic/core/data/repository/DeviceHardwareRepository.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ constructor(
5555
*/
5656
suspend fun getDeviceHardwareByModel(hwModel: Int, forceRefresh: Boolean = false): Result<DeviceHardware?> =
5757
withContext(Dispatchers.IO) {
58-
Timber.d("DeviceHardwareRepository: getDeviceHardwareByModel(hwModel=%d, forceRefresh=%b)", hwModel, forceRefresh)
58+
Timber.d(
59+
"DeviceHardwareRepository: getDeviceHardwareByModel(hwModel=%d, forceRefresh=%b)",
60+
hwModel,
61+
forceRefresh,
62+
)
5963

6064
if (forceRefresh) {
6165
Timber.d("DeviceHardwareRepository: forceRefresh=true, clearing local device hardware cache")
@@ -74,7 +78,10 @@ constructor(
7478
runCatching {
7579
Timber.d("DeviceHardwareRepository: fetching device hardware from remote API")
7680
val remoteHardware = remoteDataSource.getAllDeviceHardware()
77-
Timber.d("DeviceHardwareRepository: remote API returned %d device hardware entries", remoteHardware.size)
81+
Timber.d(
82+
"DeviceHardwareRepository: remote API returned %d device hardware entries",
83+
remoteHardware.size,
84+
)
7885

7986
localDataSource.insertAllDeviceHardware(remoteHardware)
8087
val fromDb = localDataSource.getByHwModel(hwModel)?.asExternalModel()
@@ -90,7 +97,11 @@ constructor(
9097
return@withContext Result.success(it)
9198
}
9299
.onFailure { e ->
93-
Timber.w(e, "DeviceHardwareRepository: failed to fetch device hardware from server for hwModel=%d", hwModel)
100+
Timber.w(
101+
e,
102+
"DeviceHardwareRepository: failed to fetch device hardware from server for hwModel=%d",
103+
hwModel,
104+
)
94105

95106
// 3. Attempt to use stale cache as a fallback, but only if it looks complete.
96107
val staleEntity = localDataSource.getByHwModel(hwModel)
@@ -126,10 +137,7 @@ constructor(
126137

127138
/** Returns true if the cached entity is missing important fields and should be refreshed. */
128139
private fun DeviceHardwareEntity.isIncomplete(): Boolean =
129-
displayName.isBlank() ||
130-
platformioTarget.isBlank() ||
131-
images == null ||
132-
images.isEmpty()
140+
displayName.isBlank() || platformioTarget.isBlank() || images == null || images.isEmpty()
133141

134142
/**
135143
* Extension function to check if the cached entity is stale.

0 commit comments

Comments
 (0)