Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import java.util.UUID
/**
* Represents the status of the most recently used server
*
* This can be read/written to shared preferences
* This can be saved/retrieved from a [MostRecentServerProvider]
*/
sealed interface MostRecentServer {
/**
Expand Down Expand Up @@ -58,12 +58,12 @@ sealed interface MostRecentServer {

interface MostRecentServerProvider {
/**
* Get the [MostRecentServer] from the shared preferences in [context]
* Get the [MostRecentServer] from this provider
*/
fun get(): MostRecentServer

/**
* Save the [CurrentUser] as the most recent server into the shared preferences in [context]
* Save the [CurrentUser] as the most recent server
*/
suspend fun save(current: CurrentUser)

Expand All @@ -86,9 +86,6 @@ class MostRecentServerSharedPreferences(
) : MostRecentServerProvider {
private val prefs = getServerSharedPreferences(context)

/**
* Get the [MostRecentServer] from the shared preferences in [context]
*/
override fun get(): MostRecentServer {
val serverId = prefs.getString(SERVER_ID_KEY, null)?.toUUIDOrNull()
val serverUrl = prefs.getString(SERVER_URL_KEY, null)
Expand All @@ -103,9 +100,6 @@ class MostRecentServerSharedPreferences(
}
}

/**
* Save the [CurrentUser] as the most recent server into the shared preferences in [context]
*/
override suspend fun save(current: CurrentUser) {
prefs.edit(true) {
putString(SERVER_ID_KEY, current.server.id.toServerString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ val requestSerializersModule =
subclass(GetStudiosRequest::class)
subclass(GetRecordingsRequest::class)
subclass(GetLiveTvChannelsRequest::class)
subclass(GetArtistsHandler::class)
subclass(GetAlbumArtistsHandler::class)
subclass(GetArtistsRequest::class)
subclass(GetAlbumArtistsRequest::class)
}
}
Loading