mirror of
https://github.com/d4rken-org/capod.git
synced 2026-09-14 18:26:11 -04:00
ui(monitor): Give the early service notification a content text
This commit is contained in:
@@ -170,6 +170,7 @@ class MonitorNotifications @Inject constructor(
|
||||
setContentIntent(openPi)
|
||||
setSmallIcon(R.drawable.device_earbuds_generic_both)
|
||||
setContentTitle(context.getString(R.string.app_name))
|
||||
setContentText(context.getString(R.string.monitor_notification_starting))
|
||||
setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
setOngoing(true)
|
||||
}.build()
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
<string name="notification_channel_device_status_label">Device status</string>
|
||||
<string name="notification_channel_device_status_connected_label">Connected device</string>
|
||||
<string name="monitor_notification_extra_enabled_hint">You can disable this notification in system settings.</string>
|
||||
<string name="monitor_notification_starting">Starting up…</string>
|
||||
|
||||
<string name="support_debuglog_label">Debug log</string>
|
||||
<string name="support_debuglog_desc">Record everything the app is doing into a text file that you can share.</string>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package eu.darken.capod.monitor.ui
|
||||
|
||||
import android.app.Application
|
||||
import android.app.Notification
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(manifest = Config.NONE, sdk = [34], application = Application::class)
|
||||
class MonitorNotificationsTest {
|
||||
|
||||
@Test
|
||||
fun `early notification is user presentable`() {
|
||||
// It can be the notification the user sees for the whole lifetime of a service that never
|
||||
// finishes starting up, so it has to stand on its own.
|
||||
val notification = MonitorNotifications.createEarlyNotification(RuntimeEnvironment.getApplication())
|
||||
|
||||
notification.extras.getString(Notification.EXTRA_TITLE).isNullOrBlank() shouldBe false
|
||||
notification.extras.getString(Notification.EXTRA_TEXT).isNullOrBlank() shouldBe false
|
||||
notification.smallIcon shouldNotBe null
|
||||
notification.contentIntent shouldNotBe null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user