-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Here is how I integrate NC SSO:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (resultCode) {
AppCompatActivity.RESULT_CANCELED -> setButtonsEnabled(true)
else -> {
AccountImporter.onActivityResult(
requestCode,
resultCode,
data,
this,
) { onNextcloudAccountAccessGranted(it) }
}
}
}It works fine, except for showing deprecation warnings:
'onActivityResult(Int, Int, Intent?): Unit' is deprecated. Deprecated in Java
This method has been deprecated in favor of using the Activity Result API which brings increased type safety via an ActivityResultContract and the prebuilt contracts for common intents available in androidx.activity.result.contract.ActivityResultContracts, provides hooks for testing, and allow receiving results in separate, testable classes independent from your fragment. Use registerForActivityResult(ActivityResultContract, ActivityResultCallback) with the appropriate ActivityResultContract and handling the result in the callback.
It looks like the modern way to get a SingleSignOnAccount is to create an ActivityResultContract<Nothing, SingleSignOnAccount> or something like that and to ship it with the library. Are there any reasons for not supporting Activity Result API except for the lack of dev time?