-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.kt
More file actions
31 lines (26 loc) · 934 Bytes
/
App.kt
File metadata and controls
31 lines (26 loc) · 934 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package to.bitkit
import android.annotation.SuppressLint
import android.app.Application
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import to.bitkit.env.Env
import javax.inject.Inject
@HiltAndroidApp
internal open class App : Application(), Configuration.Provider {
@Inject
lateinit var workerFactory: HiltWorkerFactory
override val workManagerConfiguration
get() = Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
override fun onCreate() {
super.onCreate()
lifecycle = AppLifecycle().also { registerActivityLifecycleCallbacks(it) }
Env.initAppStoragePath(filesDir.absolutePath)
}
companion object {
@SuppressLint("StaticFieldLeak") // Should be safe given the manual memory management
internal var lifecycle: AppLifecycle? = null
}
}