-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from MaxAstin/dev
1.6.0
- Loading branch information
Showing
25 changed files
with
1,218 additions
and
389 deletions.
There are no files selected for viewing
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
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
42 changes: 42 additions & 0 deletions
42
...m/bunbeauty/fakelivestream/common/ui/components/bottomsheet/FakeLiveBottomSheetContent.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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.bunbeauty.fakelivestream.common.ui.components.bottomsheet | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Divider | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import com.bunbeauty.fakelivestream.common.ui.theme.FakeLiveStreamTheme | ||
|
||
@Composable | ||
fun ColumnScope.FakeLiveBottomSheetContent( | ||
@StringRes titleResId: Int, | ||
content: @Composable () -> Unit | ||
) { | ||
Text( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding( | ||
top = 16.dp, | ||
bottom = 12.dp | ||
), | ||
text = stringResource(titleResId), | ||
color = FakeLiveStreamTheme.colors.onSurface, | ||
style = FakeLiveStreamTheme.typography.titleMedium, | ||
textAlign = TextAlign.Center | ||
) | ||
Divider( | ||
modifier = Modifier.fillMaxWidth(), | ||
thickness = 0.5.dp, | ||
color = FakeLiveStreamTheme.colors.border | ||
) | ||
Column(modifier = Modifier.padding(horizontal = 16.dp)) { | ||
content() | ||
} | ||
} |
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
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
16 changes: 16 additions & 0 deletions
16
.../main/java/com/bunbeauty/fakelivestream/features/stream/domain/GetCommentsDelayUseCase.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.bunbeauty.fakelivestream.features.stream.domain | ||
|
||
import javax.inject.Inject | ||
import kotlin.random.Random | ||
|
||
class GetCommentsDelayUseCase @Inject constructor() { | ||
|
||
operator fun invoke(viewersCount: Int): Long { | ||
return if (viewersCount < 1000) { | ||
Random.nextLong(1_000, 2_000) | ||
} else { | ||
Random.nextLong(500, 1_000) | ||
} | ||
} | ||
|
||
} |
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
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/bunbeauty/fakelivestream/features/stream/domain/GetQuestionUseCase.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.bunbeauty.fakelivestream.features.stream.domain | ||
|
||
import com.bunbeauty.fakelivestream.features.stream.data.user.UserRepository | ||
import com.bunbeauty.fakelivestream.features.stream.domain.model.Question | ||
import java.util.UUID | ||
import javax.inject.Inject | ||
|
||
private const val QUESTION_LIMIT = 3 | ||
|
||
class GetQuestionUseCase @Inject constructor( | ||
private val userRepository: UserRepository, | ||
private val getRandomCommentText: GetRandomCommentTextUseCase, | ||
private val getRandomUsernameUseCase: GetRandomUsernameUseCase, | ||
) { | ||
|
||
operator fun invoke(questionCount: Int): Question? { | ||
if (questionCount >= QUESTION_LIMIT) { | ||
return null | ||
} | ||
|
||
return Question( | ||
uuid = UUID.randomUUID().toString(), | ||
picture = userRepository.getQuestionPictureName(), | ||
username = getRandomUsernameUseCase(), | ||
text = getRandomCommentText(type = CommentType.QUESTION), | ||
) | ||
} | ||
|
||
} |
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
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/bunbeauty/fakelivestream/features/stream/domain/model/Question.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.bunbeauty.fakelivestream.features.stream.domain.model | ||
|
||
data class Question( | ||
val uuid: String, | ||
val picture: String?, | ||
val username: String, | ||
val text: String, | ||
) |
Oops, something went wrong.