-
-
Notifications
You must be signed in to change notification settings - Fork 229
refactor: several negative positioning/margin hacks #3775
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,6 +347,40 @@ export default class ContactDetails extends React.Component< | |
| ); | ||
| }; | ||
|
|
||
| const avatarCircle = contact.photo ? ( | ||
| <Image | ||
| source={{ uri: contact.getPhoto }} | ||
| style={{ width: 150, height: 150, borderRadius: 75 }} | ||
| /> | ||
| ) : ( | ||
| <View | ||
| style={{ | ||
| width: 150, | ||
| height: 150, | ||
| borderRadius: 75, | ||
| backgroundColor: themeColor('secondary'), | ||
| alignItems: 'center', | ||
| justifyContent: 'center' | ||
| }} | ||
| > | ||
| {contact.getAvatarInitials ? ( | ||
| <Text | ||
| style={{ | ||
| fontSize: 48, | ||
| fontWeight: 'bold', | ||
| color: themeColor('text') | ||
| }} | ||
| > | ||
| {contact.getAvatarInitials} | ||
| </Text> | ||
| ) : contact.hasOnlyCashuPubkey ? ( | ||
| <Ecash fill="#FACC15" width={64} height={64} /> | ||
| ) : ( | ||
| <Text style={{ fontSize: 64 }}>⚡</Text> | ||
| )} | ||
| </View> | ||
| ); | ||
|
Comment on lines
+350
to
+378
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While refactoring to create the Here's a suggestion for the styles to add to your const styles = StyleSheet.create({
// ... other styles
avatarContainer: {
width: 150,
height: 150,
borderRadius: 75,
},
avatarView: {
backgroundColor: themeColor('secondary'),
alignItems: 'center',
justifyContent: 'center',
},
avatarInitials: {
fontSize: 48,
fontWeight: 'bold',
color: themeColor('text'),
},
avatarIcon: {
fontSize: 64,
}
});You can then apply these styles as shown in the code suggestion.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @myxmaster we can do this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done (only moved those with more than 1 style, otherwise it is kind of pointless imo; also removed unused styles) |
||
|
|
||
| return ( | ||
| <> | ||
| {isLoading ? ( | ||
|
|
@@ -388,60 +422,34 @@ export default class ContactDetails extends React.Component< | |
| paddingBottom: 10 | ||
| }} | ||
| > | ||
| {contact.banner && ( | ||
| <Image | ||
| source={{ uri: contact.getBanner }} | ||
| style={{ | ||
| width: '100%', | ||
| height: 150, | ||
| marginBottom: 20 | ||
| }} | ||
| /> | ||
| )} | ||
| {contact.photo ? ( | ||
| <Image | ||
| source={{ uri: contact.getPhoto }} | ||
| style={{ | ||
| width: 150, | ||
| height: 150, | ||
| borderRadius: 75, | ||
| marginBottom: 20, | ||
| marginTop: contact.banner ? -100 : 0 | ||
| }} | ||
| /> | ||
| ) : ( | ||
| {contact.banner ? ( | ||
| <View | ||
| style={{ | ||
| width: 150, | ||
| width: '100%', | ||
| height: 150, | ||
| borderRadius: 75, | ||
| marginBottom: 20, | ||
| marginTop: contact.banner ? -100 : 0, | ||
| backgroundColor: | ||
| themeColor('secondary'), | ||
| alignItems: 'center', | ||
| justifyContent: 'center' | ||
| marginBottom: 95 | ||
| }} | ||
| > | ||
| {contact.getAvatarInitials ? ( | ||
| <Text | ||
| style={{ | ||
| fontSize: 48, | ||
| fontWeight: 'bold', | ||
| color: themeColor('text') | ||
| }} | ||
| > | ||
| {contact.getAvatarInitials} | ||
| </Text> | ||
| ) : contact.hasOnlyCashuPubkey ? ( | ||
| <Ecash | ||
| fill="#FACC15" | ||
| width={64} | ||
| height={64} | ||
| /> | ||
| ) : ( | ||
| <Text style={{ fontSize: 64 }}>⚡</Text> | ||
| )} | ||
| <Image | ||
| source={{ uri: contact.getBanner }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Recommendation: Sanitize the input in |
||
| style={{ | ||
| width: '100%', | ||
| height: 150 | ||
| }} | ||
| /> | ||
| <View | ||
| style={{ | ||
| position: 'absolute', | ||
| top: 75, | ||
| alignSelf: 'center' | ||
| }} | ||
| > | ||
| {avatarCircle} | ||
| </View> | ||
| </View> | ||
| ) : ( | ||
| <View style={{ marginBottom: 20 }}> | ||
| {avatarCircle} | ||
| </View> | ||
| )} | ||
| <Text | ||
|
|
||
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.
The
AddNotescomponent usesnoteKeyfromroute.params(line 41) as a direct key for storage operations (Storage.getItem,Storage.setItem). Since route parameters can be influenced via deep links, an attacker could potentially trick a user into overwriting critical application data (e.g., settings or contacts) by providing a maliciousnoteKey. For example, a link likezeusln://AddNotes?noteKey=zeus-settings-v2would allow a user to inadvertently overwrite their entire application configuration if they save a note.Recommendation: Validate that
noteKeybelongs to an expected set of keys or implement a restricted namespace for notes in storage to prevent unauthorized access to other application data.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.
unrelated to the PR