1
0
mirror of https://github.com/vector-im/riotX-android synced 2025-10-05 15:52:47 +02:00

Merge branch 'release/1.6.32' into main

This commit is contained in:
Benoit Marty
2025-02-18 10:49:15 +01:00
50 changed files with 279 additions and 4 deletions

View File

@@ -1,3 +1,11 @@
Changes in Element v1.6.32 (2025-02-18)
=======================================
Other changes
-------------
- Add action to report room. ([#8998](https://github.com/element-hq/element-android/issues/8998))
Changes in Element v1.6.30 (2025-02-04)
=======================================

View File

@@ -0,0 +1,2 @@
Hlavní změny v této verzi: Přesměrování uživatele na Element X, když chce vytvořit účty na serveru s podporou MAS.
Úplný seznam změn: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Hlavní změny v této verzi: Oprava pádu příchozího hovoru na Androidu 14+.
Úplný seznam změn: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Main changes in this version: Add action to report room.
Full changelog: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Principales cambios en esta versión: mejora del rendimiento y corrección de errores.
Registro de cambios completo: https://github.com/element-hq/element-android/releases/tag/v1.1.1

View File

@@ -0,0 +1,2 @@
Põhilised muutused selles versioonis: kui kasutaja soovib lisada kontot MASi toega serverisse, siis suuname ta Element Xi juurde.
Kogu ingliskeelne muudatuste logi: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Põhilised muutused selles versioonis: vastuvõetava kõne kokkujooksmine Androidi versioonis 14 ja uuemas.
Kogu ingliskeelne muudatuste logi: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
تغییرات عمده در این نگارش: هدایت کاربران به المنت اکس هنگام تلاش برای ساختن حساب روی کارسازی با پشتیبانی از MAS.
گزارش دگرگونی کامل: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
تغییرات عمده در این نگارش: تعمیر فروپاشی تماس ورودی روی اندروید ۱۴+.
گزارش دگرگونی کامل: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Principaux changements pour cette version : Correction du plantage lors des appels entrants sur Android 14+.
Intégralité des changements : https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Perubahan utama dalam versi ini: Alihkan pengguna ke Element X ketika ingin membuat akun di server dengan dukungan MAS.
Catatan perubahan lanjutan: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Perubahan utama dalam versi ini: Perbaikan kemogokan panggilan masuk di Android 14+.
Catatan perubahan lanjutan: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Hlavné zmeny v tejto verzii: aktualizácia crypto sdk.
Úplný zoznam zmien: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Hlavné zmeny v tejto verzii: Presmerovanie používateľa na Element X, keď chce vytvoriť účty na serveri s podporou MAS.
Úplný zoznam zmien: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Hlavné zmeny v tejto verzii: Oprava pádu prichádzajúceho hovoru v systéme Android 14+.
Úplný zoznam zmien: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Ndryshimet kryesore në këtë version: Ridrejto përdoruesit te Element X, kur duan të krijojnë llogari në shërbyes që mbulojnë MAS.
Regjistër i plotë ndryshimesh: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Huvudsakliga ändringar i den här versionen: Omdirigera användare till Element X när de vill skapa konton på server med MAS-stöd.
Full ändringslogg: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Huvudsakliga ändringar i den här versionen: Fixa crash vid inkommande samtal på Android 14+
Full ändringslogg: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Основні зміни в цій версії: Переспрямування користувачів до Element X, коли вони хочуть створити облікові записи на сервері з підтримкою MAS.
Список усіх змін: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
Основні зміни в цій версії: Виправлено збій вхідних викликів на Android 14+.
Перелік усіх змін: https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
此版本中的主要變動crypto SDK 更新。
完整的變更紀錄https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
此版本中的主要變動:通知使用者不支援 Element Call。
完整的變更紀錄https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
此版本中的主要變動crypto SDK 更新。
完整的變更紀錄https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
此版本中的主要變動:當使用者想要在有 MAS 支援的伺服器上建立帳號時,將使用者重新導向到 Element X。
完整的變更紀錄https://github.com/element-hq/element-android/releases

View File

@@ -0,0 +1,2 @@
此版本中的主要變動:修復 Android 14 或更新版本上的來電當機問題。
完整的變更紀錄https://github.com/element-hq/element-android/releases

View File

@@ -3035,4 +3035,8 @@
<string name="call_unsupported">Nepodporované volání</string>
<string name="call_unsupported_matrix_rtc_call">Nepodporované volání. Pro připojení k tomuto volání je nutná nová aplikace Element X.</string>
<string name="microphone_in_use_title">Mikrofon se používá</string>
<string name="error_mas_not_supported_subtitle">Stáhněte si %1$s a používejte %2$s se svým účetem nebo si vyberte jiný domovský server.</string>
<string name="view_download_replacement_app_title">Stáhnout %1$s</string>
<string name="error_mas_not_supported_title">Pomocí této aplikace již nelze vytvořit účet na %1$s</string>
<string name="view_download_replacement_app_subtitle">Rychlejší, bezpečnější a s výkonnými nástroji pro spolupráci.</string>
</resources>

View File

@@ -2975,4 +2975,10 @@
<string name="microphone_in_use_title">Mikrofon on kasutusel</string>
<string name="call_unsupported">See kõne pole toetatud</string>
<string name="call_unsupported_matrix_rtc_call">See kõne pole toetatud. Kõnega liitumiseks palun kasuta uut Element X rakendust.</string>
<string name="view_download_replacement_app_title">Laadi alla %1$s</string>
<string name="view_download_replacement_app_subtitle">Kiirem, turvalisem ja sisaldab palju võimsaid ühistöövahendeid.</string>
<string name="error_mas_not_supported_title">Selle rakendusega enam ei saa luua kasutajakontot teenuses %1$s</string>
<string name="error_mas_not_supported_subtitle">%2$s teenuse kasutamiseks võta kasutusele %1$s või vali mõni muu koduserver.</string>
<string name="room_profile_section_more_report">Teata jututoast</string>
<string name="room_profile_section_more_report_success_content">Jututoast teatamine õnnestus.</string>
</resources>

View File

@@ -2975,4 +2975,10 @@
<string name="call_unsupported_matrix_rtc_call">تماس پشتیبانی نشده. برای پیوستن به این تماس نیاز به کارهٔ جدید المنت اکس است.</string>
<string name="microphone_in_use_title">صدابَر در حال استفاده</string>
<string name="call_unsupported">تماس پشتیبانی نشده</string>
<string name="error_mas_not_supported_subtitle">برای استفاده از %2$s برای حسابتان %1$s را گرفته یا کارساز خانگی دیگری را برگزینید.</string>
<string name="view_download_replacement_app_title">بارگیری %1$s</string>
<string name="error_mas_not_supported_title">دیگر نمی‌توانید با این کاره حسابی روی %1$s بسازید</string>
<string name="view_download_replacement_app_subtitle">سریع‌تر، امن‌تر و دارای ابزارهای همکاری قدرتمند.</string>
<string name="room_profile_section_more_report">گزارش اتاق</string>
<string name="room_profile_section_more_report_success_content">اتاق با موفّقیت گزارش شد.</string>
</resources>

View File

@@ -2975,4 +2975,8 @@
<string name="call_unsupported">Appel non pris en charge</string>
<string name="call_unsupported_matrix_rtc_call">Appel non pris en charge. La nouvelle application Element X est nécessaire pour rejoindre cet appel.</string>
<string name="microphone_in_use_title">Microphone en service</string>
<string name="error_mas_not_supported_title">Vous ne pouvez plus créer de compte sur %1$s avec cette application</string>
<string name="error_mas_not_supported_subtitle">Téléchargez %1$s pour utiliser %2$s avec votre compte, ou choisissez un autre serveur daccueil.</string>
<string name="view_download_replacement_app_title">Télécharger %1$s</string>
<string name="view_download_replacement_app_subtitle">Plus rapide, plus sécurisé et fourni avec des outils de collaboration efficaces.</string>
</resources>

View File

@@ -2917,4 +2917,8 @@ Di masa mendatang proses verifikasi ini akan dimutakhirkan.</string>
<string name="microphone_in_use_title">Mikrofon digunakan</string>
<string name="call_unsupported">Panggilan tidak didukung</string>
<string name="call_unsupported_matrix_rtc_call">Panggilan tidak didukung. Aplikasi Element X yang baru diperlukan untuk bergabung ke panggilan ini.</string>
<string name="view_download_replacement_app_title">Unduh %1$s</string>
<string name="view_download_replacement_app_subtitle">Lebih cepat, lebih aman, dan lengkap dengan peralatan kolaborasi yang lebih berdaya.</string>
<string name="error_mas_not_supported_title">Anda sudah tidak bisa lagi membuat akun dengan %1$s menggunakan aplikasi ini</string>
<string name="error_mas_not_supported_subtitle">Unduh %1$s untuk menggunakan %2$s untuk Akun Anda atau pilih homeserver yang lain.</string>
</resources>

View File

@@ -3035,4 +3035,8 @@
<string name="microphone_in_use_title">Mikrofón v prevádzke</string>
<string name="call_unsupported">Nepodporovaný hovor</string>
<string name="call_unsupported_matrix_rtc_call">Nepodporovaný hovor. Na pripojenie k tomuto hovoru je potrebná nová aplikácia Element X.</string>
<string name="error_mas_not_supported_subtitle">Stiahnite si %1$s a používajte %2$s pre svoje konto alebo si vyberte iný domovský server.</string>
<string name="view_download_replacement_app_title">Stiahnuť %1$s</string>
<string name="error_mas_not_supported_title">Pomocou tejto aplikácie si už nemôžete vytvoriť účet %1$s</string>
<string name="view_download_replacement_app_subtitle">Rýchlejší, bezpečnejší a vybavený výkonnými nástrojmi na spoluprácu.</string>
</resources>

View File

@@ -2963,4 +2963,10 @@
<string name="microphone_in_use_title">Mikrofon në përdorim</string>
<string name="call_unsupported_matrix_rtc_call">Thirrje që smbulohet. Për të marrë pjesë në këtë thirrje lypset aplikacioni i ri Element X.</string>
<string name="call_unsupported">Thirrje që smbulohet</string>
<string name="error_mas_not_supported_subtitle">Shkarkoni %1$s, që të përdorni %2$s për llogarinë tuaj, ose zgjidhni një tjetër shërbyes Home.</string>
<string name="view_download_replacement_app_title">Shkarko %1$s</string>
<string name="error_mas_not_supported_title">Smund të krijoni më një llogari te %1$s duke përdorur këtë aplikacion</string>
<string name="view_download_replacement_app_subtitle">I shpejtë, më i siguruar dhe plot mjete të fuqishme bashkëpunimi.</string>
<string name="room_profile_section_more_report">Raportojeni Dhomën</string>
<string name="room_profile_section_more_report_success_content">Dhoma u raportua me sukses.</string>
</resources>

View File

@@ -2975,4 +2975,8 @@
<string name="microphone_in_use_title">Mikrofon används</string>
<string name="call_unsupported">Samtal stöds inte</string>
<string name="call_unsupported_matrix_rtc_call">Samtal stöds inte. Nya Element X-appen behövs för att gå med i det här samtalet.</string>
<string name="view_download_replacement_app_title">Ladda ner %1$s</string>
<string name="view_download_replacement_app_subtitle">Snabbare, säkrare och fullproppad med kraftfulla samarbetsverktyg.</string>
<string name="error_mas_not_supported_title">Du kan inte längre skapa ett konto med %1$s med den här appen</string>
<string name="error_mas_not_supported_subtitle">Ladda ner %1$s för att använda %2$s för ditt konto eller välj en annan hemserver.</string>
</resources>

View File

@@ -3095,4 +3095,8 @@
<string name="microphone_in_use_title">Мікрофон використовується</string>
<string name="call_unsupported">Непідтримуваний виклик</string>
<string name="call_unsupported_matrix_rtc_call">Непідтримуваний виклик. Потрібен застосунок Element X, щоб приєднатися до цього виклику.</string>
<string name="error_mas_not_supported_title">Ви більше не можете створити обліковий запис з %1$s за допомогою цього застосунку</string>
<string name="error_mas_not_supported_subtitle">Завантажте %1$s, щоб використовувати %2$s для свого облікового запису або виберіть інший домашній сервер.</string>
<string name="view_download_replacement_app_title">Завантажити %1$s</string>
<string name="view_download_replacement_app_subtitle">Швидший, безпечніший і з потужними інструментами для спільної роботи.</string>
</resources>

View File

@@ -1889,7 +1889,7 @@
<string name="skip_for_now">暂且略过</string>
<string name="share_space_link_message">加入我的空间 %1$s %2$s</string>
<string name="invite_just_to_this_room_desc">他们不会成为 %s 的一部分</string>
<string name="invite_just_to_this_room">到此房间</string>
<string name="invite_just_to_this_room">到此房间</string>
<string name="invite_to_space_with_name_desc">他们将可以探索 %s</string>
<string name="invite_to_space_with_name">邀请至 %s</string>
<string name="invite_by_link">共享链接</string>
@@ -2915,4 +2915,8 @@
<string name="microphone_in_use_title">麦克风正在使用</string>
<string name="call_unsupported">不支持的通话</string>
<string name="call_unsupported_matrix_rtc_call">不支持的通话。需要新的Element X应用来加入此通话。</string>
<string name="view_download_replacement_app_title">下载%1$s</string>
<string name="view_download_replacement_app_subtitle">更快、更安全,并配备了强大的协作工具。</string>
<string name="error_mas_not_supported_subtitle">下载%1$s以将%2$s用于您的帐户或选择不同的主服务器。</string>
<string name="error_mas_not_supported_title">您无法再使用此应用程序创建%1$s的帐户</string>
</resources>

View File

@@ -2912,4 +2912,13 @@
\n
\n若您不想要看到來自此使用者的任何內容您可以忽略他們以隱藏他們的訊息。</string>
<string name="message_report_user">回報使用者</string>
<string name="view_download_replacement_app_title">下載 %1$s</string>
<string name="microphone_in_use_title">麥克風使用中</string>
<string name="call_unsupported_matrix_rtc_call">不支援的通話。需要新的 Element X 應用程式才能加入此通話。</string>
<string name="call_unsupported">不支援的通話</string>
<string name="error_mas_not_supported_title">您無法再使用此應用程式建立 %1$s 的帳號</string>
<string name="error_mas_not_supported_subtitle">下載 %1$s 以將 %2$s 用於您的帳號或選擇其他家伺服器。</string>
<string name="view_download_replacement_app_subtitle">更快、更安全,並配備了強大的協作工具。</string>
<string name="room_profile_section_more_report">回報聊天室</string>
<string name="room_profile_section_more_report_success_content">已成功回報聊天室。</string>
</resources>

View File

@@ -2369,6 +2369,8 @@
</plurals>
<string name="room_profile_section_more_polls">Poll history</string>
<string name="room_profile_section_more_uploads">Uploads</string>
<string name="room_profile_section_more_report">Report Room</string>
<string name="room_profile_section_more_report_success_content">The room has been successfully reported.</string>
<string name="room_profile_section_more_leave">Leave Room</string>
<string name="direct_room_profile_section_more_leave">Leave</string>
<string name="room_profile_leaving_room">"Leaving the room…"</string>

View File

@@ -62,7 +62,7 @@ android {
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
buildConfigField "String", "SDK_VERSION", "\"1.6.30\""
buildConfigField "String", "SDK_VERSION", "\"1.6.32\""
buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""

View File

@@ -26,4 +26,9 @@ interface ReportingService {
* Ref: https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-rooms-roomid-report-eventid
*/
suspend fun reportContent(eventId: String, score: Int, reason: String)
/**
* Report a room.
*/
suspend fun reportRoom(reason: String)
}

View File

@@ -36,6 +36,7 @@ import org.matrix.android.sdk.internal.session.room.read.ReadBody
import org.matrix.android.sdk.internal.session.room.relation.RelationsResponse
import org.matrix.android.sdk.internal.session.room.relation.threads.ThreadSummariesResponse
import org.matrix.android.sdk.internal.session.room.reporting.ReportContentBody
import org.matrix.android.sdk.internal.session.room.reporting.ReportRoomBody
import org.matrix.android.sdk.internal.session.room.send.SendResponse
import org.matrix.android.sdk.internal.session.room.send.model.EventRedactBody
import org.matrix.android.sdk.internal.session.room.tags.TagBody
@@ -375,6 +376,18 @@ internal interface RoomAPI {
@Body body: ReportContentBody,
)
/**
* Reports a room as inappropriate to the server, which may then notify the appropriate people.
*
* @param roomId the room id
* @param body body containing the reason
*/
@POST(NetworkConstants.URI_API_PREFIX_PATH_V3 + "rooms/{roomId}/report")
suspend fun reportRoom(
@Path("roomId") roomId: String,
@Body body: ReportRoomBody,
)
/**
* Get a list of aliases maintained by the local server for the given room.
* Ref: https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-rooms-roomid-aliases

View File

@@ -114,7 +114,9 @@ import org.matrix.android.sdk.internal.session.room.relation.threads.DefaultFetc
import org.matrix.android.sdk.internal.session.room.relation.threads.FetchThreadSummariesTask
import org.matrix.android.sdk.internal.session.room.relation.threads.FetchThreadTimelineTask
import org.matrix.android.sdk.internal.session.room.reporting.DefaultReportContentTask
import org.matrix.android.sdk.internal.session.room.reporting.DefaultReportRoomTask
import org.matrix.android.sdk.internal.session.room.reporting.ReportContentTask
import org.matrix.android.sdk.internal.session.room.reporting.ReportRoomTask
import org.matrix.android.sdk.internal.session.room.state.DefaultSendStateTask
import org.matrix.android.sdk.internal.session.room.state.SendStateTask
import org.matrix.android.sdk.internal.session.room.tags.AddTagToRoomTask
@@ -281,6 +283,9 @@ internal abstract class RoomModule {
@Binds
abstract fun bindReportContentTask(task: DefaultReportContentTask): ReportContentTask
@Binds
abstract fun bindReportRoomTask(task: DefaultReportRoomTask): ReportRoomTask
@Binds
abstract fun bindGetContextOfEventTask(task: DefaultGetContextOfEventTask): GetContextOfEventTask

View File

@@ -23,7 +23,8 @@ import org.matrix.android.sdk.api.session.room.reporting.ReportingService
internal class DefaultReportingService @AssistedInject constructor(
@Assisted private val roomId: String,
private val reportContentTask: ReportContentTask
private val reportContentTask: ReportContentTask,
private val reportRoomTask: ReportRoomTask,
) : ReportingService {
@AssistedFactory
@@ -35,4 +36,9 @@ internal class DefaultReportingService @AssistedInject constructor(
val params = ReportContentTask.Params(roomId, eventId, score, reason)
reportContentTask.execute(params)
}
override suspend fun reportRoom(reason: String) {
val params = ReportRoomTask.Params(roomId, reason)
reportRoomTask.execute(params)
}
}

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2025 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.room.reporting
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true)
internal data class ReportRoomBody(
/**
* Required. The reason the content is being reported. May be blank.
*/
@Json(name = "reason") val reason: String
)

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2025 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.internal.session.room.reporting
import org.matrix.android.sdk.internal.network.GlobalErrorReceiver
import org.matrix.android.sdk.internal.network.executeRequest
import org.matrix.android.sdk.internal.session.room.RoomAPI
import org.matrix.android.sdk.internal.task.Task
import javax.inject.Inject
internal interface ReportRoomTask : Task<ReportRoomTask.Params, Unit> {
data class Params(
val roomId: String,
val reason: String,
)
}
internal class DefaultReportRoomTask @Inject constructor(
private val roomAPI: RoomAPI,
private val globalErrorReceiver: GlobalErrorReceiver
) : ReportRoomTask {
override suspend fun execute(params: ReportRoomTask.Params) {
return executeRequest(globalErrorReceiver) {
roomAPI.reportRoom(params.roomId, ReportRoomBody(params.reason))
}
}
}

View File

@@ -37,7 +37,7 @@ ext.versionMinor = 6
// Note: even values are reserved for regular release, odd values for hotfix release.
// When creating a hotfix, you should decrease the value, since the current value
// is the value for the next regular release.
ext.versionPatch = 30
ext.versionPatch = 32
static def getGitTimestamp() {
def cmd = 'git show -s --format=%ct'

View File

@@ -18,4 +18,5 @@ sealed class RoomProfileAction : VectorViewModelAction {
object CreateShortcut : RoomProfileAction()
object RestoreEncryptionState : RoomProfileAction()
data class SetEncryptToVerifiedDeviceOnly(val enabled: Boolean) : RoomProfileAction()
data class ReportRoom(val reason: String) : RoomProfileAction()
}

View File

@@ -52,6 +52,7 @@ class RoomProfileController @Inject constructor(
fun onUploadsClicked()
fun createShortcut()
fun onSettingsClicked()
fun onReportRoomClicked()
fun onLeaveRoomClicked()
fun onRoomAliasesClicked()
fun onRoomPermissionsClicked()
@@ -279,6 +280,13 @@ class RoomProfileController @Inject constructor(
action = { callback?.createShortcut() }
)
}
buildProfileAction(
id = "Report",
title = stringProvider.getString(CommonStrings.room_profile_section_more_report),
icon = R.drawable.ic_report_spam,
editable = false,
action = { callback?.onReportRoomClicked() }
)
buildProfileAction(
id = "leave",
title = stringProvider.getString(

View File

@@ -33,6 +33,7 @@ import im.vector.app.core.platform.VectorBaseFragment
import im.vector.app.core.platform.VectorMenuProvider
import im.vector.app.core.utils.copyToClipboard
import im.vector.app.core.utils.startSharePlainTextIntent
import im.vector.app.databinding.DialogReportContentBinding
import im.vector.app.databinding.FragmentMatrixProfileBinding
import im.vector.app.databinding.ViewStubRoomProfileHeaderBinding
import im.vector.app.features.analytics.plan.Interaction
@@ -123,6 +124,7 @@ class RoomProfileFragment :
is RoomProfileViewEvents.ShareRoomProfile -> onShareRoomProfile(it.permalink)
is RoomProfileViewEvents.OnShortcutReady -> addShortcut(it)
RoomProfileViewEvents.DismissLoading -> dismissLoadingDialog()
is RoomProfileViewEvents.Success -> dismissSuccessDialog(it.message)
}
}
roomListQuickActionsSharedActionViewModel
@@ -133,6 +135,17 @@ class RoomProfileFragment :
setupLongClicks()
}
private fun dismissSuccessDialog(message: CharSequence) {
MaterialAlertDialogBuilder(
requireActivity(),
im.vector.lib.ui.styles.R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive
)
.setTitle(CommonStrings.room_profile_section_more_report)
.setMessage(message)
.setPositiveButton(CommonStrings.ok, null)
.show()
}
private fun setupWaitingView() {
views.waitingView.waitingStatusText.setText(CommonStrings.please_wait)
views.waitingView.waitingStatusText.isVisible = true
@@ -286,6 +299,26 @@ class RoomProfileFragment :
ShortcutManagerCompat.requestPinShortcut(requireContext(), onShortcutReady.shortcutInfo, null)
}
override fun onReportRoomClicked() {
promptReasonToReportRoom()
}
private fun promptReasonToReportRoom() {
val inflater = requireActivity().layoutInflater
val layout = inflater.inflate(R.layout.dialog_report_content, null)
val views = DialogReportContentBinding.bind(layout)
MaterialAlertDialogBuilder(requireActivity())
.setTitle(CommonStrings.room_profile_section_more_report)
.setView(layout)
.setPositiveButton(CommonStrings.report_content_custom_submit) { _, _ ->
val reason = views.dialogReportContentInput.text.toString()
roomProfileViewModel.handle(RoomProfileAction.ReportRoom(reason))
}
.setNegativeButton(CommonStrings.action_cancel, null)
.show()
}
override fun onLeaveRoomClicked() {
val isPublicRoom = roomProfileViewModel.isPublicRoom()
val message = buildString {

View File

@@ -17,6 +17,7 @@ sealed class RoomProfileViewEvents : VectorViewEvents {
data class Loading(val message: CharSequence? = null) : RoomProfileViewEvents()
object DismissLoading : RoomProfileViewEvents()
data class Failure(val throwable: Throwable) : RoomProfileViewEvents()
data class Success(val message: CharSequence) : RoomProfileViewEvents()
data class ShareRoomProfile(val permalink: String) : RoomProfileViewEvents()
data class OnShortcutReady(val shortcutInfo: ShortcutInfoCompat) : RoomProfileViewEvents()

View File

@@ -176,6 +176,26 @@ class RoomProfileViewModel @AssistedInject constructor(
RoomProfileAction.CreateShortcut -> handleCreateShortcut()
RoomProfileAction.RestoreEncryptionState -> restoreEncryptionState()
is RoomProfileAction.SetEncryptToVerifiedDeviceOnly -> setEncryptToVerifiedDeviceOnly(action.enabled)
is RoomProfileAction.ReportRoom -> handleReportRoom(action.reason)
}
}
private fun handleReportRoom(reason: String) {
_viewEvents.post(RoomProfileViewEvents.Loading())
session.coroutineScope.launch {
try {
room.reportingService().reportRoom(reason = reason)
_viewEvents.post(
RoomProfileViewEvents.Success(
stringProvider.getString(CommonStrings.room_profile_section_more_report_success_content)
)
)
} catch (failure: Throwable) {
Timber.e(failure, "Failed to report room ${room.roomId}")
_viewEvents.post(RoomProfileViewEvents.Failure(failure))
} finally {
_viewEvents.post(RoomProfileViewEvents.DismissLoading)
}
}
}