Refactor notifications (#4883)
Also fixes https://github.com/tuskyapp/Tusky/issues/4858. But apart from that there should be no functional change.
This commit is contained in:
parent
6c85f72a35
commit
3a3e056572
19 changed files with 1072 additions and 1217 deletions
|
|
@ -14,7 +14,7 @@ import androidx.work.testing.WorkManagerTestInitHelper
|
|||
import at.connyduck.calladapter.networkresult.NetworkResult
|
||||
import com.keylesspalace.tusky.appstore.EventHub
|
||||
import com.keylesspalace.tusky.components.accountlist.AccountListActivity
|
||||
import com.keylesspalace.tusky.components.systemnotifications.NotificationHelper
|
||||
import com.keylesspalace.tusky.components.systemnotifications.NotificationService
|
||||
import com.keylesspalace.tusky.db.AccountManager
|
||||
import com.keylesspalace.tusky.db.entity.AccountEntity
|
||||
import com.keylesspalace.tusky.entity.Account
|
||||
|
|
@ -100,12 +100,19 @@ class MainActivityTest {
|
|||
val notificationManager = context.getSystemService(NotificationManager::class.java)
|
||||
val shadowNotificationManager = shadowOf(notificationManager)
|
||||
|
||||
NotificationHelper.createNotificationChannelsForAccount(accountEntity, context)
|
||||
val notificationService = NotificationService(
|
||||
notificationManager,
|
||||
mock {
|
||||
on { areNotificationsEnabled() } doReturn true
|
||||
},
|
||||
mock(),
|
||||
context,
|
||||
)
|
||||
|
||||
notificationService.createNotificationChannelsForAccount(accountEntity)
|
||||
|
||||
runInBackground {
|
||||
val notification = NotificationHelper.makeBaseNotification(
|
||||
context,
|
||||
notificationManager,
|
||||
val notification = notificationService.createBaseNotification(
|
||||
Notification(
|
||||
type = type,
|
||||
id = "id",
|
||||
|
|
@ -161,7 +168,8 @@ class MainActivityTest {
|
|||
api = api,
|
||||
eventHub = eventHub,
|
||||
accountManager = accountManager,
|
||||
shareShortcutHelper = mock()
|
||||
shareShortcutHelper = mock(),
|
||||
notificationService = mock(),
|
||||
)
|
||||
val testViewModelFactory = viewModelFactory {
|
||||
initializer { viewModel }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue