-
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 #9 from MaxAstin/dev
1.5.2
- Loading branch information
Showing
36 changed files
with
467 additions
and
76 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
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
1 change: 1 addition & 0 deletions
1
app/src/main/java/com/bunbeauty/fakelivestream/common/navigation/NavigationDestinations.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,6 +1,7 @@ | ||
package com.bunbeauty.fakelivestream.common.navigation | ||
|
||
object NavigationDestinations { | ||
const val INTRO = "intro" | ||
const val PREPARATION = "preparation" | ||
const val STREAM = "stream" | ||
} |
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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/bunbeauty/fakelivestream/common/util/ActivityExtensions.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,41 @@ | ||
package com.bunbeauty.fakelivestream.common.util | ||
|
||
import android.app.Activity | ||
import android.content.Intent | ||
import android.net.Uri | ||
import android.provider.Settings | ||
import com.google.android.play.core.review.ReviewManagerFactory | ||
|
||
fun Activity.launchInAppReview() { | ||
val reviewManager = ReviewManagerFactory.create(this) | ||
val request = reviewManager.requestReviewFlow() | ||
request.addOnCompleteListener { task -> | ||
if (task.isSuccessful) { | ||
reviewManager.launchReviewFlow(this, task.result) | ||
} | ||
} | ||
} | ||
|
||
fun Activity.openSettings() { | ||
startActivity( | ||
Intent().apply { | ||
action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS | ||
data = Uri.fromParts("package", packageName, null) | ||
} | ||
) | ||
} | ||
|
||
fun Activity.openSharing(text: String): Boolean { | ||
return try { | ||
val intent = Intent().apply { | ||
action = Intent.ACTION_SEND | ||
type = "text/plain" | ||
putExtra(Intent.EXTRA_TEXT, text) | ||
} | ||
val chooser = Intent.createChooser(intent, null) | ||
startActivity(chooser) | ||
true | ||
} catch (exception: Exception) { | ||
false | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
app/src/main/java/com/bunbeauty/fakelivestream/common/util/InAppReviewExtensions.kt
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
...c/main/java/com/bunbeauty/fakelivestream/features/intro/domain/CheckIsIntroSeenUseCase.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,14 @@ | ||
package com.bunbeauty.fakelivestream.features.intro.domain | ||
|
||
import com.bunbeauty.fakelivestream.common.domain.KeyValueStorage | ||
import javax.inject.Inject | ||
|
||
class CheckIsIntroViewedUseCase @Inject constructor( | ||
private val keyValueStorage: KeyValueStorage | ||
) { | ||
|
||
suspend operator fun invoke(): Boolean { | ||
return keyValueStorage.getIsIntroViewed( defaultValue = false) | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...rc/main/java/com/bunbeauty/fakelivestream/features/intro/domain/SaveIsIntroSeenUseCase.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,14 @@ | ||
package com.bunbeauty.fakelivestream.features.intro.domain | ||
|
||
import com.bunbeauty.fakelivestream.common.domain.KeyValueStorage | ||
import javax.inject.Inject | ||
|
||
class SaveIsIntroSeenUseCase @Inject constructor( | ||
private val keyValueStorage: KeyValueStorage | ||
) { | ||
|
||
suspend operator fun invoke(isIntroViewed: Boolean) { | ||
return keyValueStorage.saveIsIntroViewed(isIntroViewed = isIntroViewed) | ||
} | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/com/bunbeauty/fakelivestream/features/intro/presentation/Intro.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,18 @@ | ||
package com.bunbeauty.fakelivestream.features.intro.presentation | ||
|
||
import com.bunbeauty.fakelivestream.common.presentation.Base | ||
|
||
interface Intro { | ||
|
||
data class State( | ||
val isChecked: Boolean | ||
) : Base.State | ||
|
||
sealed interface Action : Base.Action { | ||
data object NextClick : Action | ||
} | ||
|
||
sealed interface Event : Base.Event { | ||
data object OpenPreparation : Event | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
app/src/main/java/com/bunbeauty/fakelivestream/features/intro/presentation/IntroViewModel.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,44 @@ | ||
package com.bunbeauty.fakelivestream.features.intro.presentation | ||
|
||
import androidx.lifecycle.viewModelScope | ||
import com.bunbeauty.fakelivestream.common.presentation.BaseViewModel | ||
import com.bunbeauty.fakelivestream.features.intro.domain.CheckIsIntroViewedUseCase | ||
import com.bunbeauty.fakelivestream.features.intro.domain.SaveIsIntroSeenUseCase | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class IntroViewModel @Inject constructor( | ||
private val checkIsIntroViewedUseCase: CheckIsIntroViewedUseCase, | ||
private val saveIsIntroSeenUseCase: SaveIsIntroSeenUseCase, | ||
) : BaseViewModel<Intro.State, Intro.Action, Intro.Event>( | ||
initState = { | ||
Intro.State(isChecked = false) | ||
} | ||
) { | ||
|
||
init { | ||
viewModelScope.launch { | ||
if (checkIsIntroViewedUseCase()) { | ||
sendEvent(Intro.Event.OpenPreparation) | ||
} else { | ||
setState { | ||
copy(isChecked = true) | ||
} | ||
} | ||
} | ||
} | ||
|
||
override fun onAction(action: Intro.Action) { | ||
when (action) { | ||
Intro.Action.NextClick -> { | ||
viewModelScope.launch { | ||
saveIsIntroSeenUseCase(isIntroViewed = true) | ||
sendEvent(Intro.Event.OpenPreparation) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.