Avoid crash in SendTransactionFragment.

- The crash was happening because the dialog that verifies the automatic time was being created in onResume, so if the user leaved the application while the fragment was showing and returned to it later another multiple dialogs would be created. The first one to be accepted correctly navigates the user back, but the second creates a crash because references a no longer existing fragment. The dialog creation was moved to onViewCreated instead, so that only one dialog is created.
master
Severiano Jaramillo 2019-10-30 18:19:36 -06:00
parent 4c0f0e7da0
commit d14c10c672
1 changed files with 3 additions and 3 deletions

View File

@ -221,6 +221,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
populatePropertiesFromQRCodeString(Invoice.toQrCode(invoice))
}, 2000) // Wait to let the other elements of the fragment initialize
}
verifyGlobalSettingsTimeAutomatic()
}
/** Handles the selection of items in the Asset spinner, to keep track of the selectedAssetSymbol and show the
@ -592,7 +594,7 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
title(R.string.title__time_sync_error)
message(R.string.msg__time_sync_error)
positiveButton(android.R.string.ok) {
this@SendTransactionFragment.findNavController().navigateUp()
findNavController().navigateUp()
}
cancelable(false)
cancelOnTouchOutside(false)
@ -639,8 +641,6 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
if (isCameraPreviewVisible)
startCameraPreview()
verifyGlobalSettingsTimeAutomatic()
}
override fun onPause() {