Update plugin ktlint to v12.1.0 (#2200)
* Update plugin ktlint to v12.1.0 * Run `./gradlew ktlintFormat` and fix some issues manually. * Fix other issues reproted by Ktlint * Limit false positives, KtLint removes unnecessary curly brace in String templates. * Remove useless Unit * Minor improvements over ktlint changes * Restore `AlertDialogContent` behaviour * Update screenshots --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benoit Marty <benoit@matrix.org> Co-authored-by: Jorge Martín <jorgem@element.io> Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
7e1866818e
commit
c8bd362397
442 changed files with 1091 additions and 1081 deletions
|
|
@ -20,7 +20,7 @@ import io.element.android.libraries.push.impl.notifications.model.NotifiableEven
|
|||
import javax.inject.Inject
|
||||
|
||||
class FilteredEventDetector @Inject constructor(
|
||||
//private val activeSessionDataSource: ActiveSessionDataSource
|
||||
// private val activeSessionDataSource: ActiveSessionDataSource
|
||||
) {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
package io.element.android.libraries.push.impl.notifications
|
||||
|
||||
data class NotificationAction(
|
||||
val shouldNotify: Boolean,
|
||||
val highlight: Boolean,
|
||||
val soundName: String?
|
||||
val shouldNotify: Boolean,
|
||||
val highlight: Boolean,
|
||||
val soundName: String?
|
||||
)
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import io.element.android.libraries.push.impl.notifications.model.NotifiableEven
|
|||
import javax.inject.Inject
|
||||
|
||||
class OutdatedEventDetector @Inject constructor(
|
||||
/// private val activeSessionDataSource: ActiveSessionDataSource
|
||||
// / private val activeSessionDataSource: ActiveSessionDataSource
|
||||
) {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class SummaryGroupMessageCreator @Inject constructor(
|
|||
val nbEvents = roomNotifications.size + simpleNotifications.size
|
||||
val sumTitle = stringProvider.getQuantityString(R.plurals.notification_compat_summary_title, nbEvents, nbEvents)
|
||||
summaryInboxStyle.setBigContentTitle(sumTitle.annotateForDebug(43))
|
||||
//.setSummaryText(stringProvider.getQuantityString(R.plurals.notification_unread_notified_messages, nbEvents, nbEvents).annotateForDebug(44))
|
||||
// .setSummaryText(stringProvider.getQuantityString(R.plurals.notification_unread_notified_messages, nbEvents, nbEvents).annotateForDebug(44))
|
||||
// Use account name now, for multi-session
|
||||
.setSummaryText(currentUser.userId.value.annotateForDebug(44))
|
||||
return if (useCompleteNotificationFormat) {
|
||||
|
|
@ -119,7 +119,8 @@ class SummaryGroupMessageCreator @Inject constructor(
|
|||
// Invitation and message
|
||||
val messageStr = stringProvider.getQuantityString(
|
||||
R.plurals.notification_new_messages_for_room,
|
||||
messageNotificationCount, messageNotificationCount
|
||||
messageNotificationCount,
|
||||
messageNotificationCount
|
||||
)
|
||||
if (roomCount > 1) {
|
||||
// In several rooms
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ class NotificationChannels @Inject constructor(
|
|||
enableVibration(true)
|
||||
enableLights(true)
|
||||
lightColor = accentColor
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* Low notification importance: shows everywhere, but is not intrusive.
|
||||
|
|
@ -107,7 +108,8 @@ class NotificationChannels @Inject constructor(
|
|||
setSound(null, null)
|
||||
enableLights(true)
|
||||
lightColor = accentColor
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
notificationManager.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
|
|
@ -119,7 +121,8 @@ class NotificationChannels @Inject constructor(
|
|||
description = stringProvider.getString(R.string.notification_channel_listening_for_events)
|
||||
setSound(null, null)
|
||||
setShowBadge(false)
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
notificationManager.createNotificationChannel(
|
||||
NotificationChannel(
|
||||
|
|
@ -132,7 +135,8 @@ class NotificationChannels @Inject constructor(
|
|||
setSound(null, null)
|
||||
enableLights(true)
|
||||
lightColor = accentColor
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private fun getChannel(channelId: String): NotificationChannel? {
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ fun NotifiableEvent.shouldIgnoreEventInRoom(appNavigationState: AppNavigationSta
|
|||
val currentSessionId = appNavigationState.navigationState.currentSessionId() ?: return false
|
||||
return when (val currentRoomId = appNavigationState.navigationState.currentRoomId()) {
|
||||
null -> false
|
||||
else -> appNavigationState.isInForeground
|
||||
&& sessionId == currentSessionId
|
||||
&& roomId == currentRoomId
|
||||
&& (this as? NotifiableMessageEvent)?.threadId == appNavigationState.navigationState.currentThreadId()
|
||||
else -> appNavigationState.isInForeground &&
|
||||
sessionId == currentSessionId &&
|
||||
roomId == currentRoomId &&
|
||||
(this as? NotifiableMessageEvent)?.threadId == appNavigationState.navigationState.currentThreadId()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package io.element.android.libraries.push.impl.pushgateway
|
||||
|
||||
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.POST
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiable
|
|||
import io.element.android.libraries.push.impl.notifications.fixtures.aSimpleNotifiableEvent
|
||||
import io.element.android.libraries.push.impl.notifications.fixtures.anInviteNotifiableEvent
|
||||
import io.element.android.libraries.push.impl.notifications.model.NotifiableEvent
|
||||
import io.element.android.services.appnavstate.api.NavigationState
|
||||
import io.element.android.services.appnavstate.api.AppNavigationState
|
||||
import io.element.android.services.appnavstate.api.NavigationState
|
||||
import io.element.android.services.appnavstate.test.FakeAppNavigationStateService
|
||||
import io.element.android.services.appnavstate.test.aNavigationState
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
|
|
|
|||
|
|
@ -130,7 +130,9 @@ class NotificationFactoryTest {
|
|||
fun `given room with message when mapping to notification then delegates to room group message creator`() = testWith(notificationFactory) {
|
||||
val events = listOf(A_MESSAGE_EVENT)
|
||||
val expectedNotification = roomGroupMessageCreator.givenCreatesRoomMessageFor(
|
||||
MatrixUser(A_SESSION_ID, A_SESSION_ID.value, MY_AVATAR_URL), events, A_ROOM_ID
|
||||
MatrixUser(A_SESSION_ID, A_SESSION_ID.value, MY_AVATAR_URL),
|
||||
events,
|
||||
A_ROOM_ID
|
||||
)
|
||||
val roomWithMessage = mapOf(A_ROOM_ID to listOf(ProcessedEvent(ProcessedEvent.Type.KEEP, A_MESSAGE_EVENT)))
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,11 @@ private val A_SUMMARY_NOTIFICATION = SummaryNotification.Update(mockk())
|
|||
private val A_REMOVE_SUMMARY_NOTIFICATION = SummaryNotification.Removed
|
||||
private val A_NOTIFICATION = mockk<Notification>()
|
||||
private val MESSAGE_META = RoomNotification.Message.Meta(
|
||||
summaryLine = "ignored", messageCount = 1, latestTimestamp = -1, roomId = A_ROOM_ID, shouldBing = false
|
||||
summaryLine = "ignored",
|
||||
messageCount = 1,
|
||||
latestTimestamp = -1,
|
||||
roomId = A_ROOM_ID,
|
||||
shouldBing = false
|
||||
)
|
||||
private val ONE_SHOT_META = OneShotNotification.Append.Meta(key = "ignored", summaryLine = "ignored", isNoisy = false, timestamp = -1)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue