mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-06-14 00:45:24 -04:00
refactor(node): fetch device links from the API, drop the bundled matcher (#5765)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -111,8 +111,9 @@ import org.meshtastic.core.database.entity.TracerouteNodePositionEntity
|
||||
AutoMigration(from = 39, to = 40),
|
||||
AutoMigration(from = 40, to = 41),
|
||||
AutoMigration(from = 41, to = 42),
|
||||
AutoMigration(from = 42, to = 43, spec = AutoMigration42to43::class),
|
||||
],
|
||||
version = 42,
|
||||
version = 43,
|
||||
exportSchema = true,
|
||||
)
|
||||
@androidx.room3.ConstructedBy(MeshtasticDatabaseConstructor::class)
|
||||
@@ -160,3 +161,7 @@ class AutoMigration33to34 : AutoMigrationSpec
|
||||
@DeleteColumn(tableName = "packet", columnName = "retry_count")
|
||||
@DeleteColumn(tableName = "reactions", columnName = "retry_count")
|
||||
class AutoMigration34to35 : AutoMigrationSpec
|
||||
|
||||
/** Device links moved from the bundled `urls.json` to the resolved API; `original_url` is no longer stored. */
|
||||
@DeleteColumn(tableName = "device_link", columnName = "original_url")
|
||||
class AutoMigration42to43 : AutoMigrationSpec
|
||||
|
||||
@@ -22,29 +22,29 @@ import androidx.room3.PrimaryKey
|
||||
import kotlinx.serialization.Serializable
|
||||
import org.meshtastic.core.model.DeviceLink
|
||||
|
||||
/** A msh.to short-link, upserted from the bundled `urls.json` during the device-hardware refresh cycle. */
|
||||
/** A msh.to device link, cached from the Meshtastic API (`/resource/deviceLinks`) during the refresh cycle. */
|
||||
@Serializable
|
||||
@Entity(tableName = "device_link")
|
||||
data class DeviceLinkEntity(
|
||||
@PrimaryKey @ColumnInfo(name = "short_code") val shortCode: String,
|
||||
@ColumnInfo(name = "original_url") val originalUrl: String,
|
||||
@ColumnInfo(name = "link_description") val linkDescription: String? = null,
|
||||
@ColumnInfo(name = "is_vendor") val isVendor: Boolean = false,
|
||||
val regions: List<String>? = null,
|
||||
val targets: List<String>? = null,
|
||||
)
|
||||
|
||||
fun DeviceLink.asEntity() = DeviceLinkEntity(
|
||||
shortCode = shortCode,
|
||||
originalUrl = originalUrl,
|
||||
linkDescription = description,
|
||||
isVendor = isVendor,
|
||||
regions = regions,
|
||||
targets = targets,
|
||||
)
|
||||
|
||||
fun DeviceLinkEntity.asExternalModel() = DeviceLink(
|
||||
shortCode = shortCode,
|
||||
originalUrl = originalUrl,
|
||||
description = linkDescription,
|
||||
isVendor = isVendor,
|
||||
regions = regions,
|
||||
targets = targets,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user