Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Connection status active in the desktop app while extension presents connection error #292

Merged
vinistevam merged 7 commits intomain-desktopfrom
fix/261-connection-status-active-desktop-extension-error
Dec 12, 2022
Merged

Connection status active in the desktop app while extension presents connection error #292
vinistevam merged 7 commits intomain-desktopfrom
fix/261-connection-status-active-desktop-extension-error

Conversation

@vinistevam
Copy link
Copy Markdown
Contributor

@vinistevam vinistevam commented Dec 2, 2022

Overview

Whenever the Desktop app is paired with extension "1" and extension "2" tries to access the OTP screen it triggers a test connection that should not remain active if the pairing key does not match. It should throw an error that activates a warning to the user as explained in the example below:

image

Changes

Extension

  • added pairing key check when fires testConnection
  • send an errorCode into the webSocket close event to avoid calling the hook when disconnects
  • UI - created warning and added logic to show whenever testConnection indicates
  • add a deep link to the settings page
  • Wrapped OTP to copy to clipboard onclick
  • Changed Sync to Pair as we are using pairing in the notification and also through the code

Issues

Resolves #261 #135 #294

@vinistevam vinistevam changed the title Fix/261 connection status active desktop extension error Connection status active in desktop app while extension present connection error Dec 2, 2022
@vinistevam vinistevam force-pushed the fix/261-connection-status-active-desktop-extension-error branch 2 times, most recently from ec2efed to 3c2a36c Compare December 2, 2022 13:35
@vinistevam vinistevam changed the title Connection status active in desktop app while extension present connection error Connection status active in the desktop app while extension presents connection error Dec 5, 2022
@vinistevam vinistevam marked this pull request as ready for review December 5, 2022 16:05
@vinistevam vinistevam requested a review from a team December 5, 2022 16:05
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to always validate isPairingKeyPresent.. IMO it becomes easier to read if we do that on the top. Something like:

    if (!isPairingKeyPresent(testResult)) {
      if (!testResult.isConnected) {
        history.push(DESKTOP_ERROR_NOT_FOUND_ROUTE);
        return;
      }
  
      if (!testResult.versionCheck?.isExtensionVersionValid) {
        history.push(DESKTOP_ERROR_EXTENSION_OUTDATED_ROUTE);
        return;
      }
  
      if (!testResult.versionCheck?.isDesktopVersionValid) {
        history.push(DESKTOP_ERROR_DESKTOP_OUTDATED_ROUTE);
        return;
      }
    }

    if (process.env.SKIP_OTP_PAIRING_FLOW) {
      showLoader();
      setDesktopEnabled(true);
      // Wait for new state to persist before restarting
      setTimeout(() => {
        restart();
      }, SKIP_PAIRING_RESTART_DELAY);
      return;
    }

    if (isPairingKeyPresent(testResult)) {
      setDisplayWarning(t('desktopPairedWarningDeepLink'));
    }

    history.push(DESKTOP_PAIRING_ROUTE);

what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @cryptotavares I'm pushing this change.

@vinistevam vinistevam force-pushed the fix/261-connection-status-active-desktop-extension-error branch 3 times, most recently from 4972f6f to 9e35c17 Compare December 7, 2022 16:30
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on local, LGTM 🚀🚀🚀

@vinistevam vinistevam force-pushed the fix/261-connection-status-active-desktop-extension-error branch 6 times, most recently from f190005 to ddddce3 Compare December 9, 2022 12:57
@vinistevam vinistevam force-pushed the fix/261-connection-status-active-desktop-extension-error branch from ddddce3 to ec3a5c9 Compare December 12, 2022 14:06
@vinistevam vinistevam merged commit aedb7c0 into main-desktop Dec 12, 2022
@vinistevam vinistevam deleted the fix/261-connection-status-active-desktop-extension-error branch December 12, 2022 18:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix bug where connection status is displayed as active in the desktop app while the extension is showing a connection error

3 participants