Browse Source

Remove unused code notificationStyleChanged()

We may properly add it again later if necessary.
pull/2899/head
Benoit Marty 4 months ago
parent
commit
b70c5915f7
  1. 3
      libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/PushService.kt
  2. 6
      libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPushService.kt
  3. 12
      libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt
  4. 1
      libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManagerTest.kt
  5. 3
      libraries/push/test/src/main/kotlin/io/element/android/libraries/push/test/FakePushService.kt

3
libraries/push/api/src/main/kotlin/io/element/android/libraries/push/api/PushService.kt

@ -21,9 +21,6 @@ import io.element.android.libraries.pushproviders.api.Distributor @@ -21,9 +21,6 @@ import io.element.android.libraries.pushproviders.api.Distributor
import io.element.android.libraries.pushproviders.api.PushProvider
interface PushService {
// TODO Move away
fun notificationStyleChanged()
/**
* Return the current push provider, or null if none.
*/

6
libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPushService.kt

@ -21,7 +21,6 @@ import io.element.android.libraries.di.AppScope @@ -21,7 +21,6 @@ import io.element.android.libraries.di.AppScope
import io.element.android.libraries.matrix.api.MatrixClient
import io.element.android.libraries.push.api.GetCurrentPushProvider
import io.element.android.libraries.push.api.PushService
import io.element.android.libraries.push.impl.notifications.DefaultNotificationDrawerManager
import io.element.android.libraries.pushproviders.api.Distributor
import io.element.android.libraries.pushproviders.api.PushProvider
import io.element.android.libraries.pushstore.api.UserPushStoreFactory
@ -30,16 +29,11 @@ import javax.inject.Inject @@ -30,16 +29,11 @@ import javax.inject.Inject
@ContributesBinding(AppScope::class)
class DefaultPushService @Inject constructor(
private val defaultNotificationDrawerManager: DefaultNotificationDrawerManager,
private val pushersManager: PushersManager,
private val userPushStoreFactory: UserPushStoreFactory,
private val pushProviders: Set<@JvmSuppressWildcards PushProvider>,
private val getCurrentPushProvider: GetCurrentPushProvider,
) : PushService {
override fun notificationStyleChanged() {
defaultNotificationDrawerManager.notificationStyleChanged()
}
override suspend fun getCurrentPushProvider(): PushProvider? {
val currentPushProvider = getCurrentPushProvider.getCurrentPushProvider()
return pushProviders.find { it.name == currentPushProvider }

12
libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManager.kt

@ -221,18 +221,6 @@ class DefaultNotificationDrawerManager @Inject constructor( @@ -221,18 +221,6 @@ class DefaultNotificationDrawerManager @Inject constructor(
}
}
// TODO EAx Must be per account
fun notificationStyleChanged() {
updateEvents(doRender = true) {
val newSettings = true // pushDataStore.useCompleteNotificationFormat()
if (newSettings != useCompleteNotificationFormat) {
// Settings has changed, remove all current notifications
notificationRenderer.cancelAllNotifications()
useCompleteNotificationFormat = newSettings
}
}
}
private fun updateEvents(
doRender: Boolean,
action: (NotificationEventQueue) -> Unit,

1
libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotificationDrawerManagerTest.kt

@ -59,7 +59,6 @@ class DefaultNotificationDrawerManagerTest { @@ -59,7 +59,6 @@ class DefaultNotificationDrawerManagerTest {
fun `cover all APIs`() = runTest {
// For now just call all the API. Later, add more valuable tests.
val defaultNotificationDrawerManager = createDefaultNotificationDrawerManager()
defaultNotificationDrawerManager.notificationStyleChanged()
defaultNotificationDrawerManager.clearAllMessagesEvents(A_SESSION_ID, doRender = true)
defaultNotificationDrawerManager.clearAllMessagesEvents(A_SESSION_ID, doRender = false)
defaultNotificationDrawerManager.clearEvent(A_SESSION_ID, AN_EVENT_ID, doRender = true)

3
libraries/push/test/src/main/kotlin/io/element/android/libraries/push/test/FakePushService.kt

@ -29,9 +29,6 @@ class FakePushService( @@ -29,9 +29,6 @@ class FakePushService(
Result.success(Unit)
},
) : PushService {
override fun notificationStyleChanged() {
}
override suspend fun getCurrentPushProvider(): PushProvider? {
return availablePushProviders.firstOrNull()
}

Loading…
Cancel
Save