-
Notifications
You must be signed in to change notification settings - Fork 918
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
feat(wallet): Use Wallet WebUI for Send & Swap on iOS #24328
base: master
Are you sure you want to change the base?
Conversation
A Storybook has been deployed to preview UI for the latest push |
57c3b89
to
ac8e3e5
Compare
A Storybook has been deployed to preview UI for the latest push |
ac8e3e5
to
e797477
Compare
A Storybook has been deployed to preview UI for the latest push |
e797477
to
863a9f5
Compare
A Storybook has been deployed to preview UI for the latest push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with nits
@@ -387,4 +394,4 @@ export default class Amount { | |||
|
|||
return formatter.format(value) + abbreviation | |||
} | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing EOF new-line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 603c091
|
||
return `rgba(${r},${g},${b},0.2)` | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing EOF new line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 603c091
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grd
++
A Storybook has been deployed to preview UI for the latest push |
603c091
to
a4a6bc2
Compare
A Storybook has been deployed to preview UI for the latest push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was very difficult to save Slippage tolerance (or im not sure its saved or not)
sending and swapping work pretty well.
I'm not sure it's my device. it once became pretty hot after I was trying to make tx on webui.
A Storybook has been deployed to preview UI for the latest push |
72dc3fc
to
fd4114f
Compare
…heme. Build strings using constants.
…s in a shared function using constants for page, panel, android and iOS.
…kChromeUIUntrustedScheme constant, add nullable flags to chrome web view controller ui delegate.
39a3001
to
ab0bb0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wallet core LGTM (non-iOS code)
A Storybook has been deployed to preview UI for the latest push |
…namespace closing bracket.
A Storybook has been deployed to preview UI for the latest push |
// When isPanel is true, will return: | ||
// "img-src 'self' data: chrome://resources chrome://erc-token-images | ||
// chrome://image chrome://favicon https://assets.cgproxy.brave.com;" | ||
const std::string GetWalletImgSrcCSP(bool isPanel) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is_panel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also no const
in return type, just std::string
. Same for GetWalletFrameSrcCSP
frameSrcCSP.append(std::string(" ") + | ||
brave_wallet::mojom::kUntrustedTrezorBridgeURL); | ||
frameSrcCSP.append(std::string(" ") + | ||
brave_wallet::mojom::kUntrustedLedgerBridgeURL); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: brave_wallet::
[puLL-Merge] - brave/brave-core@24328 DescriptionThis PR implements WebUI support for the Brave Wallet on iOS, specifically for the Send and Swap functionality. It adds new files, modifies existing ones, and integrates the Brave Wallet UI into the iOS app architecture. ChangesChanges
Possible Issues
Security Hotspots
|
…fix in namespace.
ca33759
to
bc05824
Compare
A Storybook has been deployed to preview UI for the latest push |
return "frame-src 'none';"; | ||
} | ||
|
||
std::string URLDataSourceIOS::GetContentSecurityPolicy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like a lot of this stuff is copied from URLDataSource
which we should not be doing because it's very fragile.
} // namespace | ||
|
||
namespace web { | ||
bool URLDataSourceIOS::ShouldAddContentSecurityPolicy() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we creating our own implementation in the base class instead of URLDataSourceIOSImpl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have serious concerns with this approach of copying code from content WebUIDataSource to ios. We can discuss options in slack.
// On mobile, will return: | ||
// "frame-src chrome-untrusted://nft-display/ | ||
// chrome-untrusted://line-chart-display/ chrome-untrusted://market-display/;" | ||
std::string GetWalletFrameSrcCSP() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these in constants? There are some other methods already in here that don't make sense in a constants.h file, but I would put these in some kind of helper specific to the relevant webui.
@@ -1635,6 +1635,20 @@ const std::string GetAssetRatioBaseURL(); | |||
const base::flat_map<std::string, std::string>& GetAnkrBlockchains(); | |||
// https://docs.rs/solana-program/1.18.10/src/solana_program/clock.rs.html#129-131 | |||
inline constexpr int kSolanaValidBlockHeightThreshold = 150; | |||
|
|||
inline constexpr char kCSPFrameSrcName[] = "frame-src"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we creating constants in brave wallet for generic CSP directives?
inline constexpr char kCSPImageSrcName[] = "img-src"; | ||
inline constexpr char kCSPSelf[] = "'self'"; | ||
inline constexpr char kCSPData[] = "data:"; | ||
inline constexpr char kCSPChromeResources[] = "chrome://resources"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, a constant for chrome://resources
does not belong in brave_wallet_constants
} | ||
|
||
bool BraveWebClient::IsAppSpecificURL(const GURL& url) const { | ||
return ChromeWebClient::IsAppSpecificURL(url) || url.SchemeIs(kBraveUIScheme); | ||
return ChromeWebClient::IsAppSpecificURL(url) || | ||
url.SchemeIs(kBraveUIScheme) || url.SchemeIs(kChromeUIUntrustedScheme); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this enable mojo bindings? https://source.chromium.org/chromium/chromium/src/+/main:ios/web/webui/web_ui_messaging_java_script_feature.mm;l=47
chrome-untrusted://nft-display
.Resolves brave/brave-browser#36968
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Enable WebUI for Brave Wallet iOS
feature flag. Enable it & restart the app.Send.WebUI.Demo.MP4
Swap.WebUI.Demo.MP4