First test if resultCode == Activity.RESULT_OK
This commit is contained in:
parent
b8c350488b
commit
a6cf2b0685
@ -322,41 +322,45 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor(
|
|||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
if (requestCode == REQUEST_CODE_SAVE_MEGOLM_EXPORT) {
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
val uri = data?.data
|
when (requestCode) {
|
||||||
if (resultCode == Activity.RESULT_OK && uri != null) {
|
REQUEST_CODE_SAVE_MEGOLM_EXPORT -> {
|
||||||
activity?.let { activity ->
|
val uri = data?.data
|
||||||
ExportKeysDialog().show(activity, object : ExportKeysDialog.ExportKeyDialogListener {
|
if (uri != null) {
|
||||||
override fun onPassphrase(passphrase: String) {
|
activity?.let { activity ->
|
||||||
displayLoadingView()
|
ExportKeysDialog().show(activity, object : ExportKeysDialog.ExportKeyDialogListener {
|
||||||
|
override fun onPassphrase(passphrase: String) {
|
||||||
|
displayLoadingView()
|
||||||
|
|
||||||
KeysExporter(session)
|
KeysExporter(session)
|
||||||
.export(requireContext(),
|
.export(requireContext(),
|
||||||
passphrase,
|
passphrase,
|
||||||
uri,
|
uri,
|
||||||
object : MatrixCallback<Boolean> {
|
object : MatrixCallback<Boolean> {
|
||||||
override fun onSuccess(data: Boolean) {
|
override fun onSuccess(data: Boolean) {
|
||||||
if (data) {
|
if (data) {
|
||||||
requireActivity().toast(getString(R.string.encryption_exported_successfully))
|
requireActivity().toast(getString(R.string.encryption_exported_successfully))
|
||||||
} else {
|
} else {
|
||||||
requireActivity().toast(getString(R.string.unexpected_error))
|
requireActivity().toast(getString(R.string.unexpected_error))
|
||||||
}
|
}
|
||||||
hideLoadingView()
|
hideLoadingView()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(failure: Throwable) {
|
override fun onFailure(failure: Throwable) {
|
||||||
onCommonDone(failure.localizedMessage)
|
onCommonDone(failure.localizedMessage)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
PinActivity.PIN_REQUEST_CODE -> {
|
||||||
|
doOpenPinCodePreferenceScreen()
|
||||||
|
}
|
||||||
|
REQUEST_E2E_FILE_REQUEST_CODE -> {
|
||||||
|
importKeys(data)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (requestCode == PinActivity.PIN_REQUEST_CODE) {
|
|
||||||
doOpenPinCodePreferenceScreen()
|
|
||||||
} else if (requestCode == REQUEST_E2E_FILE_REQUEST_CODE) {
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
importKeys(data)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user