Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1590e028c |
@@ -18,7 +18,6 @@ import androidx.core.content.edit
|
|||||||
import de.jeanlucmakiola.agendula.MainActivity
|
import de.jeanlucmakiola.agendula.MainActivity
|
||||||
import de.jeanlucmakiola.agendula.R
|
import de.jeanlucmakiola.agendula.R
|
||||||
import de.jeanlucmakiola.agendula.data.prefs.Settings
|
import de.jeanlucmakiola.agendula.data.prefs.Settings
|
||||||
import de.jeanlucmakiola.agendula.domain.readableDescription
|
|
||||||
import de.jeanlucmakiola.agendula.data.prefs.is24Hour
|
import de.jeanlucmakiola.agendula.data.prefs.is24Hour
|
||||||
import de.jeanlucmakiola.agendula.data.di.ApplicationScope
|
import de.jeanlucmakiola.agendula.data.di.ApplicationScope
|
||||||
import de.jeanlucmakiola.agendula.data.tasks.ProviderResolver
|
import de.jeanlucmakiola.agendula.data.tasks.ProviderResolver
|
||||||
@@ -85,7 +84,6 @@ class TaskNotifier @Inject constructor(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val description = task.description?.readableDescription()?.trim()?.takeIf { it.isNotBlank() }
|
|
||||||
val tapIntent = PendingIntent.getActivity(
|
val tapIntent = PendingIntent.getActivity(
|
||||||
context,
|
context,
|
||||||
task.taskId.toInt(),
|
task.taskId.toInt(),
|
||||||
@@ -95,10 +93,7 @@ class TaskNotifier @Inject constructor(
|
|||||||
val notification = NotificationCompat.Builder(context, channelId)
|
val notification = NotificationCompat.Builder(context, channelId)
|
||||||
.setSmallIcon(R.drawable.ic_notification)
|
.setSmallIcon(R.drawable.ic_notification)
|
||||||
.setContentTitle(title)
|
.setContentTitle(title)
|
||||||
.apply { (text ?: description)?.let(::setContentText) }
|
.apply { if (text != null) setContentText(text) }
|
||||||
.apply {
|
|
||||||
expandedText(text, description)?.let { setStyle(NotificationCompat.BigTextStyle().bigText(it)) }
|
|
||||||
}
|
|
||||||
.setCategory(NotificationCompat.CATEGORY_REMINDER)
|
.setCategory(NotificationCompat.CATEGORY_REMINDER)
|
||||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||||
.setAutoCancel(true)
|
.setAutoCancel(true)
|
||||||
@@ -245,10 +240,3 @@ private fun relativeDay(date: LocalDate, today: LocalDate, words: RelativeDays,
|
|||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The expanded body of a due reminder: the due line, then the task's description. */
|
|
||||||
internal fun expandedText(dueLine: String?, description: String?): String? = when {
|
|
||||||
description == null -> null
|
|
||||||
dueLine == null -> description
|
|
||||||
else -> "$dueLine\n\n$description"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package de.jeanlucmakiola.agendula.data.reminders
|
|
||||||
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
|
||||||
import org.junit.jupiter.api.Test
|
|
||||||
|
|
||||||
class ExpandedTextTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `no description means no expanded body`() {
|
|
||||||
assertThat(expandedText("Due today", null)).isNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `description alone when there is no due line`() {
|
|
||||||
assertThat(expandedText(null, "Buy oat milk")).isEqualTo("Buy oat milk")
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `due line comes first, separated by a blank line`() {
|
|
||||||
assertThat(expandedText("Due today", "Buy oat milk")).isEqualTo("Due today\n\nBuy oat milk")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -54,7 +54,7 @@ xpp3 = "1.1.6"
|
|||||||
# Parses the raw SRV/TXT answers for RFC 6764 discovery; the lookup itself goes
|
# Parses the raw SRV/TXT answers for RFC 6764 discovery; the lookup itself goes
|
||||||
# through Android's DnsResolver, so it follows the network and Private DNS.
|
# through Android's DnsResolver, so it follows the network and Private DNS.
|
||||||
# BSD-3 — it goes on the attribution screen with the rest.
|
# BSD-3 — it goes on the attribution screen with the rest.
|
||||||
dnsjava = "3.6.3"
|
dnsjava = "3.6.5"
|
||||||
# WebDAV-Push delivery. The connector only: DAVx5 also ships the embedded FCM
|
# WebDAV-Push delivery. The connector only: DAVx5 also ships the embedded FCM
|
||||||
# distributor, which pulls in Play Services and would get us flagged on F-Droid.
|
# distributor, which pulls in Play Services and would get us flagged on F-Droid.
|
||||||
unifiedpush = "3.3.5"
|
unifiedpush = "3.3.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user