-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hi
I'm using the following code to launch the Zettle Settings screen, where the user can connect a payment device. After the device is connected, I expect the result to be returned to the ActivityResultLauncher so I can save the connected device. However, the callback is not triggered after connecting a device. It only triggers (with a cancel state) after the user manually presses the back arrow in the Settings screen.
val connectLauncher =
rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { activityResult ->
if (activityResult.resultCode != Activity.RESULT_OK) {
return@rememberLauncherForActivityResult
}
when (activityResult.data?.zettleResult()) {
is ZettleResult.Completed<*> -> {
viewModel.dispatchIntent(ConnectPaymentDeviceIntent.SaveDevice)
}
else -> {}
}
}
val intent = CardReaderAction.Settings.show(context)
connectLauncher.launch(intent)
Expected behavior:
After the user connects a device via the Zettle Settings screen, the result should be returned, triggering the ZettleResult.Completed case.