Pinned events: add unpin action
This commit is contained in:
parent
6cf64b263e
commit
97cf00ec96
3 changed files with 11 additions and 0 deletions
|
|
@ -281,6 +281,7 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
TimelineItemAction.ReportContent -> handleReportAction(targetEvent)
|
||||
TimelineItemAction.EndPoll -> handleEndPollAction(targetEvent, timelineState)
|
||||
TimelineItemAction.Pin -> handlePinAction(targetEvent)
|
||||
TimelineItemAction.Unpin -> handleUnpinAction(targetEvent)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,6 +292,13 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun handleUnpinAction(targetEvent: TimelineItem.Event) {
|
||||
if (targetEvent.eventId == null) return
|
||||
timelineController.invokeOnCurrentTimeline {
|
||||
unpinEvent(targetEvent.eventId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun CoroutineScope.toggleReaction(
|
||||
emoji: String,
|
||||
eventId: EventId,
|
||||
|
|
|
|||
|
|
@ -40,4 +40,6 @@ sealed class TimelineItemAction(
|
|||
data object ReportContent : TimelineItemAction(CommonStrings.action_report_content, CompoundDrawables.ic_compound_chat_problem, destructive = true)
|
||||
data object EndPoll : TimelineItemAction(CommonStrings.action_end_poll, CompoundDrawables.ic_compound_polls_end)
|
||||
data object Pin : TimelineItemAction(CommonStrings.action_pin, CompoundDrawables.ic_compound_pin)
|
||||
//TODO use the Unpin compound icon when available.
|
||||
data object Unpin : TimelineItemAction(CommonStrings.action_unpin, CompoundDrawables.ic_compound_pin)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@
|
|||
<string name="action_take_photo">"Take photo"</string>
|
||||
<string name="action_tap_for_options">"Tap for options"</string>
|
||||
<string name="action_try_again">"Try again"</string>
|
||||
<string name="action_unpin">"Unpin"</string>
|
||||
<string name="action_view_source">"View source"</string>
|
||||
<string name="action_yes">"Yes"</string>
|
||||
<string name="common_about">"About"</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue