Fix custom sticker url loading (#8290)
This commit is contained in:
parent
ed121c051b
commit
93cd197c78
|
@ -0,0 +1 @@
|
||||||
|
Maunium sticker picker loads indefinitely on new update
|
|
@ -218,7 +218,7 @@ class WidgetFragment :
|
||||||
|
|
||||||
override fun invalidate() = withState(viewModel) { state ->
|
override fun invalidate() = withState(viewModel) { state ->
|
||||||
Timber.v("Invalidate state: $state")
|
Timber.v("Invalidate state: $state")
|
||||||
when (state.formattedURL) {
|
when (val formattedUrl = state.formattedURL) {
|
||||||
Uninitialized,
|
Uninitialized,
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
setStateError(null)
|
setStateError(null)
|
||||||
|
@ -227,6 +227,9 @@ class WidgetFragment :
|
||||||
views.widgetProgressBar.isVisible = true
|
views.widgetProgressBar.isVisible = true
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
|
if (views.widgetWebView.url == null) {
|
||||||
|
loadFormattedUrl(formattedUrl())
|
||||||
|
}
|
||||||
setStateError(null)
|
setStateError(null)
|
||||||
when (state.webviewLoadedUrl) {
|
when (state.webviewLoadedUrl) {
|
||||||
Uninitialized -> {
|
Uninitialized -> {
|
||||||
|
@ -253,7 +256,7 @@ class WidgetFragment :
|
||||||
// we need to show Error
|
// we need to show Error
|
||||||
views.widgetWebView.isInvisible = true
|
views.widgetWebView.isInvisible = true
|
||||||
views.widgetProgressBar.isVisible = false
|
views.widgetProgressBar.isVisible = false
|
||||||
setStateError(state.formattedURL.error.message)
|
setStateError(formattedUrl.error.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,8 +326,12 @@ class WidgetFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadFormattedUrl(event: WidgetViewEvents.OnURLFormatted) {
|
private fun loadFormattedUrl(event: WidgetViewEvents.OnURLFormatted) {
|
||||||
|
loadFormattedUrl(event.formattedURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadFormattedUrl(formattedUrl: String) {
|
||||||
views.widgetWebView.clearHistory()
|
views.widgetWebView.clearHistory()
|
||||||
views.widgetWebView.loadUrl(event.formattedURL)
|
views.widgetWebView.loadUrl(formattedUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setStateError(message: String?) {
|
private fun setStateError(message: String?) {
|
||||||
|
|
Loading…
Reference in New Issue