Skip to content

Commit fcfce9d

Browse files
committed
Distinct tips to avoid opening the intro screen twice
1 parent 12ad7e7 commit fcfce9d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

presentation/src/main/java/xyz/aprildown/timer/presentation/timer/TimerViewModel.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import androidx.lifecycle.LiveData
55
import androidx.lifecycle.MutableLiveData
66
import androidx.lifecycle.asFlow
77
import androidx.lifecycle.asLiveData
8+
import androidx.lifecycle.distinctUntilChanged
89
import androidx.lifecycle.switchMap
910
import androidx.lifecycle.viewModelScope
1011
import com.github.deweyreed.tools.arch.Event
@@ -90,7 +91,8 @@ class TimerViewModel @Inject constructor(
9091
private val _shareStringEvent = MutableLiveData<Event<Fruit<String>>>()
9192
val shareStringEvent: LiveData<Event<Fruit<String>>> = _shareStringEvent
9293

93-
val tips: LiveData<Int> = tipManager.getTipFlow(this).asLiveData()
94+
val tips: LiveData<Int> = tipManager.getTipFlow(this)
95+
.asLiveData().distinctUntilChanged()
9496

9597
init {
9698
launch {

0 commit comments

Comments
 (0)