-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #87
- Loading branch information
Showing
4 changed files
with
12 additions
and
6 deletions.
There are no files selected for viewing
9 changes: 7 additions & 2 deletions
9
app/src/main/java/ru/stersh/youamp/main/data/ServerExistRepositoryImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
package ru.stersh.youamp.main.data | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.map | ||
import ru.stersh.youamp.core.room.server.SubsonicServerDao | ||
import ru.stersh.youamp.main.domain.ServerExistRepository | ||
|
||
internal class ServerExistRepositoryImpl(private val serverDao: SubsonicServerDao) : | ||
ServerExistRepository { | ||
override suspend fun hasServer(): Boolean { | ||
return serverDao.getCount() > 0 | ||
|
||
override suspend fun hasServer(): Flow<Boolean> { | ||
return serverDao | ||
.flowActive() | ||
.map { it != null } | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
app/src/main/java/ru/stersh/youamp/main/domain/ServerExistRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package ru.stersh.youamp.main.domain | ||
|
||
import kotlinx.coroutines.flow.Flow | ||
|
||
internal interface ServerExistRepository { | ||
suspend fun hasServer(): Boolean | ||
suspend fun hasServer(): Flow<Boolean> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters