Details

      Description

      When we invoke the cordova Barcode plugin, it is always called twice!

      I have only looked at the code a short time, but it appears to me that:

      • the first call to Barcode happens, and in iosExec, it gets placed in commandQueue.
      • the first call passes to Objective C world by WKScriptMessageHandler - (void)userContentController:(WKUserContentController*)userContentController didReceiveScriptMessage:(WKScriptMessage*)message
      • this call to Barcode does its thing, completes, and it's javascript response handler code winds through:
        CDVCommandDelegateImpl::sendPluginResult
        CDVCommandDelegateImpl::evalJSHelper
        CDVCommandDelegateImpl::evalJSHelper2
      • in Helper2, the callback is finally passed to a webViewEngine, which processes the Javascript, and returns, on completion, a list of commands remaining in the javascript commandQueue.
      • these commands are queued on the Obj-C side and run in CDVCommandQueue fashion.

      AHA!

      • since the command was persisted in commandQueue before execution, and not removed, it is called again!

      SO

      I moved the enqueue behavior into the branch that excludes bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING
      This fixes it, but I am not confident its the right solution.

      Do you have any insight into this problem?
      Feedback for my solution?
      A broader or more appropriate venue for the conversation?

      Thanks!
      Alex Mouton

        Attachments

          Activity

            People

            • Assignee:
              shazron Shazron Abdullah
              Reporter:
              mouton Thomas Mouton
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 4h
                4h
                Remaining:
                Remaining Estimate - 4h
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified