-
Notifications
You must be signed in to change notification settings - Fork 11
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 #361 from stakwork/tt/feature/feed-content-last-date
Content seen date logic
- Loading branch information
Showing
18 changed files
with
106 additions
and
14 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
4 changes: 2 additions & 2 deletions
4
...pt-repository-media/src/main/java/chat/sphinx/concept_repository_media/RepositoryMedia.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
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
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
26 changes: 25 additions & 1 deletion
26
...creens-detail/web-view/web-view/src/main/java/chat/sphinx/web_view/ui/WebViewViewModel.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,15 +1,39 @@ | ||
package chat.sphinx.web_view.ui | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import androidx.lifecycle.viewModelScope | ||
import chat.sphinx.concept_repository_chat.ChatRepository | ||
import chat.sphinx.web_view.navigation.WebViewNavigator | ||
import chat.sphinx.wrapper_common.dashboard.ChatId | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import io.matthewnelson.android_feature_navigation.util.navArgs | ||
import io.matthewnelson.android_feature_viewmodel.BaseViewModel | ||
import io.matthewnelson.concept_coroutines.CoroutineDispatchers | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
internal inline val WebViewFragmentArgs.chatId: ChatId? | ||
get() = if (argChatId == ChatId.NULL_CHAT_ID.toLong()) { | ||
null | ||
} else { | ||
ChatId(argChatId) | ||
} | ||
|
||
@HiltViewModel | ||
internal class WebViewViewModel @Inject constructor( | ||
savedStateHandle: SavedStateHandle, | ||
dispatchers: CoroutineDispatchers, | ||
val navigator: WebViewNavigator | ||
val navigator: WebViewNavigator, | ||
private val chatRepository: ChatRepository, | ||
): BaseViewModel<WebViewViewState>(dispatchers, WebViewViewState.Idle) | ||
{ | ||
private val args: WebViewFragmentArgs by savedStateHandle.navArgs() | ||
|
||
init { | ||
args.chatId?.let { chatId -> | ||
viewModelScope.launch(mainImmediate) { | ||
chatRepository.updateChatContentSeenAt(chatId) | ||
} | ||
} | ||
} | ||
} |
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
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