mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Pinned events: add unpin action
This commit is contained in:
+8
@@ -281,6 +281,7 @@ class MessagesPresenter @AssistedInject constructor(
|
|||||||
TimelineItemAction.ReportContent -> handleReportAction(targetEvent)
|
TimelineItemAction.ReportContent -> handleReportAction(targetEvent)
|
||||||
TimelineItemAction.EndPoll -> handleEndPollAction(targetEvent, timelineState)
|
TimelineItemAction.EndPoll -> handleEndPollAction(targetEvent, timelineState)
|
||||||
TimelineItemAction.Pin -> handlePinAction(targetEvent)
|
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(
|
private fun CoroutineScope.toggleReaction(
|
||||||
emoji: String,
|
emoji: String,
|
||||||
eventId: EventId,
|
eventId: EventId,
|
||||||
|
|||||||
+2
@@ -40,4 +40,6 @@ sealed class TimelineItemAction(
|
|||||||
data object ReportContent : TimelineItemAction(CommonStrings.action_report_content, CompoundDrawables.ic_compound_chat_problem, destructive = true)
|
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 EndPoll : TimelineItemAction(CommonStrings.action_end_poll, CompoundDrawables.ic_compound_polls_end)
|
||||||
data object Pin : TimelineItemAction(CommonStrings.action_pin, CompoundDrawables.ic_compound_pin)
|
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_take_photo">"Take photo"</string>
|
||||||
<string name="action_tap_for_options">"Tap for options"</string>
|
<string name="action_tap_for_options">"Tap for options"</string>
|
||||||
<string name="action_try_again">"Try again"</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_view_source">"View source"</string>
|
||||||
<string name="action_yes">"Yes"</string>
|
<string name="action_yes">"Yes"</string>
|
||||||
<string name="common_about">"About"</string>
|
<string name="common_about">"About"</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user