Skip to content
Snippets Groups Projects
Commit c5bf036e authored by Taras's avatar Taras
Browse files

Add timeline id to failure callback

parent c6f8c2b9
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,8 @@ interface Timeline { ...@@ -102,7 +102,8 @@ interface Timeline {
/** /**
* Called whenever an error we can't recover from occurred. * Called whenever an error we can't recover from occurred.
*/ */
fun onTimelineFailure(throwable: Throwable) = Unit // Added timelineId for circles
fun onTimelineFailure(timelineId: String, throwable: Throwable) = Unit
/** /**
* Called when new events come through the sync. * Called when new events come through the sync.
......
...@@ -273,8 +273,8 @@ internal class DefaultTimeline( ...@@ -273,8 +273,8 @@ internal class DefaultTimeline(
strategy = when { strategy = when {
rootThreadEventId != null -> buildStrategy(LoadTimelineStrategy.Mode.Thread(rootThreadEventId)) rootThreadEventId != null -> buildStrategy(LoadTimelineStrategy.Mode.Thread(rootThreadEventId))
eventId == null -> buildStrategy(LoadTimelineStrategy.Mode.Live) eventId == null -> buildStrategy(LoadTimelineStrategy.Mode.Live)
else -> buildStrategy(LoadTimelineStrategy.Mode.Permalink(eventId)) else -> buildStrategy(LoadTimelineStrategy.Mode.Permalink(eventId))
} }
rootThreadEventId?.let { rootThreadEventId?.let {
...@@ -361,7 +361,7 @@ internal class DefaultTimeline( ...@@ -361,7 +361,7 @@ internal class DefaultTimeline(
private fun updateState(direction: Timeline.Direction, update: (Timeline.PaginationState) -> Timeline.PaginationState) { private fun updateState(direction: Timeline.Direction, update: (Timeline.PaginationState) -> Timeline.PaginationState) {
val stateReference = when (direction) { val stateReference = when (direction) {
Timeline.Direction.FORWARDS -> forwardState Timeline.Direction.FORWARDS -> forwardState
Timeline.Direction.BACKWARDS -> backwardState Timeline.Direction.BACKWARDS -> backwardState
} }
val currentValue = stateReference.get() val currentValue = stateReference.get()
...@@ -384,7 +384,7 @@ internal class DefaultTimeline( ...@@ -384,7 +384,7 @@ internal class DefaultTimeline(
private fun onTimelineFailure(throwable: Throwable) { private fun onTimelineFailure(throwable: Throwable) {
timelineScope.launch(coroutineDispatchers.main) { timelineScope.launch(coroutineDispatchers.main) {
listeners.forEach { listeners.forEach {
tryOrNull { it.onTimelineFailure(throwable) } tryOrNull { it.onTimelineFailure(timelineID, throwable) }
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment