-
Notifications
You must be signed in to change notification settings - Fork 304
[TV] Episode actions & details analytics #5741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,9 @@ import androidx.lifecycle.viewModelScope | |
| import au.com.shiftyjelly.pocketcasts.repositories.podcast.PodcastManager | ||
| import au.com.shiftyjelly.pocketcasts.repositories.shownotes.ShowNotesManager | ||
| import au.com.shiftyjelly.pocketcasts.servers.shownotes.ShowNotesState | ||
| import com.automattic.eventhorizon.EpisodeDetailShownEvent | ||
| import com.automattic.eventhorizon.EpisodeViewSourceType | ||
| import com.automattic.eventhorizon.EventHorizon | ||
| import dagger.hilt.android.lifecycle.HiltViewModel | ||
| import javax.inject.Inject | ||
| import kotlinx.coroutines.flow.MutableStateFlow | ||
|
|
@@ -17,12 +20,17 @@ import kotlinx.coroutines.launch | |
| class TvEpisodeInfoViewModel @Inject constructor( | ||
| private val podcastManager: PodcastManager, | ||
| private val showNotesManager: ShowNotesManager, | ||
| private val eventHorizon: EventHorizon, | ||
| ) : ViewModel() { | ||
| private val _uiState = MutableStateFlow<UiState?>(null) | ||
| val uiState: StateFlow<UiState?> = _uiState.asStateFlow() | ||
|
|
||
| private var loadedEpisodeUuid: String? = null | ||
|
|
||
| fun trackDetailShown(source: EpisodeViewSourceType) { | ||
| eventHorizon.track(EpisodeDetailShownEvent(source = source)) | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two things worth comparing against the existing mobile implementation of this same event, override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (!viewModel.isFragmentChangingConfigurations) {
eventHorizon.track(EpisodeDetailShownEvent(source = episodeViewSource.analyticsValue))
}
}
override fun onDestroyView() {
...
if (!viewModel.isFragmentChangingConfigurations) {
eventHorizon.track(EpisodeDetailDismissedEvent(source = episodeViewSource.analyticsValue))
}
|
||
|
|
||
| fun load(podcastUuid: String, episodeUuid: String) { | ||
| if (episodeUuid == loadedEpisodeUuid) { | ||
| return | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.