Files
harheimertc/android-app/app/src/main/java/de/harheimertc/HarheimerApplication.kt
Torsten Schulz (local) 5da11d2e4d
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 7m50s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped
Fix in news, first android notification service
2026-06-10 13:47:33 +02:00

52 lines
1.7 KiB
Kotlin

package de.harheimertc
import android.app.Application
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.disk.DiskCache
import coil.memory.MemoryCache
import dagger.hilt.android.HiltAndroidApp
import de.harheimertc.notifications.HarheimerNotifications
import io.sentry.Sentry
import okhttp3.OkHttpClient
import javax.inject.Inject
import android.util.Log
@HiltAndroidApp
class HarheimerApplication : Application(), ImageLoaderFactory {
@Inject
lateinit var okHttpClient: OkHttpClient
override fun onCreate() {
Log.d("HILT", "HarheimerApplication.onCreate called")
super.onCreate()
HarheimerNotifications.createChannels(this)
if (BuildConfig.SENTRY_DSN.isNotBlank()) {
Sentry.init { options ->
options.dsn = BuildConfig.SENTRY_DSN
options.environment = BuildConfig.ENVIRONMENT_NAME.ifBlank { "production" }
options.release = "${BuildConfig.APPLICATION_ID}@${BuildConfig.VERSION_NAME}+${BuildConfig.VERSION_CODE}"
options.isEnableAutoSessionTracking = true
options.tracesSampleRate = 0.05
}
}
}
override fun newImageLoader(): ImageLoader =
ImageLoader.Builder(this)
.okHttpClient(okHttpClient)
.memoryCache {
MemoryCache.Builder(this)
.maxSizePercent(0.20)
.build()
}
.diskCache {
DiskCache.Builder()
.directory(cacheDir.resolve("image_cache"))
.maxSizeBytes(75L * 1024L * 1024L)
.build()
}
.crossfade(true)
.build()
}