mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Merge
This commit is contained in:
+7
@@ -11,6 +11,13 @@ package io.element.android.features.poll.api.actions
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
|
||||
/**
|
||||
* Closes a poll so no further answers are accepted, wrapping the timeline call so the analytics are captured in one place.
|
||||
*/
|
||||
interface EndPollAction {
|
||||
/**
|
||||
* @param timeline the timeline the poll lives in.
|
||||
* @param pollStartId the poll start event to close.
|
||||
*/
|
||||
suspend fun execute(timeline: Timeline, pollStartId: EventId): Result<Unit>
|
||||
}
|
||||
|
||||
+8
@@ -11,7 +11,15 @@ package io.element.android.features.poll.api.actions
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
|
||||
/**
|
||||
* Sends the current user's answer to a poll, wrapping the timeline call so the analytics are captured in one place.
|
||||
*/
|
||||
interface SendPollResponseAction {
|
||||
/**
|
||||
* @param timeline the timeline the poll lives in.
|
||||
* @param pollStartId the poll start event being answered.
|
||||
* @param answerId the id of the chosen answer.
|
||||
*/
|
||||
suspend fun execute(
|
||||
timeline: Timeline,
|
||||
pollStartId: EventId,
|
||||
|
||||
+16
@@ -12,7 +12,16 @@ import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.EventTimelineItem
|
||||
import io.element.android.libraries.matrix.api.timeline.item.event.PollContent
|
||||
|
||||
/**
|
||||
* Turns the poll content of a timeline event into the state the poll UI renders.
|
||||
*/
|
||||
interface PollContentStateFactory {
|
||||
/**
|
||||
* Convenience overload that reads the editability and ownership from the timeline item itself.
|
||||
*
|
||||
* @param eventTimelineItem the timeline item carrying the poll.
|
||||
* @param content the poll content of that item.
|
||||
*/
|
||||
suspend fun create(eventTimelineItem: EventTimelineItem, content: PollContent): PollContentState {
|
||||
return create(
|
||||
eventId = eventTimelineItem.eventId,
|
||||
@@ -21,5 +30,12 @@ interface PollContentStateFactory {
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eventId the poll start event, or `null` while the poll is still a local echo.
|
||||
* @param isEditable whether the current user may still edit the poll.
|
||||
* @param isOwn whether the poll was created by the current user.
|
||||
* @param content the poll question, answers and votes.
|
||||
*/
|
||||
suspend fun create(eventId: EventId?, isEditable: Boolean, isOwn: Boolean, content: PollContent): PollContentState
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<plurals name="a11y_polls_percent_of_total">
|
||||
<item quantity="zero">"%1$d بالمئة من إجمالي الأصوات"</item>
|
||||
<item quantity="one">"%1$d بالمئة من إجمالي الأصوات"</item>
|
||||
<item quantity="two">"%1$d بالمئة من إجمالي الأصوات"</item>
|
||||
<item quantity="few">"%1$d بالمئة من إجمالي الأصوات"</item>
|
||||
<item quantity="many">"%1$d بالمئة من إجمالي الأصوات"</item>
|
||||
<item quantity="other">"%1$d بالمئة من إجمالي الأصوات"</item>
|
||||
</plurals>
|
||||
<string name="a11y_polls_will_remove_selection">"ٍسيتم حذف الإختيار السابق"</string>
|
||||
<string name="a11y_polls_winning_answer">"هذه هي الإجابة الفائزة"</string>
|
||||
</resources>
|
||||
@@ -1,4 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<plurals name="a11y_polls_percent_of_total">
|
||||
<item quantity="one">"%1$d por ciento de todos los votos"</item>
|
||||
<item quantity="other">"%1$d por ciento de todos los votos"</item>
|
||||
</plurals>
|
||||
<string name="a11y_polls_will_remove_selection">"Eliminará la selección anterior"</string>
|
||||
<string name="a11y_polls_winning_answer">"Esta es la respuesta ganadora"</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<plurals name="a11y_polls_percent_of_total">
|
||||
<item quantity="one">"درصد %1$d از کل آرا"</item>
|
||||
<item quantity="other">"درصد %1$d از کل آرا"</item>
|
||||
</plurals>
|
||||
<string name="a11y_polls_will_remove_selection">"گزینش پیشین را برخواهد داشت"</string>
|
||||
<string name="a11y_polls_winning_answer">"این پاسخ برنده است"</string>
|
||||
</resources>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import io.element.android.libraries.matrix.api.poll.PollKind
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
class CreatePollStateProvider : PreviewParameterProvider<CreatePollState> {
|
||||
class CreatePollStatePreviewParam : PreviewParameterProvider<CreatePollState> {
|
||||
override val values: Sequence<CreatePollState>
|
||||
get() = sequenceOf(
|
||||
aCreatePollState(
|
||||
+1
-1
@@ -294,7 +294,7 @@ private fun MaxSelectionsStepper(
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun CreatePollViewPreview(
|
||||
@PreviewParameter(CreatePollStateProvider::class) state: CreatePollState
|
||||
@PreviewParameter(CreatePollStatePreviewParam::class) state: CreatePollState
|
||||
) = ElementPreview {
|
||||
CreatePollView(
|
||||
state = state,
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import io.element.android.features.poll.impl.history.model.PollHistoryItem
|
||||
import io.element.android.features.poll.impl.history.model.PollHistoryItems
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
|
||||
class PollHistoryStateProvider : PreviewParameterProvider<PollHistoryState> {
|
||||
class PollHistoryStatePreviewParam : PreviewParameterProvider<PollHistoryState> {
|
||||
override val values: Sequence<PollHistoryState>
|
||||
get() = sequenceOf(
|
||||
aPollHistoryState(),
|
||||
+1
-1
@@ -255,7 +255,7 @@ private fun PollHistoryItemRow(
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun PollHistoryViewPreview(
|
||||
@PreviewParameter(PollHistoryStateProvider::class) state: PollHistoryState
|
||||
@PreviewParameter(PollHistoryStatePreviewParam::class) state: PollHistoryState
|
||||
) = ElementPreview {
|
||||
PollHistoryView(
|
||||
state = state,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<string name="screen_create_poll_add_option_btn">"إضافة خيار"</string>
|
||||
<string name="screen_create_poll_anonymous_desc">"أظهر النتائج فقط حين انتهاء الاستفتاء"</string>
|
||||
<string name="screen_create_poll_anonymous_headline">"إخفاء الأصوات"</string>
|
||||
<string name="screen_create_poll_answer_hint">"الخيار %1$d"</string>
|
||||
<string name="screen_create_poll_cancel_confirmation_content_android">"لم تُحفظ تغييراتك. هل أنت متأكد من أنك تريد الرجوع؟"</string>
|
||||
<string name="screen_create_poll_delete_option_a11y">"حذف الخيار %1$s"</string>
|
||||
<string name="screen_create_poll_question_desc">"السؤال أو الموضوع"</string>
|
||||
<string name="screen_create_poll_question_hint">"عن ماذا يدور هذا الاستفتاء؟"</string>
|
||||
<string name="screen_create_poll_title">"إنشاء استفتاء"</string>
|
||||
<string name="screen_edit_poll_delete_confirmation">"هل أنت متأكد من رغبتك في حذف هذا الاستطلاع؟"</string>
|
||||
<string name="screen_edit_poll_delete_confirmation_title">"حذف الاستطلاع"</string>
|
||||
<string name="screen_edit_poll_title">"تعديل الاستفتاء"</string>
|
||||
<string name="screen_polls_history_empty_ongoing">"تعذّر العثور على أي استطلاعات جارية."</string>
|
||||
<string name="screen_polls_history_empty_past">"تعذّر العثور على أي استطلاعات مغلقة."</string>
|
||||
<string name="screen_polls_history_filter_ongoing">"جارية"</string>
|
||||
<string name="screen_polls_history_filter_past">"مغلقة"</string>
|
||||
<string name="screen_polls_history_title">"الاستطلاعات"</string>
|
||||
</resources>
|
||||
@@ -5,6 +5,7 @@
|
||||
<string name="screen_create_poll_anonymous_headline">"نهفتن رأیها"</string>
|
||||
<string name="screen_create_poll_answer_hint">"گزینهٔ %1$d"</string>
|
||||
<string name="screen_create_poll_cancel_confirmation_content_android">"تغییراتتان ذخیره نشدهاند. مطمئنید که میخواهید برگردید؟"</string>
|
||||
<string name="screen_create_poll_delete_option_a11y">"حذف گزینه %1$s"</string>
|
||||
<string name="screen_create_poll_question_desc">"پرسش یا موضوع"</string>
|
||||
<string name="screen_create_poll_question_hint">"این نظرسنجی دربارهٔ چیست؟"</string>
|
||||
<string name="screen_create_poll_title">"ایجاد نظرسنجی"</string>
|
||||
|
||||
Reference in New Issue
Block a user