Rename const for clarity and convention
This commit is contained in:
@@ -14,17 +14,17 @@ object NotificationConfig {
|
||||
/**
|
||||
* If set to true, the notification will have a "Mark as read" action.
|
||||
*/
|
||||
const val SUPPORT_MARK_AS_READ_ACTION = true
|
||||
const val SHOW_MARK_AS_READ_ACTION = true
|
||||
|
||||
/**
|
||||
* If set to true, the notification for invitation will have two actions to accept or decline the invite.
|
||||
*/
|
||||
const val SUPPORT_JOIN_DECLINE_INVITE = true
|
||||
const val SHOW_ACCEPT_AND_DECLINE_INVITE_ACTIONS = true
|
||||
|
||||
/**
|
||||
* If set to true, the notification will have a "Quick reply" action, allow to compose and send a message to the room.
|
||||
*/
|
||||
const val SUPPORT_QUICK_REPLY_ACTION = true
|
||||
const val SHOW_QUICK_REPLY_ACTION = true
|
||||
|
||||
@ColorInt
|
||||
val NOTIFICATION_ACCENT_COLOR: Int = Color.parseColor("#FF0DBD8B")
|
||||
|
||||
@@ -230,7 +230,7 @@ class DefaultNotificationCreator @Inject constructor(
|
||||
.setSmallIcon(smallIcon)
|
||||
.setColor(accentColor)
|
||||
.apply {
|
||||
if (NotificationConfig.SUPPORT_JOIN_DECLINE_INVITE) {
|
||||
if (NotificationConfig.SHOW_ACCEPT_AND_DECLINE_INVITE_ACTIONS) {
|
||||
addAction(rejectInvitationActionFactory.create(inviteNotifiableEvent))
|
||||
addAction(acceptInvitationActionFactory.create(inviteNotifiableEvent))
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ class MarkAsReadActionFactory @Inject constructor(
|
||||
private val clock: SystemClock,
|
||||
) {
|
||||
fun create(roomInfo: RoomEventGroupInfo): NotificationCompat.Action? {
|
||||
if (!NotificationConfig.SUPPORT_MARK_AS_READ_ACTION) return null
|
||||
if (!NotificationConfig.SHOW_MARK_AS_READ_ACTION) return null
|
||||
val sessionId = roomInfo.sessionId.value
|
||||
val roomId = roomInfo.roomId.value
|
||||
val intent = Intent(context, NotificationBroadcastReceiver::class.java)
|
||||
|
||||
@@ -34,7 +34,7 @@ class QuickReplyActionFactory @Inject constructor(
|
||||
private val clock: SystemClock,
|
||||
) {
|
||||
fun create(roomInfo: RoomEventGroupInfo, threadId: ThreadId?): NotificationCompat.Action? {
|
||||
if (!NotificationConfig.SUPPORT_QUICK_REPLY_ACTION) return null
|
||||
if (!NotificationConfig.SHOW_QUICK_REPLY_ACTION) return null
|
||||
val sessionId = roomInfo.sessionId
|
||||
val roomId = roomInfo.roomId
|
||||
val replyPendingIntent = buildQuickReplyIntent(sessionId, roomId, threadId)
|
||||
|
||||
@@ -162,8 +162,8 @@ class DefaultRoomGroupMessageCreatorTest {
|
||||
val actionTitles = result.actions?.map { it.title }
|
||||
assertThat(actionTitles).isEqualTo(
|
||||
listOfNotNull(
|
||||
markAsReadActionTitle.takeIf { NotificationConfig.SUPPORT_MARK_AS_READ_ACTION },
|
||||
quickReplyActionTitle.takeIf { NotificationConfig.SUPPORT_QUICK_REPLY_ACTION },
|
||||
markAsReadActionTitle.takeIf { NotificationConfig.SHOW_MARK_AS_READ_ACTION },
|
||||
quickReplyActionTitle.takeIf { NotificationConfig.SHOW_QUICK_REPLY_ACTION },
|
||||
)
|
||||
)
|
||||
assertThat(fakeImageLoader.getCoilRequests().size).isEqualTo(0)
|
||||
@@ -188,7 +188,7 @@ class DefaultRoomGroupMessageCreatorTest {
|
||||
val actionTitles = result.actions?.map { it.title }
|
||||
assertThat(actionTitles).isEqualTo(
|
||||
listOfNotNull(
|
||||
markAsReadActionTitle.takeIf { NotificationConfig.SUPPORT_MARK_AS_READ_ACTION }
|
||||
markAsReadActionTitle.takeIf { NotificationConfig.SHOW_MARK_AS_READ_ACTION }
|
||||
)
|
||||
)
|
||||
assertThat(fakeImageLoader.getCoilRequests().size).isEqualTo(0)
|
||||
|
||||
Reference in New Issue
Block a user