Skip to content

fix: Add delay in checkPermissions for iOS to prevent UI crash#14602

Merged
abretonc7s merged 3 commits into
mainfrom
fix/sdkiosconnect
Apr 11, 2025
Merged

fix: Add delay in checkPermissions for iOS to prevent UI crash#14602
abretonc7s merged 3 commits into
mainfrom
fix/sdkiosconnect

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Apr 11, 2025

Copy link
Copy Markdown
Contributor

Description

This PR addresses a UI crash on iOS in AccountConnect.tsx caused by a race condition in permissionsController.getPermissions().

  • Added await wait(100) in checkPermissions for iOS to resolve the race condition.

Debugging Notes

This issue was tricky to debug as it occurred more frequently in live DEV environments. Eventually, I tracked it down by launching the app via Xcode instead of the regular React Native CLI, which provided access to all native logs and revealed the race condition.

Related issues

Fixes:

Manual testing steps

  • Verified on iOS: UI crash no longer occurs.
  • Confirmed no impact on Android.

Screenshots/Recordings

Before

image

After

  • normal connection flow

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

This update introduces a delay in the checkPermissions function specifically for iOS to address a race condition that causes a UI crash when the approvalPromise is resolved. The delay helps ensure smoother handling of permission requests and improves overall stability.
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-sdk-deprecated DEPRECATED: please use "team-wallet-integrations" instead label Apr 11, 2025
@abretonc7s abretonc7s added the No QA Needed Apply this label when your PR does not need any QA effort. label Apr 11, 2025
@abretonc7s abretonc7s marked this pull request as ready for review April 11, 2025 09:13
@abretonc7s abretonc7s requested a review from a team as a code owner April 11, 2025 09:13
This update adds platform-specific mocks for the checkPermissions tests, ensuring consistent behavior across iOS and Android. It introduces a delay for iOS after permission approval to prevent UI crashes and verifies that no delay occurs on Android. The tests are structured to validate these behaviors effectively.

@chakra-guy chakra-guy left a comment

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.

LGTM

@github-actions

github-actions Bot commented Apr 11, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: e87ce56
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/074d6934-1c51-4072-98aa-2fee59f9f80d

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@sonarqubecloud

Copy link
Copy Markdown

@abretonc7s abretonc7s enabled auto-merge April 11, 2025 10:28
@abretonc7s abretonc7s added this pull request to the merge queue Apr 11, 2025
Merged via the queue into main with commit a6c46e6 Apr 11, 2025
@abretonc7s abretonc7s deleted the fix/sdkiosconnect branch April 11, 2025 10:48
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 11, 2025
@metamaskbot metamaskbot added the release-7.46.0 Issue or pull request that will be included in release 7.46.0 label Apr 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.46.0 Issue or pull request that will be included in release 7.46.0 team-sdk-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants