Archie
11/18/2020, 9:19 AMclass Presenter(val view : MyViewContract)
val androidModule = module {
scope<MyActivity> {
// inject current MyActivity
scoped { Presenter(get()) }
}
}
since the activityScope()
is backed inside the ViewModel
:
// Create Activity scope (backed by ViewModel)
override val scope: Scope by lazy { activityScope() }
And the presenter have the reference of the View
wouldn't this leak the Activity
? If I understand it correctly, since the scope
is backed inside a ViewModel
the same instance of Presenter
will be provided when the Activity
did some configuration changes (such as device rotation)... The Activity will be destroyed with its views and a new Activity will be created but.. the presenter is still holding the instance of the destroyed view (View of the Old Activity)...
I am really confuse.arnaud.giuliani
11/18/2020, 9:29 AMnewScope()
arnaud.giuliani
11/18/2020, 9:30 AMactivityScope()
don’t keep source anymorearnaud.giuliani
11/18/2020, 9:30 AMarnaud.giuliani
11/18/2020, 9:30 AMactivityScope
and activityRetrainedScope
Archie
11/18/2020, 9:31 AMactivityRetrainedScope
in koin as well?arnaud.giuliani
11/18/2020, 9:33 AMArchie
11/18/2020, 9:37 AMScopedActivity
also be available inside ScopedFragment
?arnaud.giuliani
11/18/2020, 9:47 AMArchie
11/18/2020, 9:49 AM