diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/core/model/sources/Source.kt b/app/src/main/java/com/pranshulgg/weather_master_app/core/model/sources/Source.kt index 9205bf4e9..60aee97b4 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/core/model/sources/Source.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/core/model/sources/Source.kt @@ -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, // 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) ), diff --git a/app/src/main/java/com/pranshulgg/weather_master_app/feature/apikeyconfig/ApiKeysConfigScreen.kt b/app/src/main/java/com/pranshulgg/weather_master_app/feature/apikeyconfig/ApiKeysConfigScreen.kt index 92b01d4d3..0f854e033 100644 --- a/app/src/main/java/com/pranshulgg/weather_master_app/feature/apikeyconfig/ApiKeysConfigScreen.kt +++ b/app/src/main/java/com/pranshulgg/weather_master_app/feature/apikeyconfig/ApiKeysConfigScreen.kt @@ -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)