<commit_before>class @WalletPairingProgressDialogViewController extends DialogViewController

  view:
    contentContainer: "#content_container"

  onAfterRender: ->
    super
    # launch request
    @_request = @params.request
    @_request?.onComplete (screen, error) =>
      @_request = null
      if screen?
        dialog = new CommonDialogsMessageDialogViewController(kind: "success", title: t("wallet.pairing.errors.pairing_succeeded"), subtitle: _.str.sprintf(t("wallet.pairing.errors.dongle_is_now_paired"), screen.name))
      else
        dialog = new CommonDialogsMessageDialogViewController(kind: "error", title: t("wallet.pairing.errors.pairing_failed"), subtitle: t("wallet.pairing.errors." + error))
      dialog.show()
    @_request?.on 'finalizing', @_onFinalizing
    # show spinner
    @view.spinner = ledger.spinners.createLargeSpinner(@view.contentContainer[0])

  onDetach: ->
    super
    @_request?.off 'finalizing', @_onFinalizing

  onDismiss: ->
    super
    @_request?.cancel()

  _onFinalizing: ->
    ledger.m2fa.PairedSecureScreen.getScreensByUuidFromSyncedStore @_request.getDeviceUuid(), (screens, error) =>
      if screens?.length is 0
        @getDialog().push new WalletPairingFinalizingDialogViewController(request: @_request)
      else
        @_request.setSecureScreenName(screens[0].name)<commit_msg>Fix "don't dismiss pairing progress dialog when displaying success"<commit_after>class @WalletPairingProgressDialogViewController extends DialogViewController

  view:
    contentContainer: "#content_container"

  onAfterRender: ->
    super
    # launch request
    @_request = @params.request
    @_request?.onComplete (screen, error) =>
      @_request = null
      @dismiss () =>
        if screen?
          dialog = new CommonDialogsMessageDialogViewController(kind: "success", title: t("wallet.pairing.errors.pairing_succeeded"), subtitle: _.str.sprintf(t("wallet.pairing.errors.dongle_is_now_paired"), screen.name))
        else
          dialog = new CommonDialogsMessageDialogViewController(kind: "error", title: t("wallet.pairing.errors.pairing_failed"), subtitle: t("wallet.pairing.errors." + error))
        dialog.show()
    @_request?.on 'finalizing', @_onFinalizing
    # show spinner
    @view.spinner = ledger.spinners.createLargeSpinner(@view.contentContainer[0])

  onDetach: ->
    super
    @_request?.off 'finalizing', @_onFinalizing

  onDismiss: ->
    super
    @_request?.cancel()

  _onFinalizing: ->
    ledger.m2fa.PairedSecureScreen.getScreensByUuidFromSyncedStore @_request.getDeviceUuid(), (screens, error) =>
      if screens?.length is 0
        @getDialog().push new WalletPairingFinalizingDialogViewController(request: @_request)
      else
        @_request.setSecureScreenName(screens[0].name)
{'fraction_non_alphanumeric': 0.11514933429291112, 'fraction_numerical': 0.0028787333573227778, 'mean_word_length': 4.16728624535316, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '834660', 'n_tokens_mistral': 854, 'n_tokens_neox': 826, 'n_words': 148}