Merge pull request #1158 from reveler-hub/fix/metoffice-api-key-link

Point Met Office's API key link to the right DataHub product
This commit is contained in:
Pranshul authored and GitHub committed 2026-09-18 21:54:38 +05:30
commit 2fd30077fa
2 files changed
+16 -1

No files matched your search

@@ -11,6 +11,8 @@ enum class Source(
val fullName: String,
val countryNameRes: Int? = null,
val requiresUserApiKey: Boolean = false, // Source must not be selectable until the user has provided their API key
val signupLink: String? = null, // Shown instead of displayLink on the API key entry screen, when set
val apiKeyNote: String? = null, // Optional hint shown under the link on the API key entry screen
val regionalButWorldwideSupport: Boolean = false,
val capabilities: Set<Capability>,
// val providesAlerts: Boolean = false,
@@ -111,6 +113,8 @@ enum class Source(
displayLink = "https://www.metoffice.gov.uk/",
countryNameRes = R.string.country_united_kingdom,
requiresUserApiKey = true,
signupLink = "https://datahub.metoffice.gov.uk/pricing/site-specific",
apiKeyNote = "Subscribe to the \"Global Spot\" option",
regionalButWorldwideSupport = true,
capabilities = setOf(Capability.WEATHER)
),
@@ -54,7 +54,18 @@ fun ApiKeysConfigScreen(navController: NavController) {
tiles = sourcesRequireApiKey.map {
SettingTile.DialogTextFieldTile(
overline = { Text(it.displayLink) },
overline = {
Column {
Text(it.signupLink ?: it.displayLink)
it.apiKeyNote?.let { note ->
Text(
text = note,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
},
title = it.displayName,
onTextSubmitted = { key ->
viewModel.saveKey(key.trim(), it)