Fix moar ktlint issues

This commit is contained in:
Benoit Marty 2024-01-11 09:41:14 +01:00 committed by Benoit Marty
parent a831f05f6e
commit 5d086ad82d
528 changed files with 146 additions and 629 deletions

View file

@ -22,7 +22,6 @@ import javax.inject.Inject
class FilteredEventDetector @Inject constructor(
// private val activeSessionDataSource: ActiveSessionDataSource
) {
/**
* Returns true if the given event should be ignored.
* Used to skip notifications if a non expected message is received.
@ -41,10 +40,10 @@ class FilteredEventDetector @Inject constructor(
return false
}
/*
/**
* Whether the timeline event should be ignored.
*/
/*
private fun TimelineEvent.shouldBeIgnored(): Boolean {
if (root.isVoiceMessage()) {
val audioEvent = root.asMessageAudioEvent()

View file

@ -36,7 +36,6 @@ class NotifiableEventProcessor @Inject constructor(
private val outdatedDetector: OutdatedEventDetector,
private val appNavigationStateService: AppNavigationStateService,
) {
fun process(
queuedEvents: List<NotifiableEvent>,
renderedEvents: ProcessedEvents,

View file

@ -69,7 +69,6 @@ class NotifiableEventResolver @Inject constructor(
private val notificationMediaRepoFactory: NotificationMediaRepo.Factory,
@ApplicationContext private val context: Context,
) {
suspend fun resolveEvent(sessionId: SessionId, roomId: RoomId, eventId: EventId): NotifiableEvent? {
// Restore session
val client = matrixClientProvider.getOrRestore(sessionId).getOrNull() ?: return null
@ -129,8 +128,10 @@ class NotifiableEventResolver @Inject constructor(
isRedacted = false,
isUpdated = false,
description = descriptionFromRoomMembershipInvite(isDirect),
type = null, // TODO check if type is needed anymore
title = null, // TODO check if title is needed anymore
// TODO check if type is needed anymore
type = null,
// TODO check if title is needed anymore
title = null,
)
} else {
Timber.tag(loggerTag.value).d("Ignoring notification state event for membership ${content.membershipState}")

View file

@ -35,7 +35,6 @@ class NotificationBitmapLoader @Inject constructor(
@ApplicationContext private val context: Context,
private val sdkIntProvider: BuildVersionSdkIntProvider,
) {
/**
* Get icon of a room.
* @param path mxc url

View file

@ -33,7 +33,6 @@ private val loggerTag = LoggerTag("NotificationBroadcastReceiver", LoggerTag.Not
* Receives actions broadcast by notification (on click, on dismiss, inline replies, etc.).
*/
class NotificationBroadcastReceiver : BroadcastReceiver() {
@Inject lateinit var defaultNotificationDrawerManager: DefaultNotificationDrawerManager
@Inject lateinit var actionIds: NotificationActionIds
@ -223,12 +222,9 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
VectorApp.getInstance().notificationDrawerManager.refreshNotificationDrawer(null)
}
})
*/
*/
}
*/
/*
private fun getReplyMessage(intent: Intent?): String? {
if (intent != null) {
val remoteInput = RemoteInput.getResultsFromIntent(intent)

View file

@ -34,11 +34,10 @@ data class NotificationEventQueue(
* An in memory FIFO cache of the seen events.
* Acts as a notification debouncer to stop already dismissed push notifications from
* displaying again when the /sync response is delayed.
* TODO Should be per session, so the key must be Pair<SessionId, EventId>.
*/
// TODO Should be per session, so the key must be Pair<SessionId, EventId>.
private val seenEventIds: CircularCache<EventId>
) {
fun markRedacted(eventIds: List<EventId>) {
eventIds.forEach { redactedId ->
queue.replace(redactedId) {

View file

@ -34,7 +34,6 @@ class NotificationFactory @Inject constructor(
private val roomGroupMessageCreator: RoomGroupMessageCreator,
private val summaryGroupMessageCreator: SummaryGroupMessageCreator
) {
suspend fun Map<RoomId, ProcessedMessageEvents>.toNotifications(
currentUser: MatrixUser,
imageLoader: ImageLoader,

View file

@ -35,7 +35,6 @@ import java.io.File
* Whenever a given mxc is found in the cache, it is returned immediately.
*/
interface NotificationMediaRepo {
/**
* Factory for [NotificationMediaRepo].
*/
@ -72,7 +71,6 @@ class DefaultNotificationMediaRepo @AssistedInject constructor(
private val mxcTools: MxcTools,
@Assisted private val client: MatrixClient,
) : NotificationMediaRepo {
@ContributesBinding(AppScope::class)
@AssistedFactory
fun interface Factory : NotificationMediaRepo.Factory {

View file

@ -35,7 +35,6 @@ class NotificationRenderer @Inject constructor(
private val notificationDisplayer: NotificationDisplayer,
private val notificationFactory: NotificationFactory,
) {
suspend fun render(
currentUser: MatrixUser,
useCompleteNotificationFormat: Boolean,

View file

@ -29,7 +29,6 @@ class NotificationState(
* Events are unique by their properties, we should be careful not to insert multiple events with the same event-id.
*/
private val queuedEvents: NotificationEventQueue,
/**
* The last known rendered notifiable events.
* We keep track of them in order to know which events have been removed from the eventList
@ -37,7 +36,6 @@ class NotificationState(
*/
private val renderedEvents: MutableList<ProcessedEvent<NotifiableEvent>>,
) {
fun <T> updateQueuedEvents(
action: (NotificationEventQueue, List<ProcessedEvent<NotifiableEvent>>) -> T
): T {

View file

@ -22,7 +22,6 @@ import javax.inject.Inject
class OutdatedEventDetector @Inject constructor(
// / private val activeSessionDataSource: ActiveSessionDataSource
) {
/**
* Returns true if the given event is outdated.
* Used to clean up notifications if a displayed message has been read on an

View file

@ -38,7 +38,6 @@ class RoomGroupMessageCreator @Inject constructor(
private val stringProvider: StringProvider,
private val notificationCreator: NotificationCreator
) {
suspend fun createRoomMessage(
currentUser: MatrixUser,
events: List<NotifiableMessageEvent>,

View file

@ -43,7 +43,6 @@ class SummaryGroupMessageCreator @Inject constructor(
private val stringProvider: StringProvider,
private val notificationCreator: NotificationCreator,
) {
fun createSummaryNotification(
currentUser: MatrixUser,
roomNotifications: List<RoomNotification.Message.Meta>,

View file

@ -21,7 +21,6 @@ import android.content.Context
import android.content.Intent
class TestNotificationReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
// TODO The test notification has been clicked, notify the ui
}

View file

@ -53,7 +53,6 @@ data class NotifiableMessageEvent(
override val isRedacted: Boolean = false,
override val isUpdated: Boolean = false
) : NotifiableEvent {
val type: String = EventType.MESSAGE
override val description: String = body ?: ""
val title: String = senderName ?: ""

View file

@ -32,7 +32,6 @@ class NotificationPermissionManager @Inject constructor(
private val sdkIntProvider: BuildVersionSdkIntProvider,
@ApplicationContext private val context: Context,
) {
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
fun isPermissionGranted(): Boolean {
return ContextCompat.checkSelfPermission(
@ -57,7 +56,7 @@ class NotificationPermissionManager @Inject constructor(
if (showRationale) R.string.permissions_rationale_msg_notification else 0
)
}
*/
*/
fun eventuallyRevokePermission(
activity: Activity,

View file

@ -52,7 +52,6 @@ class DefaultPushHandler @Inject constructor(
private val buildMeta: BuildMeta,
private val matrixAuthenticationService: MatrixAuthenticationService,
) : PushHandler {
private val coroutineScope = CoroutineScope(SupervisorJob())
// UI handler

View file

@ -23,7 +23,6 @@ import kotlinx.serialization.Serializable
internal data class PushGatewayNotification(
@SerialName("event_id")
val eventId: String,
/**
* Required. This is an array of devices that the notification should be sent to.
*/

View file

@ -42,7 +42,6 @@ private val VIEWING_A_ROOM = aNavigationState(A_SESSION_ID, A_SPACE_ID, A_ROOM_I
private val VIEWING_A_THREAD = aNavigationState(A_SESSION_ID, A_SPACE_ID, A_ROOM_ID, A_THREAD_ID)
class NotifiableEventProcessorTest {
private val outdatedDetector = FakeOutdatedEventDetector()
@Test

View file

@ -59,7 +59,6 @@ import org.robolectric.annotation.Config
@RunWith(RobolectricTestRunner::class)
class NotifiableEventResolverTest {
@Test
fun `resolve event no session`() = runTest {
val sut = createNotifiableEventResolver(notificationService = null)

View file

@ -28,7 +28,6 @@ import io.element.android.libraries.push.impl.notifications.model.NotifiableEven
import org.junit.Test
class NotificationEventQueueTest {
private val seenIdsCache = CircularCache.create<EventId>(5)
@Test

View file

@ -41,7 +41,6 @@ private val A_MESSAGE_EVENT = aNotifiableMessageEvent(eventId = AN_EVENT_ID, roo
@RunWith(RobolectricTestRunner::class)
class NotificationFactoryTest {
private val androidNotificationFactory = FakeAndroidNotificationFactory()
private val roomGroupMessageCreator = FakeRoomGroupMessageCreator()
private val summaryGroupMessageCreator = FakeSummaryGroupMessageCreator()

View file

@ -51,7 +51,6 @@ private val ONE_SHOT_META = OneShotNotification.Append.Meta(key = "ignored", sum
@RunWith(RobolectricTestRunner::class)
class NotificationRendererTest {
private val notificationDisplayer = FakeNotificationDisplayer()
private val notificationFactory = FakeNotificationFactory()
private val notificationIdProvider = NotificationIdProvider()

View file

@ -25,7 +25,6 @@ import io.mockk.coEvery
import io.mockk.mockk
class FakeRoomGroupMessageCreator {
val instance = mockk<RoomGroupMessageCreator>()
fun givenCreatesRoomMessageFor(

View file

@ -20,6 +20,5 @@ import io.element.android.libraries.push.impl.notifications.SummaryGroupMessageC
import io.mockk.mockk
class FakeSummaryGroupMessageCreator {
val instance = mockk<SummaryGroupMessageCreator>()
}