-
Notifications
You must be signed in to change notification settings - Fork 859
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
[iOS] - Add ability to set custom command-line switches #24384
Conversation
private struct CustomSwitchInputView: View { | ||
@ObservedObject private var customSwitches = Preferences.BraveCore.customSwitches | ||
@ObservedObject private var switchValues = Preferences.BraveCore.switchValues | ||
@Environment(\.presentationMode) @Binding private var presentationMode |
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.
Prefer @Environment(\.dismiss) private var dismiss
instead
@ObservedObject private var switchValues = Preferences.BraveCore.switchValues | ||
@Environment(\.presentationMode) @Binding private var presentationMode | ||
|
||
@State var key: String = "" |
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.
Probably shouldn't initialize State
like this, best to pass in a regular var
and onAppear
set the State with that. If you're fine with the key
passed in being ignored on subsequent body evaluations you can also make a explicit init method that sets the state like _key = State(initialValue: key)
instead
let keys = $0.map { Preferences.BraveCore.customSwitches.value[$0] } | ||
|
||
withAnimation(.default) { | ||
keys.forEach { key in |
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.
Prefer regular for loops
Verification
|
example | example | example | example | example |
---|---|---|---|---|
Summary
Resolves brave/brave-browser#39384
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:
--env-ai-chat.bsg=dev
as the sub-text.brave://version
and verify the command-line switch was added.brave://version
and verify the command-line switch was removed.Screenshots