- LogTag.kt: the four tags the app logs under. Eight files each declared one of them as a string. - SNOOZE_HOUR/SNOOZE_DAY sit beside EditorAction.SnoozeReminder; the notification's snooze uses SNOOZE_HOUR instead of its own 60. - Reminders.at reads through ui.epochMillis, the parse the card and the overdue check already use. Checked with ktlint and detekt in the CI image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ import java.io.File
|
|||||||
* [UpdateReceiver], which is why a failure can be shown rather than guessed at.
|
* [UpdateReceiver], which is why a failure can be shown rather than guessed at.
|
||||||
*/
|
*/
|
||||||
object AppUpdate {
|
object AppUpdate {
|
||||||
private const val TAG = "InkwellUpdate"
|
private const val TAG = LogTag.UPDATE
|
||||||
|
|
||||||
/** This build's versionCode — what the server's is compared against. */
|
/** This build's versionCode — what the server's is compared against. */
|
||||||
fun installedVersionCode(context: Context): Long =
|
fun installedVersionCode(context: Context): Long =
|
||||||
|
|||||||
@@ -53,6 +53,6 @@ class InkwellApplication : Application() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val TAG = "Inkwell"
|
const val TAG = LogTag.APP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class KeystoreTokenSeal : TokenSeal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val TAG = "Inkwell"
|
const val TAG = LogTag.APP
|
||||||
const val KEYSTORE = "AndroidKeyStore"
|
const val KEYSTORE = "AndroidKeyStore"
|
||||||
const val ALIAS = "inkwell-device-token"
|
const val ALIAS = "inkwell-device-token"
|
||||||
const val KEY_BITS = 256
|
const val KEY_BITS = 256
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.fabledsword.inkwell
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tags the app logs under, one per concern, so `adb logcat -s` on one of them
|
||||||
|
* finds every line about it whichever file wrote it.
|
||||||
|
*/
|
||||||
|
internal object LogTag {
|
||||||
|
const val APP = "Inkwell"
|
||||||
|
const val UPDATE = "InkwellUpdate"
|
||||||
|
const val REMINDERS = "InkwellReminders"
|
||||||
|
const val WORKER = "InkwellWorker"
|
||||||
|
}
|
||||||
@@ -117,5 +117,5 @@ internal object ReminderNotification {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private const val CHANNEL = "reminders"
|
private const val CHANNEL = "reminders"
|
||||||
private const val TAG = "InkwellReminders"
|
private const val TAG = LogTag.REMINDERS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,6 +67,6 @@ class ReminderReceiver : BroadcastReceiver() {
|
|||||||
const val ACTION_DUE = "com.fabledsword.inkwell.REMINDER_DUE"
|
const val ACTION_DUE = "com.fabledsword.inkwell.REMINDER_DUE"
|
||||||
const val ACTION_DONE = "com.fabledsword.inkwell.REMINDER_DONE"
|
const val ACTION_DONE = "com.fabledsword.inkwell.REMINDER_DONE"
|
||||||
const val ACTION_SNOOZE = "com.fabledsword.inkwell.REMINDER_SNOOZE"
|
const val ACTION_SNOOZE = "com.fabledsword.inkwell.REMINDER_SNOOZE"
|
||||||
private const val TAG = "InkwellReminders"
|
private const val TAG = LogTag.REMINDERS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import android.util.Log
|
|||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
import com.fabledsword.inkwell.core.Inkwell
|
import com.fabledsword.inkwell.core.Inkwell
|
||||||
import com.fabledsword.inkwell.core.Note
|
import com.fabledsword.inkwell.core.Note
|
||||||
import java.time.OffsetDateTime
|
import com.fabledsword.inkwell.ui.SNOOZE_HOUR
|
||||||
|
import com.fabledsword.inkwell.ui.epochMillis
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getting a reminder in front of someone at the time they asked for.
|
* Getting a reminder in front of someone at the time they asked for.
|
||||||
@@ -51,8 +52,7 @@ object Reminders {
|
|||||||
*/
|
*/
|
||||||
private const val MISSED_WINDOW_MS = 24L * 60 * 60 * 1000
|
private const val MISSED_WINDOW_MS = 24L * 60 * 60 * 1000
|
||||||
|
|
||||||
private const val SNOOZE_MINUTES = 60L
|
private const val TAG = LogTag.REMINDERS
|
||||||
private const val TAG = "InkwellReminders"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Announce what is due, then schedule the next one.
|
* Announce what is due, then schedule the next one.
|
||||||
@@ -137,7 +137,7 @@ object Reminders {
|
|||||||
core: Inkwell,
|
core: Inkwell,
|
||||||
noteId: String,
|
noteId: String,
|
||||||
) {
|
) {
|
||||||
runCatching { core.snoozeReminder(noteId, SNOOZE_MINUTES) }
|
runCatching { core.snoozeReminder(noteId, SNOOZE_HOUR) }
|
||||||
.onFailure { Log.w(TAG, "could not snooze reminder", it) }
|
.onFailure { Log.w(TAG, "could not snooze reminder", it) }
|
||||||
ReminderNotification.dismiss(context, noteId)
|
ReminderNotification.dismiss(context, noteId)
|
||||||
}
|
}
|
||||||
@@ -194,10 +194,7 @@ object Reminders {
|
|||||||
// ────────────────────────────── bookkeeping ──────────────────────────────
|
// ────────────────────────────── bookkeeping ──────────────────────────────
|
||||||
|
|
||||||
/** Epoch millis of a note's reminder, or null if it has none we can read. */
|
/** Epoch millis of a note's reminder, or null if it has none we can read. */
|
||||||
private fun at(note: Note): Long? =
|
private fun at(note: Note): Long? = note.remindAt?.let(::epochMillis)
|
||||||
note.remindAt?.let {
|
|
||||||
runCatching { OffsetDateTime.parse(it).toInstant().toEpochMilli() }.getOrNull()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identity of one OCCURRENCE, not of the note.
|
* Identity of one OCCURRENCE, not of the note.
|
||||||
|
|||||||
@@ -67,6 +67,6 @@ class SyncWorker(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val TAG = "InkwellWorker"
|
const val TAG = LogTag.WORKER
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,6 @@ class UpdateReceiver : BroadcastReceiver() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val ACTION_INSTALLED = "com.fabledsword.inkwell.UPDATE_INSTALLED"
|
const val ACTION_INSTALLED = "com.fabledsword.inkwell.UPDATE_INSTALLED"
|
||||||
private const val TAG = "InkwellUpdate"
|
private const val TAG = LogTag.UPDATE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,3 +114,7 @@ sealed interface EditorAction {
|
|||||||
val previewId: String,
|
val previewId: String,
|
||||||
) : EditorAction
|
) : EditorAction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The two snoozes offered: the editor's buttons, and an hour from the notification. */
|
||||||
|
internal const val SNOOZE_HOUR = 60L
|
||||||
|
internal const val SNOOZE_DAY = 1440L
|
||||||
|
|||||||
@@ -447,6 +447,3 @@ fun EditorReminderRow(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val SNOOZE_HOUR = 60L
|
|
||||||
private const val SNOOZE_DAY = 1440L
|
|
||||||
|
|||||||
Reference in New Issue
Block a user