adding missing instance of the qr scanner args being passed

This commit is contained in:
Adam Brown 2022-02-22 11:41:47 +00:00
parent 95b3afd148
commit 6998e846f9
2 changed files with 5 additions and 4 deletions

View file

@ -152,7 +152,8 @@ class CreateDirectRoomActivity : SimpleFragmentActivity() {
private val permissionCameraLauncher = registerForPermissionsResult { allGranted, deniedPermanently ->
if (allGranted) {
addFragment(views.container, QrCodeScannerFragment::class.java)
val args = QrScannerArgs(showExtraButtons = false, R.string.add_by_qr_code)
addFragment(views.container, QrCodeScannerFragment::class.java, args)
} else if (deniedPermanently) {
onPermissionDeniedSnackbar(R.string.permissions_denied_qr_code)
}

View file

@ -56,7 +56,7 @@ data class QrScannerArgs(
open class QrCodeScannerFragment @Inject constructor() : VectorBaseFragment<FragmentQrCodeScannerBinding>(), ZXingScannerView.ResultHandler {
private val qrViewModel: QrCodeScannerViewModel by activityViewModel()
private val scannerArgs: QrScannerArgs? by args()
private val scannerArgs: QrScannerArgs by args()
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentQrCodeScannerBinding {
return FragmentQrCodeScannerBinding.inflate(inflater, container, false)
@ -93,13 +93,13 @@ open class QrCodeScannerFragment @Inject constructor() : VectorBaseFragment<Frag
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val title = scannerArgs?.titleRes?.let { getString(it) }
val title = scannerArgs.titleRes.let { getString(it) }
setupToolbar(views.qrScannerToolbar)
.setTitle(title)
.allowBack(useCross = true)
scannerArgs?.showExtraButtons?.let { showButtons ->
scannerArgs.showExtraButtons.let { showButtons ->
views.userCodeMyCodeButton.isVisible = showButtons
views.userCodeOpenGalleryButton.isVisible = showButtons