Merge pull request #2173 from nextcloud/chore/noid/basecontroller-injected-nullability

NewBaseController: Inject kotlin fields without @JvmField and nullable type
This commit is contained in:
Andy Scherzinger 2022-06-28 21:57:55 +02:00 committed by GitHub
commit cbd7e89828
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,12 +68,10 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
}
@Inject
@JvmField
var appPreferences: AppPreferences? = null
lateinit var appPreferences: AppPreferences
@Inject
@JvmField
var context: Context? = null
lateinit var context: Context
protected open val title: String?
get() = null
@ -93,6 +91,8 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
}
init {
@Suppress("LeakingThis")
sharedApplication!!.componentApplication.inject(this)
addLifecycleListener(object : LifecycleListener() {
override fun postCreateView(controller: Controller, view: View) {
onViewBound(view)
@ -271,7 +271,6 @@ abstract class NewBaseController(@LayoutRes var layoutRes: Int, args: Bundle? =
}
private fun cleanTempCertPreference() {
sharedApplication!!.componentApplication.inject(this)
val temporaryClassNames: MutableList<String> = ArrayList()
temporaryClassNames.add(ServerSelectionController::class.java.name)
temporaryClassNames.add(AccountVerificationController::class.java.name)