mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +00:00
Implement a hook allowing enterprise modules to perform actions on startup
Add an interface `io.element.android.features.enterprise.api.AppStartupHook`, which can be implemented in the enterprise build to perform certain actions on startup. It's a bit of a kludge for now since it doesn't block the rest of the app from proceeding, but it will serve our purposes for now.
This commit is contained in:
@@ -61,6 +61,13 @@ class MainActivity : NodeActivity() {
|
||||
setContent {
|
||||
MainContent(appBindings)
|
||||
}
|
||||
|
||||
val activity = this
|
||||
appBindings.appStartupHooks().forEach {
|
||||
lifecycleScope.launch {
|
||||
it.onAppStartup(activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
@@ -10,7 +10,9 @@ package io.element.android.x.di
|
||||
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.ContributesTo
|
||||
import dev.zacsweers.metro.Multibinds
|
||||
import io.element.android.features.api.MigrationEntryPoint
|
||||
import io.element.android.features.enterprise.api.AppStartupHook
|
||||
import io.element.android.features.enterprise.api.EnterpriseService
|
||||
import io.element.android.features.lockscreen.api.LockScreenEntryPoint
|
||||
import io.element.android.features.lockscreen.api.LockScreenService
|
||||
@@ -51,4 +53,7 @@ interface AppBindings {
|
||||
fun buildMeta(): BuildMeta
|
||||
|
||||
fun sentrySdkDsn(): SentrySdkDsn?
|
||||
|
||||
@Multibinds(allowEmpty = true)
|
||||
fun appStartupHooks(): Set<AppStartupHook>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user