Skip to content

Commit

Permalink
feat: add landscape option to spotlight (closes #219)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed Feb 3, 2025
1 parent 382528e commit da23136
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/com/bnyro/wallpaper/api/sp/SpApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class SpApi: Api() {
override val icon = Icons.Default.LightMode

override val filters: Map<String, List<String>> = mapOf(
"country" to listOf("US") + Locale.getISOCountries().toList().filter { it != "US" }.sorted()
"country" to listOf("US") + Locale.getISOCountries().toList().filter { it != "US" }.sorted(),
"orientation" to listOf("portrait", "landscape")
)

private val api = RetrofitHelper.create(baseUrl, Spotlight::class.java)
Expand All @@ -31,7 +32,10 @@ class SpApi: Api() {
return images.map {
Wallpaper(
title = it.ad.title,
imgSrc = it.ad.portraitImage.asset,
imgSrc = when (getQuery("orientation")) {
"portrait" -> it.ad.portraitImage.asset
else -> it.ad.landscapeImage.asset
},
author = it.ad.copyright,
url = it.ad.ctaUri.replaceFirst("microsoft-edge:", ""),
description = it.ad.description
Expand Down

0 comments on commit da23136

Please sign in to comment.