feat: auth screen with auto-redirect, sync favorites/history with backend

This commit is contained in:
nk
2026-06-02 19:12:07 +03:00
parent d4adb1e7be
commit a83672b455
2934 changed files with 97351 additions and 163 deletions

View File

@@ -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()
}

View File

@@ -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>)

View File

@@ -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>
}

View File

@@ -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)
}

View File

@@ -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>>
}

View File

@@ -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>>
}