Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add permission duration to connect from panel on desktop #20008

Merged
merged 5 commits into from
Oct 6, 2023

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Sep 5, 2023

Resolves brave/brave-browser#32643

When users click on connect, we will create a permission request same as dapp request permission and rest of the flow is the same.
This also deprecates AddPermission API to prevent permission is being added without permission duration tracking.

@AlexeyBarabash addressed AddPermission deprecation on Android
@Douglashdaniel added active account indicator to v2 panel on desktop

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Panel Permission duration

  1. Make sure there is nothing blocked in Ethereum/Solana content setting
  2. Navigate to https://example.com/
  3. Open panel and select Ethereum network and click "Connect"
  4. After selecting account to connect, we should be able to select permission duration
  5. Select "Until I close this site"
  6. Navigate to brave://settings/content/ethereum and permission should be set
  7. Repeat step 3-6 with Solana
  8. Close the example.com tab
  9. Open both brave://settings/content/ethereum and brave://settings/content/solana
  10. Wait approximately 30s, the previous granted permissions should be gone.

Active account indicator

  1. Go to https://bbondy.github.io/eth-manual-tests/request.html and connect a bunch of accounts
  2. Open the Wallet Panel and then open DApp Connection Settings
  3. Click on the Account selector.
  4. There should be an Active indicator for the current selected account
  5. Test switching between account, the Active indicator should update correctly.
Screen.Recording.10.mov

@github-actions github-actions bot added CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet feature/web3/wallet/core labels Sep 5, 2023
@darkdh darkdh force-pushed the permission-duration-panel-connect branch from 8bc7f5d to dfbc4e9 Compare September 5, 2023 22:52
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh force-pushed the permission-duration-panel-connect branch from 025f593 to 857f4fe Compare September 14, 2023 22:11
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh force-pushed the permission-duration-panel-connect branch from 857f4fe to 3ca0a42 Compare September 14, 2023 23:56
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh force-pushed the permission-duration-panel-connect branch from ee601a0 to 8c0899c Compare September 15, 2023 21:47
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh force-pushed the permission-duration-panel-connect branch from 8c0899c to d239b7a Compare September 15, 2023 23:03
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh marked this pull request as ready for review September 15, 2023 23:33
@darkdh darkdh requested review from a team as code owners September 15, 2023 23:33
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@fmarier fmarier removed their assignment Sep 18, 2023
Copy link
Member

@yrliou yrliou left a comment

Choose a reason for hiding this comment

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

C++ core changes ++


base::android::ScopedJavaLocalRef<jobject> GetJavaBoolean(
JNIEnv* env,
const bool& native_bool) {
Copy link
Member

Choose a reason for hiding this comment

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

just bool native_bool

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

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

++ Android side

@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

Copy link
Collaborator

@StephenHeaps StephenHeaps left a comment

Choose a reason for hiding this comment

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

iOS++

Copy link
Contributor

@josheleonard josheleonard left a comment

Choose a reason for hiding this comment

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

Frontend approved with suggestions

Comment on lines +189 to +193
handler.on(PanelActions.requestSitePermission.type,
async(store: Store, payload: RequestSitePermissionPayloadType) => {
const apiProxy = getWalletPanelApiProxy()
await apiProxy.panelHandler.requestPermission(payload.accountId)
})
Copy link
Contributor

Choose a reason for hiding this comment

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

can this go in a mutation instead?

Copy link
Member

Choose a reason for hiding this comment

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

Since this works, I suggest merging it as-is and we can convert the handler to a mutation in another PR.

@darkdh darkdh force-pushed the permission-duration-panel-connect branch from bd33833 to 0f53daf Compare October 5, 2023 23:29
@darkdh darkdh enabled auto-merge October 5, 2023 23:30
@darkdh darkdh force-pushed the permission-duration-panel-connect branch from 0f53daf to 09165d5 Compare October 6, 2023 00:23
@brave-builds
Copy link
Collaborator

A Storybook has been deployed to preview UI for the latest push

@darkdh darkdh merged commit 5128052 into master Oct 6, 2023
15 checks passed
@darkdh darkdh deleted the permission-duration-panel-connect branch October 6, 2023 05:06
@github-actions github-actions bot added this to the 1.61.x - Nightly milestone Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/storybook-url Deploy storybook and provide a unique URL for each build feature/web3/wallet/core feature/web3/wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Account selection is not available in V2 panel