Matter QR code scanner UI (MatterAddDeviceRequest) close event

Our smart home app is integrating Matter as a way to add devices to the user's home. The implementation is pretty standard, here is the main part:

Code

 var setupPayload: MTRSetupPayload?

      if let onboardingPayload = onboardingPayload {
        setupPayload = try MTRSetupPayload(onboardingPayload: onboardingPayload)
      }
      

      let topology = MatterAddDeviceRequest.Topology(

        ecosystemName: ecosystemName,

        homes: [MatterAddDeviceRequest.Home(displayName: homeDisplayName)])

      let request = MatterAddDeviceRequest(topology: topology,

      setupPayload: setupPayload)


      do {

        try await request.perform()

          print("Success")

      } catch {

          print("Failure")

      }

Issue

If the user decides to press the close button on the UI, the iOS treats it as a success. This use case messes with our flow as we have different paths in the app for success and failures.

I would normally expect that if the user cancels something there is a callback that enables the developers to handle it properly. I've researched a lot on this topic but unfortunately I wasn't able to find anything helpful.

Any advice on how to resolve this is much appreciated. Thanks in advance

P.S.

Yes we have implemented the MatterRequestExtension and all the handlers, the commissioning part works fine, we are able to add a Matter device and control it with our app, this issue happens before scanning the QR code.