mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-12 17:57:29 +00:00
do not mark as seen more than once
This commit is contained in:
parent
c82080acf4
commit
525cf37907
@ -473,7 +473,9 @@ class StoryFragmentViewModel : ViewModel() {
|
||||
fun markAsSeen(storyMedia: StoryMedia): LiveData<Resource<Story?>> {
|
||||
val data = MutableLiveData<Resource<Story?>>()
|
||||
data.postValue(loading(null))
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val oldStory = currentStory.value!!
|
||||
if (oldStory.seen != null && oldStory.seen >= storyMedia.takenAt) data.postValue(success(null))
|
||||
else viewModelScope.launch(Dispatchers.IO) {
|
||||
try {
|
||||
storiesRepository.seen(
|
||||
csrfToken!!,
|
||||
@ -483,7 +485,6 @@ class StoryFragmentViewModel : ViewModel() {
|
||||
storyMedia.takenAt,
|
||||
System.currentTimeMillis() / 1000
|
||||
)
|
||||
val oldStory = currentStory.value!!
|
||||
val newStory = oldStory.copy(seen = storyMedia.takenAt)
|
||||
data.postValue(success(newStory))
|
||||
} catch (e: Exception) {
|
||||
|
Loading…
Reference in New Issue
Block a user