-
Notifications
You must be signed in to change notification settings - Fork 5
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: settings security #462
Conversation
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.
Nice work 🚀
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.
Great work @fbwoolf
Lots of comments, pretty much all naming related
|
||
export const defaultNetworks = ['mainnet', 'testnet', 'signet'] as const; | ||
|
||
export const defaultThemes = ['light', 'dark', 'system'] as 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.
Been thinking on this naming, because system
isn't really a theme, it's a setting that points to a theme.
Maybe we have ThemeSetting
/ThemePreference
and Theme
?
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.
Agree, been struggling a bit with some of the naming so thx for the feedback on all comments. I'll refactor them here.
walletSecurityLevel: 'undefined', | ||
}; | ||
|
||
export function useSettings() { |
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.
Thanks for the refactor. Think this is a really nice pattern where we expose all store read/writes via a uniform hook, abstracting any store-specific implementation details.
Will follow up with a depcruiser rule to prevent components reading .{read,write}.ts
files
onToggleValue?(): void; | ||
value: boolean; | ||
} | ||
export function Switch({ onToggleValue, value, ...props }: SwitchProps) { |
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.
Nice, think Pete made an issue for this we can close
export const initialState: SettingsState = { | ||
accountDisplayPreference: 'ns', | ||
analyticsEnabled: false, | ||
appAuthEnabled: false, |
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.
Can't this be inferred from walletSecurityLevel
?
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 need clarification on what this setting is for the from design team. I am unclear what it is, the toast says Metrics updated
. 🤔 cc @mica000 Can someone clarify for me what walletSecurityLevel
is for?
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.
cc/ @edgarkhanzadian
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 does appear this is used with biometrics true/false, so I'll remove appAuthEnabled
bc it seems the same.
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.
Just registering that the copy should be App authentication updated.
<TouchableOpacity onPress={onCreateSheetRef}> | ||
<Flag img={<Avatar>{icon}</Avatar>}> | ||
<ItemLayout | ||
actionIcon={<ChevronRightIcon variant="small" />} | ||
captionLeft={caption} | ||
titleLeft={title} | ||
/> | ||
</Flag> | ||
</TouchableOpacity> |
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 feel like many would look at this, see the repetition between this and the other Cells, and have to fight the urge not to try refactor into a more terse JSX component.
But this would be a mistake IMO. This is just the right composition where we make no assumptions about the content and can change any cell to any layout requirement 👍🏼
0936192
to
df67bca
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #462 +/- ##
=======================================
Coverage 22.38% 22.38%
=======================================
Files 132 132
Lines 5521 5521
Branches 241 241
=======================================
Hits 1236 1236
Misses 4285 4285
|
df67bca
to
836a9dc
Compare
bbfbb97
to
1e04613
Compare
@kyranjamie thoughts on renaming here, I went in a direction where I coordinated all settings to be |
@markmhendrickson can you confirm, is the app authentication turning on/off using biometrics? I am still a little unclear if I am interpreting this correctly? |
Indeed, app authentication == whether the user needs to use device-level authentication (e.g. biometrics like Face ID or PIN as backup) to perform certain actions. If they do, they'll see the unlock view each time: https://github.com/leather-io/issues/issues/160 These are the intended triggers / actions that require unlock if enabled. |
Got it, thanks for clarifying. 👍 |
1e04613
to
922851f
Compare
@edgarkhanzadian where is the code that triggers the face id to popup? I see |
922851f
to
900a9e4
Compare
useEffect(() => { | ||
if (settings.securityLevelPreference === 'undefined') | ||
settings.changeSecurityLevelPreference('insecure'); | ||
}); |
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.
Mmm, this seems weird? Why wouldn't we just set the preference as insecure
in the store if it it changed automatically when landing on this page?
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.
Yeah, I'll remove. Prob not needed but was asking for clarification on this setting from Edgar. I'm not sure why undefined is even needed in the type?
900a9e4
to
6147253
Compare
6147253
to
f90d96c
Compare
This PR wires up the security settings flows, and:
useSettings
insettings.ts
Switch
(note, I didn't replace the one in Cell bc it will be removed)cc @mica000 We will need final text for
Description
here on both sheets. Also, isApp authorization
the right naming here? I'm not sure I even understood what it meant and the toast saysmetrics
?