Changed PupilHttpClient.downloadApk to receive url instead of RemoteSourceInfo

This commit is contained in:
tom5079
2022-05-02 16:48:57 +09:00
parent a183ff803d
commit de068a760e

View File

@@ -83,6 +83,10 @@ private val sourceSelectorScreens = listOf(
SourceSelectorScreen.Explore SourceSelectorScreen.Explore
) )
private val RemoteSourceInfo.apkUrl: String
get() = "https://github.com/tom5079/PupilSources/releases/download/$name-$version/$projectName-release.apk"
class DownloadApkActionState(override val di: DI) : DIAware { class DownloadApkActionState(override val di: DI) : DIAware {
private val app: Application by instance() private val app: Application by instance()
private val client: PupilHttpClient by instance() private val client: PupilHttpClient by instance()
@@ -97,7 +101,7 @@ class DownloadApkActionState(override val di: DI) : DIAware {
it.parentFile?.mkdirs() it.parentFile?.mkdirs()
} }
client.downloadApk(sourceInfo, file).collect { progress = it } client.downloadApk(sourceInfo.apkUrl, file).collect { progress = it }
require(progress == Float.POSITIVE_INFINITY) require(progress == Float.POSITIVE_INFINITY)