Skip to content

Commit

Permalink
Add logging around next/previous moves for story viewer.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal authored and greyson-signal committed Apr 13, 2023
1 parent d3e83b1 commit 94b308c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ class StoryViewerPageFragment :
progressBar.listener = object : SegmentedProgressBarListener {
override fun onPage(oldPageIndex: Int, newPageIndex: Int) {
if (oldPageIndex != newPageIndex && context != null) {
Log.d(TAG, "onPage: Moving from $oldPageIndex to $newPageIndex")
viewModel.setSelectedPostIndex(newPageIndex)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.kotlin.plusAssign
import io.reactivex.rxjava3.subjects.PublishSubject
import io.reactivex.rxjava3.subjects.Subject
import org.signal.core.util.logging.Log
import org.thoughtcrime.securesms.attachments.Attachment
import org.thoughtcrime.securesms.database.AttachmentTable
import org.thoughtcrime.securesms.recipients.RecipientId
Expand All @@ -31,6 +32,10 @@ class StoryViewerPageViewModel(
val storyCache: StoryCache
) : ViewModel() {

companion object {
private val TAG = Log.tag(StoryViewerPageViewModel::class.java)
}

private val store = RxStore(StoryViewerPageState(isReceiptsEnabled = repository.isReadReceiptsEnabled()))
private val disposables = CompositeDisposable()
private val storyViewerDialogSubject: Subject<Optional<StoryViewerDialog>> = PublishSubject.create()
Expand Down Expand Up @@ -136,6 +141,8 @@ class StoryViewerPageViewModel(
return
}

Log.d(TAG, "goToNextPost: Moving to the next post.")

val postIndex = store.state.selectedPostIndex

val nextUnreadPost: StoryPost? = getNextUnreadPost(store.state.posts.drop(postIndex + 1))
Expand All @@ -151,6 +158,8 @@ class StoryViewerPageViewModel(
return
}

Log.d(TAG, "goToPreviousPost: Moving to the previous post")

val postIndex = store.state.selectedPostIndex
val minIndex = if (store.state.isFirstPage) 0 else -1

Expand Down

0 comments on commit 94b308c

Please sign in to comment.