|
|
@ -426,7 +426,7 @@ class ComposeViewModel |
|
|
|
super.onCleared() |
|
|
|
super.onCleared() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getStickers() { |
|
|
|
private fun getStickers() { |
|
|
|
if(!tryFetchStickers) |
|
|
|
if(!tryFetchStickers) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
@ -435,6 +435,7 @@ class ComposeViewModel |
|
|
|
haveStickers.postValue(true) |
|
|
|
haveStickers.postValue(true) |
|
|
|
|
|
|
|
|
|
|
|
val singles = mutableListOf<Single<Response<StickerPack>>>() |
|
|
|
val singles = mutableListOf<Single<Response<StickerPack>>>() |
|
|
|
|
|
|
|
|
|
|
|
for(entry in stickers) { |
|
|
|
for(entry in stickers) { |
|
|
|
val url = entry.value.removePrefix("/").removeSuffix("/") + "/pack.json"; |
|
|
|
val url = entry.value.removePrefix("/").removeSuffix("/") + "/pack.json"; |
|
|
|
singles += api.getStickerPack(url) |
|
|
|
singles += api.getStickerPack(url) |
|
|
@ -450,8 +451,11 @@ class ComposeViewModel |
|
|
|
Log.d(TAG, "Failed to get sticker pack.json", it) |
|
|
|
Log.d(TAG, "Failed to get sticker pack.json", it) |
|
|
|
emptyList() |
|
|
|
emptyList() |
|
|
|
}.subscribe() { pack -> |
|
|
|
}.subscribe() { pack -> |
|
|
|
if(pack.isNotEmpty()) |
|
|
|
if(pack.isNotEmpty()) { |
|
|
|
this.stickers.postValue(pack.toTypedArray()) |
|
|
|
val array = pack.toTypedArray() |
|
|
|
|
|
|
|
array.sort() |
|
|
|
|
|
|
|
this.stickers.postValue(array) |
|
|
|
|
|
|
|
} |
|
|
|
}.autoDispose() |
|
|
|
}.autoDispose() |
|
|
|
} |
|
|
|
} |
|
|
|
}, { |
|
|
|
}, { |
|
|
|