Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
alexzhirkevich committed Jul 31, 2024
1 parent ca5b8ce commit 9d2b6f4
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
let script = document.createElement("script")
script.src = wasmGCSupported
? "webApp-wasm-130998cae67fca6cee0aaabb04238180.js"
: "webApp-js-d3435a8c28829d9a8d1542dbb66a5ed2.js"
: "webApp-js-fb40ec9c198c12706228f5efafc5eb10.js"
document.body.appendChild(script)

</script>
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/webApp-js.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/webApp-wasm-130998cae67fca6cee0aaabb04238180.js

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import io.ktor.client.plugins.HttpRequestRetry
import io.ktor.client.request.get
import io.ktor.client.request.parameter
import io.ktor.client.statement.bodyAsText
import io.ktor.http.encodeURLPath
import io.ktor.http.encodedPath
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
Expand Down Expand Up @@ -70,13 +72,8 @@ internal class LottieFilesViewModel() : ViewModel() {
}.collectLatest { (q, s, p) ->
try {
val resp = httpClient.get(
"https://lottiefiles.com/api/search/get-animations"
) {
parameter("query", q)
parameter("type", "free")
parameter("sort", s.name.lowercase())
parameter("page", p)
}.bodyAsText().let {
"https://corsproxy.io/?https://lottiefiles.com/api/search/get-animations?query=${q.encodeURLPath()}&type=free&sort=popular&page=$p"
).bodyAsText().let {
json.decodeFromString<JsonObject>(it)
}

Expand All @@ -97,28 +94,6 @@ internal class LottieFilesViewModel() : ViewModel() {
}
}
}

@OptIn(InternalCompottieApi::class)
viewModelScope.launch(ioDispatcher()) {
search.debounce(1000)
.collectLatest { s ->
if (s.isBlank()){
_suggestions.value = emptyList()
} else {
try {
val resp = httpClient.get(
"https://lottiefiles.com/api/search"
) {
parameter("query", s)
}.bodyAsText()

_suggestions.value = json.decodeFromString<List<Suggestion>>(resp)
} catch (t: Throwable) {
t.printStackTrace()
}
}
}
}
}

fun onSortOrderChanged(sortOrder: SortOrder){
Expand Down

0 comments on commit 9d2b6f4

Please sign in to comment.