Files
LLeMbas-Android/app/src/main/java/eu/llembas/android/LembasApp.kt
T
HomerandClaude Opus 5.5 0c77109a73
CI / check (push) Canceled after 0s
Update check: the public GitHub releases, daily on start and from Settings › About
ReleaseCheck reads api.github.com's list of this repository's releases over
plain HTTPS, compares with the installed version (a beta sorts below its
release; -debug is left off), and offers the newest one the person may have:
betas only to a beta install or with Include betas on. On start it runs at
most once a day while Look for new versions is on (default: on in a beta, off
in a release) and announces a version once, in a notification on its own low
channel that opens the release page. Check for an update works in both
builds; the full build's own installer stays for a found release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 12:11:42 +00:00

42 lines
2.0 KiB
Kotlin

package eu.llembas.android
import android.app.Application
import android.app.NotificationChannel
import android.app.NotificationManager
import eu.llembas.android.auth.InstanceStore
/** The process: one store of instances, and the notification channels, made once. */
class LembasApp : Application() {
lateinit var instances: InstanceStore
private set
override fun onCreate() {
super.onCreate()
instances = InstanceStore(this)
val manager = getSystemService(NotificationManager::class.java)
manager.createNotificationChannels(
listOf(
NotificationChannel(CHANNEL_REPLIES, getString(R.string.channel_replies), NotificationManager.IMPORTANCE_DEFAULT),
NotificationChannel(CHANNEL_ASKS, getString(R.string.channel_asks), NotificationManager.IMPORTANCE_HIGH),
NotificationChannel(CHANNEL_SCHEDULED, getString(R.string.channel_scheduled), NotificationManager.IMPORTANCE_DEFAULT),
NotificationChannel(CHANNEL_SCHEDULED_FAILURES, getString(R.string.channel_scheduled_failures), NotificationManager.IMPORTANCE_HIGH),
).onEach { it.lockscreenVisibility = android.app.Notification.VISIBILITY_PRIVATE } +
// A new version of the app says nothing about the account.
NotificationChannel(CHANNEL_UPDATES, getString(R.string.channel_updates), NotificationManager.IMPORTANCE_LOW),
)
// LLeMbas 2.0 has no reports, so 0.1's channel for them goes rather than sit empty in
// the system's settings.
manager.deleteNotificationChannel("reports")
}
companion object {
const val CHANNEL_REPLIES = "replies"
const val CHANNEL_ASKS = "asks"
const val CHANNEL_SCHEDULED = "scheduled_results"
const val CHANNEL_SCHEDULED_FAILURES = "scheduled_failures"
const val CHANNEL_UPDATES = "updates"
}
}
val android.content.Context.lembas: LembasApp get() = applicationContext as LembasApp