feat: auth screen with auto-redirect, sync favorites/history with backend
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.radiola.domain.repository
|
||||
|
||||
import com.radiola.domain.model.User
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface AuthRepository {
|
||||
suspend fun requestMagicLink(email: String): Result<Unit>
|
||||
suspend fun verifyMagicLink(email: String, code: String): Result<User>
|
||||
fun isLoggedIn(): Flow<Boolean>
|
||||
fun currentUser(): Flow<User?>
|
||||
suspend fun logout()
|
||||
}
|
||||
@@ -5,7 +5,9 @@ import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface FavoritesRepository {
|
||||
fun getFavorites(): Flow<List<Station>>
|
||||
fun getFavoriteIds(): Flow<Set<Int>>
|
||||
suspend fun addFavorite(station: Station)
|
||||
suspend fun addFavorite(stationId: Int)
|
||||
suspend fun removeFavorite(stationId: Int)
|
||||
fun isFavorite(stationId: Int): Flow<Boolean>
|
||||
suspend fun reorderFavorites(orderedIds: List<Int>)
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.radiola.domain.model.Track
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface NowPlayingRepository {
|
||||
fun getNowPlaying(stationPrefix: String): Flow<Track?>
|
||||
fun getAllNowPlaying(): Flow<Map<String, Track>>
|
||||
fun getNowPlaying(stationId: Int): Flow<Track?>
|
||||
fun getAllNowPlaying(): Flow<Map<Int, Track>>
|
||||
suspend fun refreshNowPlaying(): Result<Unit>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.radiola.domain.repository
|
||||
|
||||
import com.radiola.domain.model.Recording
|
||||
import com.radiola.domain.model.Station
|
||||
import com.radiola.domain.model.Track
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface RecordingRepository {
|
||||
val isRecording: StateFlow<Boolean>
|
||||
fun getRecordings(): Flow<List<Recording>>
|
||||
suspend fun startRecording(station: Station, track: Track?)
|
||||
suspend fun stopRecording()
|
||||
suspend fun deleteRecording(id: Long)
|
||||
}
|
||||
@@ -7,4 +7,5 @@ interface StationRepository {
|
||||
fun getStations(): Flow<List<Station>>
|
||||
suspend fun refreshStations(): Result<Unit>
|
||||
fun getStationById(id: Int): Flow<Station?>
|
||||
fun getTags(): Flow<List<String>>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.radiola.domain.repository
|
||||
|
||||
import com.radiola.domain.model.Station
|
||||
|
||||
interface SyncRepository {
|
||||
suspend fun pushFavorite(stationId: Int): Result<Unit>
|
||||
suspend fun removeFavorite(stationId: Int): Result<Unit>
|
||||
suspend fun pushHistory(stationId: Int): Result<Unit>
|
||||
suspend fun fetchRemoteFavorites(): Result<List<Int>>
|
||||
suspend fun fetchRemoteHistory(): Result<List<Int>>
|
||||
}
|
||||
Reference in New Issue
Block a user