diff --git a/clients/android/app/build.gradle.kts b/clients/android/app/build.gradle.kts index 16ba821..962fee2 100644 --- a/clients/android/app/build.gradle.kts +++ b/clients/android/app/build.gradle.kts @@ -14,8 +14,8 @@ android { applicationId = "network.uwu.radio" minSdk = 21 targetSdk = 33 - versionCode = 100 - versionName = "1.0.0" + versionCode = 110 + versionName = "1.1.0" vectorDrawables { useSupportLibrary = true diff --git a/clients/android/app/src/main/java/network/uwu/radio/di/Client.kt b/clients/android/app/src/main/java/network/uwu/radio/di/Client.kt index 1416fe9..706f365 100644 --- a/clients/android/app/src/main/java/network/uwu/radio/di/Client.kt +++ b/clients/android/app/src/main/java/network/uwu/radio/di/Client.kt @@ -8,8 +8,6 @@ import io.ktor.client.plugins.logging.* import io.ktor.serialization.kotlinx.json.* import kotlinx.serialization.json.Json import network.uwu.radio.BuildConfig -import network.uwu.radio.network.service.UwuRadioApiService -import network.uwu.radio.network.service.UwuRadioApiServiceImpl import network.uwu.radio.network.service.UwuRadioSyncService import network.uwu.radio.network.service.UwuRadioSyncServiceImpl import org.koin.core.module.dsl.singleOf @@ -35,5 +33,4 @@ val clientModule = module { } } singleOf(::UwuRadioSyncServiceImpl) bind UwuRadioSyncService::class - singleOf(::UwuRadioApiServiceImpl) bind UwuRadioApiService::class } diff --git a/clients/android/app/src/main/java/network/uwu/radio/domain/repository/SessionRepository.kt b/clients/android/app/src/main/java/network/uwu/radio/domain/repository/SessionRepository.kt index bf3edd4..80f17cc 100644 --- a/clients/android/app/src/main/java/network/uwu/radio/domain/repository/SessionRepository.kt +++ b/clients/android/app/src/main/java/network/uwu/radio/domain/repository/SessionRepository.kt @@ -5,7 +5,6 @@ import kotlinx.coroutines.flow.map import network.uwu.radio.domain.model.DomainSongData import network.uwu.radio.network.dto.ApiSong import network.uwu.radio.network.service.ClientState -import network.uwu.radio.network.service.UwuRadioApiService import network.uwu.radio.network.service.UwuRadioSyncService interface SessionRepository { @@ -13,9 +12,7 @@ interface SessionRepository { suspend fun connectSyncClient() suspend fun requestData() - - suspend fun getRandomQuote(submitter: String): String? - + fun observeSyncClientState(): Flow fun observeProgressbar(): Flow @@ -26,7 +23,6 @@ interface SessionRepository { class SessionRepositoryImpl( private val uwuRadioSyncService: UwuRadioSyncService, - private val uwuRadioApiService: UwuRadioApiService ) : SessionRepository { override suspend fun connectSyncClient() { @@ -61,21 +57,14 @@ class SessionRepositoryImpl( } } - override suspend fun getRandomQuote(submitter: String): String? { - return uwuRadioApiService.getSubmitters() - .find { it.name == submitter } - ?.quotes - ?.randomOrNull() - } - - private suspend fun ApiSong.toDomain(startTime: Long = 0L): DomainSongData { + private fun ApiSong.toDomain(startTime: Long = 0L): DomainSongData { return DomainSongData( songName = name, songArtist = artist, songArtworkUrl = artUrl, - songUrl = dlUrl!!, + songUrl = dlUrl, submitterName = submitter, - submitterQuote = getRandomQuote(submitter), + submitterQuote = quote, startTime = startTime ) } diff --git a/clients/android/app/src/main/java/network/uwu/radio/network/dto/Song.kt b/clients/android/app/src/main/java/network/uwu/radio/network/dto/Song.kt index 7e33f80..d734eff 100644 --- a/clients/android/app/src/main/java/network/uwu/radio/network/dto/Song.kt +++ b/clients/android/app/src/main/java/network/uwu/radio/network/dto/Song.kt @@ -3,9 +3,10 @@ package network.uwu.radio.network.dto data class ApiSong( val name: String, val artist: String, - val dlUrl: String?, - val sourceUrl: String?, + val dlUrl: String, + val sourceUrl: String, val artUrl: String?, val album: String?, val submitter: String, + val quote: String?, ) diff --git a/clients/android/app/src/main/java/network/uwu/radio/network/service/UwuRadioApiService.kt b/clients/android/app/src/main/java/network/uwu/radio/network/service/UwuRadioApiService.kt deleted file mode 100644 index b91ceb9..0000000 --- a/clients/android/app/src/main/java/network/uwu/radio/network/service/UwuRadioApiService.kt +++ /dev/null @@ -1,40 +0,0 @@ -package network.uwu.radio.network.service - -import io.ktor.client.* -import io.ktor.client.call.* -import io.ktor.client.request.* -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.withContext -import network.uwu.radio.network.dto.ApiSubmitter -import network.uwu.radio.network.dto.ApiSubmitters - -interface UwuRadioApiService { - - suspend fun getSubmitters(): List - -} - -class UwuRadioApiServiceImpl( - private val client: HttpClient -) : UwuRadioApiService { - - private val submitters = mutableListOf() - - override suspend fun getSubmitters(): List { - return withContext(Dispatchers.IO) { - submitters.ifEmpty { - val apiSubmitters = client.get(getDataUrl()).body().submitters - submitters.addAll(apiSubmitters) - apiSubmitters - } - } - } - - companion object { - private const val BASE_URL = "https://radio.k6.tf/api" - - fun getDataUrl(): String { - return "$BASE_URL/data" - } - } -}