Remove other useless lazy wrapping.
This commit is contained in:
parent
a1b97fe99e
commit
f6d7a014a7
4 changed files with 25 additions and 32 deletions
|
|
@ -32,18 +32,16 @@ import io.element.android.libraries.di.AppScope
|
|||
class NotificationsOptInNode @AssistedInject constructor(
|
||||
@Assisted buildContext: BuildContext,
|
||||
@Assisted plugins: List<Plugin>,
|
||||
private val presenterFactory: NotificationsOptInPresenter.Factory,
|
||||
presenterFactory: NotificationsOptInPresenter.Factory,
|
||||
) : Node(buildContext, plugins = plugins) {
|
||||
|
||||
interface Callback: NodeInputs {
|
||||
interface Callback : NodeInputs {
|
||||
fun onNotificationsOptInFinished()
|
||||
}
|
||||
|
||||
private val callback = inputs<Callback>()
|
||||
|
||||
private val presenter: NotificationsOptInPresenter by lazy {
|
||||
presenterFactory.create(callback)
|
||||
}
|
||||
private val presenter: NotificationsOptInPresenter = presenterFactory.create(callback)
|
||||
|
||||
@Composable
|
||||
override fun View(modifier: Modifier) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import kotlinx.coroutines.CoroutineScope
|
|||
import kotlinx.coroutines.launch
|
||||
|
||||
class NotificationsOptInPresenter @AssistedInject constructor(
|
||||
private val permissionsPresenterFactory: PermissionsPresenter.Factory,
|
||||
permissionsPresenterFactory: PermissionsPresenter.Factory,
|
||||
@Assisted private val callback: NotificationsOptInNode.Callback,
|
||||
private val appCoroutineScope: CoroutineScope,
|
||||
private val permissionStateProvider: PermissionStateProvider,
|
||||
|
|
@ -46,14 +46,13 @@ class NotificationsOptInPresenter @AssistedInject constructor(
|
|||
fun create(callback: NotificationsOptInNode.Callback): NotificationsOptInPresenter
|
||||
}
|
||||
|
||||
private val postNotificationPermissionsPresenter by lazy {
|
||||
private val postNotificationPermissionsPresenter: PermissionsPresenter =
|
||||
// Ask for POST_NOTIFICATION PERMISSION on Android 13+
|
||||
if (buildVersionSdkIntProvider.isAtLeast(Build.VERSION_CODES.TIRAMISU)) {
|
||||
permissionsPresenterFactory.create(Manifest.permission.POST_NOTIFICATIONS)
|
||||
} else {
|
||||
NoopPermissionsPresenter()
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
override fun present(): NotificationsOptInState {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue