-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix copilot bugs #48517
Fix copilot bugs #48517
Changes from 20 commits
9221a03
84d33b4
9c22426
7f07f36
f550dff
2b746dc
ad3bf76
8d27ce0
6ee983f
c82df42
4033c2a
0618191
ca0e5d4
b1365f4
ae039e1
412544c
cdbf52f
186dfde
81e49dd
ef39885
ef72f6e
747372d
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 |
---|---|---|
|
@@ -131,6 +131,7 @@ function AccountSwitcher() { | |
}} | ||
ref={buttonRef} | ||
interactive={canSwitchAccounts} | ||
pressDimmingValue={canSwitchAccounts ? undefined : 1} | ||
wrapperStyle={[styles.flexGrow1, styles.flex1, styles.mnw0, styles.justifyContentCenter]} | ||
> | ||
<View style={[styles.flexRow, styles.gap3]}> | ||
|
@@ -145,7 +146,7 @@ function AccountSwitcher() { | |
<View style={[styles.flexRow, styles.gap1]}> | ||
<Text | ||
numberOfLines={1} | ||
style={[styles.textBold, styles.textLarge]} | ||
style={[styles.textBold, styles.textLarge, styles.flexShrink1]} | ||
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. Can you please link fixed issue per each change (github comment) so I can have context? 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. @mkhutornyi you can look at the commits for that - https://github.com/Expensify/App/pull/48517/commits 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. Confirmed fix #48261 on native |
||
> | ||
{currentUserPersonalDetails?.displayName} | ||
</Text> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,6 +193,10 @@ function AvatarWithImagePicker({ | |
setError(null, {}); | ||
}, [isFocused]); | ||
|
||
useEffect(() => { | ||
setError(null, {}); | ||
}, [source, avatarID]); | ||
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. Confirmed fix #48252 fix3.mov |
||
|
||
/** | ||
* Check if the attachment extension is allowed. | ||
*/ | ||
|
@@ -325,7 +329,7 @@ function AvatarWithImagePicker({ | |
); | ||
|
||
return ( | ||
<View style={style}> | ||
<View style={[styles.w100, style]}> | ||
<View style={styles.w100}> | ||
<AttachmentModal | ||
headerTitle={headerTitle} | ||
|
@@ -372,7 +376,7 @@ function AvatarWithImagePicker({ | |
accessibilityLabel={translate('avatarWithImagePicker.editImage')} | ||
disabled={isAvatarCropModalOpen || (disabled && !enablePreview)} | ||
disabledStyle={disabledStyle} | ||
style={[styles.pRelative, avatarStyle, type === CONST.ICON_TYPE_AVATAR && styles.alignSelfCenter]} | ||
style={[styles.pRelative, type === CONST.ICON_TYPE_AVATAR && styles.alignSelfCenter, avatarStyle]} | ||
ref={anchorRef} | ||
> | ||
<OfflineWithFeedback pendingAction={pendingAction}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import type {OnyxEntry} from 'react-native-onyx'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import AvatarSkeleton from '@components/AvatarSkeleton'; | ||
import AvatarWithImagePicker from '@components/AvatarWithImagePicker'; | ||
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
|
@@ -16,8 +16,7 @@ import ScrollView from '@components/ScrollView'; | |
import Section from '@components/Section'; | ||
import Text from '@components/Text'; | ||
import Tooltip from '@components/Tooltip'; | ||
import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails'; | ||
import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; | ||
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
|
@@ -33,44 +32,21 @@ import CONST from '@src/CONST'; | |
import type {TranslationPaths} from '@src/languages/types'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ROUTES from '@src/ROUTES'; | ||
import type {LoginList, PrivatePersonalDetails} from '@src/types/onyx'; | ||
import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
|
||
type ProfilePageOnyxProps = { | ||
loginList: OnyxEntry<LoginList>; | ||
/** User's private personal details */ | ||
privatePersonalDetails: OnyxEntry<PrivatePersonalDetails>; | ||
/** Whether app is loading */ | ||
isLoadingApp: OnyxEntry<boolean>; | ||
}; | ||
|
||
type ProfilePageProps = ProfilePageOnyxProps & WithCurrentUserPersonalDetailsProps; | ||
|
||
function ProfilePage({ | ||
loginList, | ||
privatePersonalDetails = { | ||
legalFirstName: '', | ||
legalLastName: '', | ||
dob: '', | ||
addresses: [ | ||
{ | ||
street: '', | ||
street2: '', | ||
city: '', | ||
state: '', | ||
zip: '', | ||
country: '', | ||
}, | ||
], | ||
}, | ||
currentUserPersonalDetails, | ||
isLoadingApp, | ||
}: ProfilePageProps) { | ||
function ProfilePage() { | ||
const theme = useTheme(); | ||
const styles = useThemeStyles(); | ||
const StyleUtils = useStyleUtils(); | ||
const {translate} = useLocalize(); | ||
const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
|
||
const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); | ||
const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS); | ||
const currentUserPersonalDetails = useCurrentUserPersonalDetails(); | ||
|
||
const isLoadingApp = useOnyx(ONYXKEYS.IS_LOADING_APP); | ||
|
||
const getPronouns = (): string => { | ||
const pronounsKey = currentUserPersonalDetails?.pronouns?.replace(CONST.PRONOUNS.PREFIX, '') ?? ''; | ||
return pronounsKey ? translate(`pronouns.${pronounsKey}` as TranslationPaths) : translate('profilePage.selectYourPronouns'); | ||
|
@@ -155,27 +131,31 @@ function ProfilePage({ | |
titleStyles={styles.accountSettingsSectionTitle} | ||
> | ||
<View style={[styles.pt3, styles.pb6, styles.alignSelfStart]}> | ||
<MenuItemGroup shouldUseSingleExecution={false}> | ||
<AvatarWithImagePicker | ||
isUsingDefaultAvatar={UserUtils.isDefaultAvatar(currentUserPersonalDetails?.avatar ?? '')} | ||
source={avatarURL} | ||
avatarID={accountID} | ||
onImageSelected={PersonalDetails.updateAvatar} | ||
onImageRemoved={PersonalDetails.deleteAvatar} | ||
size={CONST.AVATAR_SIZE.XLARGE} | ||
avatarStyle={styles.avatarXLarge} | ||
pendingAction={currentUserPersonalDetails?.pendingFields?.avatar ?? undefined} | ||
errors={currentUserPersonalDetails?.errorFields?.avatar ?? null} | ||
errorRowStyles={styles.mt6} | ||
onErrorClose={PersonalDetails.clearAvatarErrors} | ||
onViewPhotoPress={() => Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} | ||
previewSource={UserUtils.getFullSizeAvatar(avatarURL, accountID)} | ||
originalFileName={currentUserPersonalDetails.originalFileName} | ||
headerTitle={translate('profilePage.profileAvatar')} | ||
fallbackIcon={currentUserPersonalDetails?.fallbackIcon} | ||
editIconStyle={styles.profilePageAvatar} | ||
/> | ||
</MenuItemGroup> | ||
{isEmptyObject(currentUserPersonalDetails) || accountID === -1 || !avatarURL ? ( | ||
<AvatarSkeleton size={CONST.AVATAR_SIZE.XLARGE} /> | ||
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. confirmed fix #48259 |
||
) : ( | ||
<MenuItemGroup shouldUseSingleExecution={false}> | ||
<AvatarWithImagePicker | ||
isUsingDefaultAvatar={UserUtils.isDefaultAvatar(currentUserPersonalDetails?.avatar ?? '')} | ||
source={avatarURL} | ||
avatarID={accountID} | ||
onImageSelected={PersonalDetails.updateAvatar} | ||
onImageRemoved={PersonalDetails.deleteAvatar} | ||
size={CONST.AVATAR_SIZE.XLARGE} | ||
avatarStyle={[styles.avatarXLarge, styles.alignSelfStart]} | ||
pendingAction={currentUserPersonalDetails?.pendingFields?.avatar ?? undefined} | ||
errors={currentUserPersonalDetails?.errorFields?.avatar ?? null} | ||
errorRowStyles={styles.mt6} | ||
onErrorClose={PersonalDetails.clearAvatarErrors} | ||
onViewPhotoPress={() => Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} | ||
previewSource={UserUtils.getFullSizeAvatar(avatarURL, accountID)} | ||
originalFileName={currentUserPersonalDetails.originalFileName} | ||
headerTitle={translate('profilePage.profileAvatar')} | ||
fallbackIcon={currentUserPersonalDetails?.fallbackIcon} | ||
editIconStyle={styles.profilePageAvatar} | ||
/> | ||
</MenuItemGroup> | ||
)} | ||
</View> | ||
{publicOptions.map((detail, index) => ( | ||
<MenuItemWithTopDescription | ||
|
@@ -244,16 +224,4 @@ function ProfilePage({ | |
|
||
ProfilePage.displayName = 'ProfilePage'; | ||
|
||
export default withCurrentUserPersonalDetails( | ||
withOnyx<ProfilePageProps, ProfilePageOnyxProps>({ | ||
loginList: { | ||
key: ONYXKEYS.LOGIN_LIST, | ||
}, | ||
privatePersonalDetails: { | ||
key: ONYXKEYS.PRIVATE_PERSONAL_DETAILS, | ||
}, | ||
isLoadingApp: { | ||
key: ONYXKEYS.IS_LOADING_APP, | ||
}, | ||
})(ProfilePage), | ||
); | ||
export default ProfilePage; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import React, {useEffect} from 'react'; | ||
import {View} from 'react-native'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import FullScreenLoadingIndicator from '@components/FullscreenLoadingIndicator'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import * as Illustrations from '@components/Icon/Illustrations'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
|
@@ -11,6 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; | |
import Navigation from '@libs/Navigation/Navigation'; | ||
import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; | ||
import * as Subscription from '@userActions/Subscription'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import CardSection from './CardSection/CardSection'; | ||
import ReducedFunctionalityMessage from './ReducedFunctionalityMessage'; | ||
import SubscriptionDetails from './SubscriptionDetails'; | ||
|
@@ -26,7 +29,11 @@ function SubscriptionSettingsPage() { | |
useEffect(() => { | ||
Subscription.openSubscriptionPage(); | ||
}, []); | ||
const [isAppLoading] = useOnyx(ONYXKEYS.IS_LOADING_APP); | ||
|
||
if (!subscriptionPlan && isAppLoading) { | ||
return <FullScreenLoadingIndicator />; | ||
} | ||
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. Confirmed fix #48246 fix2.movThere 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. @rushatgabhane I still see Screen.Recording.2024-09-16.at.9.19.42.PM.movThere 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. I don't think it is worth improving this more. The subscription data is simply not in Onyx, so we have to show not found page 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. this is the conditon now. the most we can do is to show a loader when the app is loading.
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. Yeah I think that's fine for now |
||
if (!subscriptionPlan) { | ||
return <NotFoundPage />; | ||
} | ||
|
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.
Confirmed fix #48253
fix4.mov