Allow uploading notification push rules in bug reports (#5538)

* Allow uploading push rules in bug reports

* Improve bug report screen previews

* Update screenshots

---------

Co-authored-by: ElementBot <android@element.io>
This commit is contained in:
Jorge Martin Espinosa 2025-10-15 11:45:04 +02:00 committed by GitHub
parent 35cf3aeb0b
commit 5b1bfac6ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 116 additions and 38 deletions

View file

@ -13,6 +13,7 @@ import io.element.android.libraries.core.bool.orFalse
@Suppress("ktlint:standard:property-naming")
object MimeTypes {
const val Any: String = "*/*"
const val Json = "application/json"
const val OctetStream = "application/octet-stream"
const val Apk = "application/vnd.android.package-archive"
const val Pdf = "application/pdf"

View file

@ -33,4 +33,5 @@ interface NotificationSettingsService {
suspend fun setInviteForMeEnabled(enabled: Boolean): Result<Unit>
suspend fun getRoomsWithUserDefinedRules(): Result<List<String>>
suspend fun canHomeServerPushEncryptedEventsToDevice(): Result<Boolean>
suspend fun getRawPushRules(): Result<String?>
}

View file

@ -139,4 +139,8 @@ class RustNotificationSettingsService(
runCatchingExceptions {
notificationSettings.await().canPushEncryptedEventToDevice()
}
override suspend fun getRawPushRules(): Result<String?> = runCatchingExceptions {
notificationSettings.await().getRawPushRules()
}
}

View file

@ -13,6 +13,7 @@ import io.element.android.libraries.matrix.api.room.RoomNotificationMode
import io.element.android.libraries.matrix.api.room.RoomNotificationSettings
import io.element.android.libraries.matrix.test.A_ROOM_ID
import io.element.android.libraries.matrix.test.A_ROOM_NOTIFICATION_MODE
import io.element.android.tests.testutils.lambda.lambdaError
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow
@ -23,6 +24,7 @@ class FakeNotificationSettingsService(
initialEncryptedGroupDefaultMode: RoomNotificationMode = RoomNotificationMode.MENTIONS_AND_KEYWORDS_ONLY,
initialOneToOneDefaultMode: RoomNotificationMode = RoomNotificationMode.ALL_MESSAGES,
initialEncryptedOneToOneDefaultMode: RoomNotificationMode = RoomNotificationMode.ALL_MESSAGES,
private val getRawPushRulesResult: () -> Result<String> = { lambdaError() },
) : NotificationSettingsService {
private val notificationSettingsStateFlow = MutableStateFlow(Unit)
private var defaultGroupRoomNotificationMode: RoomNotificationMode = initialGroupDefaultMode
@ -178,4 +180,8 @@ class FakeNotificationSettingsService(
fun givenCanHomeServerPushEncryptedEventsToDeviceResult(result: Result<Boolean>) {
canHomeServerPushEncryptedEventsToDeviceResult = result
}
override suspend fun getRawPushRules(): Result<String?> {
return getRawPushRulesResult()
}
}