fix(AnimePahe): Fix problems with webview/sharing animes (#1531)
* fix: Fix problems with webview/sharing animes * chore: Bump version
This commit is contained in:
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'AnimePahe'
|
extName = 'AnimePahe'
|
||||||
pkgNameSuffix = 'en.animepahe'
|
pkgNameSuffix = 'en.animepahe'
|
||||||
extClass = '.AnimePahe'
|
extClass = '.AnimePahe'
|
||||||
extVersionCode = 24
|
extVersionCode = 25
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@ import eu.kanade.tachiyomi.animesource.model.Video
|
|||||||
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
|
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import okhttp3.Headers
|
import okhttp3.Headers
|
||||||
@ -62,7 +65,14 @@ class AnimePahe : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
*/
|
*/
|
||||||
override fun animeDetailsRequest(anime: SAnime): Request {
|
override fun animeDetailsRequest(anime: SAnime): Request {
|
||||||
val animeId = anime.getId()
|
val animeId = anime.getId()
|
||||||
val session = fetchSession(anime.title, animeId)
|
// We're using coroutines here to run it inside another thread and
|
||||||
|
// prevent android.os.NetworkOnMainThreadException when trying to open
|
||||||
|
// webview or share it.
|
||||||
|
val session = runBlocking {
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
fetchSession(anime.title, animeId)
|
||||||
|
}
|
||||||
|
}
|
||||||
return GET("$baseUrl/anime/$session?anime_id=$animeId")
|
return GET("$baseUrl/anime/$session?anime_id=$animeId")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user