File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
multipaz-compose/src/commonMain/kotlin/org/multipaz/compose/presentment
samples/testapp/src/commonMain/kotlin/org/multipaz/testapp Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,11 @@ import org.multipaz.models.presentment.MdocPresentmentMechanism
2828import org.multipaz.models.presentment.PresentmentModel
2929import org.multipaz.models.presentment.PresentmentSource
3030import org.multipaz.prompt.PromptModel
31+ import org.multipaz.util.Logger
3132import org.multipaz.util.toBase64Url
3233
34+ private const val TAG = " MdocProximityQrPresentment"
35+
3336/* *
3437 * A composable for presentment with QR engagement according to ISO/IEC 18013-5:2021.
3538 *
@@ -45,6 +48,9 @@ import org.multipaz.util.toBase64Url
4548 * includes showing consent and authentication dialogs. When the reader disconnects [presentmentModel]
4649 * goes to state [PresentmentModel.State.IDLE] and [showQrButton] composable is shown.
4750 *
51+ * Applications should call [PresentmentModel.reset] before entering the composition containing this
52+ * composable.
53+ *
4854 * @param modifier a [Modifier].
4955 * @param appName the name of the application.
5056 * @param appIconPainter the icon for the application.
@@ -123,6 +129,10 @@ fun MdocProximityQrPresentment(
123129 }
124130
125131 PresentmentModel .State .CONNECTING -> {
132+ if (qrCodeToShow.value == null ) {
133+ Logger .w(TAG , " No QR code. Did you forget to reset the PresentmentModel before " +
134+ " entering the composition containing this MdocProximityQrPresentment?" )
135+ }
126136 qrCodeToShow.value?.let {
127137 showQrCode(it)
128138 }
Original file line number Diff line number Diff line change @@ -886,7 +886,10 @@ class App private constructor (val promptModel: PromptModel) {
886886 onClickConsentSheetList = { navController.navigate(ConsentPromptDestination .route) },
887887 onClickQrCodes = { navController.navigate(QrCodesDestination .route) },
888888 onClickNfc = { navController.navigate(NfcDestination .route) },
889- onClickIsoMdocProximitySharing = { navController.navigate(IsoMdocProximitySharingDestination .route) },
889+ onClickIsoMdocProximitySharing = {
890+ presentmentModel.reset()
891+ navController.navigate(IsoMdocProximitySharingDestination .route)
892+ },
890893 onClickIsoMdocProximityReading = { navController.navigate(IsoMdocProximityReadingDestination .route) },
891894 onClickDcRequest = { navController.navigate(DcRequestDestination .route) },
892895 onClickMdocTransportMultiDeviceTesting = { navController.navigate(IsoMdocMultiDeviceTestingDestination .route) },
You can’t perform that action at this time.
0 commit comments