SoundCloud Fixes

This commit is contained in:
Shabinder Singh 2021-10-13 01:00:03 +05:30
parent 33fef3dbd6
commit 9554a8fdcb
5 changed files with 7 additions and 7 deletions

View File

@ -250,6 +250,7 @@ class MainActivity : ComponentActivity() {
if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT
).show() ).show()
} }
Log.i("Toasting",string)
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")

View File

@ -4,6 +4,7 @@ import com.shabinder.common.models.AudioFormat
import com.shabinder.common.models.soundcloud.Media import com.shabinder.common.models.soundcloud.Media
import com.shabinder.common.models.soundcloud.PublisherMetadata import com.shabinder.common.models.soundcloud.PublisherMetadata
import com.shabinder.common.models.soundcloud.User import com.shabinder.common.models.soundcloud.User
import com.shabinder.common.models.soundcloud.Visuals
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonClassDiscriminator import kotlinx.serialization.json.JsonClassDiscriminator
@ -149,7 +150,7 @@ sealed class SoundCloudResolveResponseBase {
val user: User = User(), val user: User = User(),
@SerialName("user_id") @SerialName("user_id")
val userId: Int = 0, val userId: Int = 0,
val visuals: String = "", val visuals: Visuals? = null,
@SerialName("waveform_url") @SerialName("waveform_url")
val waveformUrl: String = "" val waveformUrl: String = ""
) : SoundCloudResolveResponseBase() { ) : SoundCloudResolveResponseBase() {

View File

@ -1,7 +1,5 @@
package com.shabinder.common.di package com.shabinder.common.di
import com.shabinder.common.core_components.analytics.AnalyticsEvent
import com.shabinder.common.core_components.analytics.AnalyticsManager
import com.shabinder.common.models.dispatcherIO import com.shabinder.common.models.dispatcherIO
import com.shabinder.common.providers.spotify.SpotifyProvider import com.shabinder.common.providers.spotify.SpotifyProvider
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.DelicateCoroutinesApi

View File

@ -61,8 +61,6 @@ class FetchPlatformQueryResult(
private val db: DownloadRecordDatabaseQueries? private val db: DownloadRecordDatabaseQueries?
get() = fileManager.db?.downloadRecordDatabaseQueries get() = fileManager.db?.downloadRecordDatabaseQueries
suspend fun authenticateSpotifyClient() = spotifyProvider.authenticateSpotifyClient()
suspend fun query(link: String): SuspendableEvent<PlatformQueryResult, Throwable> { suspend fun query(link: String): SuspendableEvent<PlatformQueryResult, Throwable> {
val result = when { val result = when {
// SPOTIFY // SPOTIFY

View File

@ -46,7 +46,8 @@ class SoundCloudProvider(
folderType = "Playlists" folderType = "Playlists"
subFolder = response.title subFolder = response.title
trackList = response.tracks.toTrackDetailsList(folderType, subFolder) trackList = response.tracks.toTrackDetailsList(folderType, subFolder)
coverUrl = response.artworkUrl.ifBlank { response.calculatedArtworkUrl } coverUrl = response.artworkUrl.formatArtworkUrl()
.ifBlank { response.calculatedArtworkUrl.formatArtworkUrl() }
title = response.title title = response.title
} }
} }
@ -110,6 +111,7 @@ class SoundCloudProvider(
} }
private fun String.formatArtworkUrl(): String { private fun String.formatArtworkUrl(): String {
return substringBeforeLast("-") + "-t500x500." + substringAfterLast(".") return if (isBlank()) ""
else substringBeforeLast("-") + "-t500x500." + substringAfterLast(".")
} }
} }