Skip to content

Commit

Permalink
Merge branch 'main' into fix/39193
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Apr 15, 2024
2 parents cfca74c + db9e01c commit 4e7878f
Show file tree
Hide file tree
Showing 97 changed files with 2,308 additions and 803 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001046204
versionName "1.4.62-4"
versionCode 1001046206
versionName "1.4.62-6"
// Supported language variants must be declared here to avoid from being removed during the compilation.
// This also helps us to not include unnecessary language variants in the APK.
resConfigs "en", "es"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.62.4</string>
<string>1.4.62.6</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.62.4</string>
<string>1.4.62.6</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>1.4.62</string>
<key>CFBundleVersion</key>
<string>1.4.62.4</string>
<string>1.4.62.6</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.62-4",
"version": "1.4.62-6",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
10 changes: 7 additions & 3 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ const CONST = {
UNAPPROVED: 'UNAPPROVED', // OldDot Action
UNHOLD: 'UNHOLD',
UNSHARE: 'UNSHARE', // OldDot Action
UPDATEGROUPCHATMEMBERROLE: 'UPDATEGROUPCHATMEMBERROLE',
POLICYCHANGELOG: {
ADD_APPROVER_RULE: 'POLICYCHANGELOG_ADD_APPROVER_RULE',
ADD_BUDGET: 'POLICYCHANGELOG_ADD_BUDGET',
Expand Down Expand Up @@ -1862,17 +1863,17 @@ const CONST = {

MAX_THREAD_REPLIES_PREVIEW: 99,

// Character Limits
FORM_CHARACTER_LIMIT: 50,
LEGAL_NAMES_CHARACTER_LIMIT: 150,
LOGIN_CHARACTER_LIMIT: 254,
CATEGORY_NAME_LIMIT: 256,

TAG_NAME_LIMIT: 256,

REPORT_NAME_LIMIT: 256,
TITLE_CHARACTER_LIMIT: 100,
DESCRIPTION_LIMIT: 500,

WORKSPACE_NAME_CHARACTER_LIMIT: 80,

AVATAR_CROP_MODAL: {
// The next two constants control what is min and max value of the image crop scale.
// Values define in how many times the image can be bigger than its container.
Expand Down Expand Up @@ -4313,6 +4314,9 @@ const CONST = {
SESSION_STORAGE_KEYS: {
INITIAL_URL: 'INITIAL_URL',
},

DOT_SEPARATOR: '•',

DEFAULT_TAX: {
defaultExternalID: 'id_TAX_EXEMPT',
defaultValue: '0%',
Expand Down
7 changes: 7 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ const ONYXKEYS = {
/** Indicates whether an forced upgrade is required */
UPDATE_REQUIRED: 'updateRequired',

/** Indicates whether an forced reset is required. Used in emergency situations where we must completely erase the Onyx data in the client because it is in a bad state. This will clear Oynx data without signing the user out. */
RESET_REQUIRED: 'resetRequired',

/** Stores the logs of the app for debugging purposes */
LOGS: 'logs',

Expand Down Expand Up @@ -453,6 +456,8 @@ const ONYXKEYS = {
WORKSPACE_TAX_NAME_FORM_DRAFT: 'workspaceTaxNameFormDraft',
WORKSPACE_TAX_VALUE_FORM: 'workspaceTaxValueForm',
WORKSPACE_TAX_VALUE_FORM_DRAFT: 'workspaceTaxValueFormDraft',
NEW_CHAT_NAME_FORM: 'newChatNameForm',
NEW_CHAT_NAME_FORM_DRAFT: 'newChatNameFormDraft',
},
} as const;

Expand Down Expand Up @@ -508,6 +513,7 @@ type OnyxFormValuesMapping = {
[ONYXKEYS.FORMS.POLICY_DISTANCE_RATE_EDIT_FORM]: FormTypes.PolicyDistanceRateEditForm;
[ONYXKEYS.FORMS.WORKSPACE_TAX_NAME_FORM]: FormTypes.WorkspaceTaxNameForm;
[ONYXKEYS.FORMS.WORKSPACE_TAX_VALUE_FORM]: FormTypes.WorkspaceTaxValueForm;
[ONYXKEYS.FORMS.NEW_CHAT_NAME_FORM]: FormTypes.NewChatNameForm;
};

type OnyxFormDraftValuesMapping = {
Expand Down Expand Up @@ -642,6 +648,7 @@ type OnyxValuesMapping = {
[ONYXKEYS.LAST_VISITED_PATH]: string | undefined;
[ONYXKEYS.RECENTLY_USED_REPORT_FIELDS]: OnyxTypes.RecentlyUsedReportFields;
[ONYXKEYS.UPDATE_REQUIRED]: boolean;
[ONYXKEYS.RESET_REQUIRED]: boolean;
[ONYXKEYS.PLAID_CURRENT_EVENT]: string;
[ONYXKEYS.LOGS]: OnyxTypes.CapturedLogs;
[ONYXKEYS.SHOULD_STORE_LOGS]: boolean;
Expand Down
17 changes: 17 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ const ROUTES = {
NEW: 'new',
NEW_CHAT: 'new/chat',
NEW_CHAT_CONFIRM: 'new/chat/confirm',
NEW_CHAT_EDIT_NAME: 'new/chat/confirm/name/edit',
NEW_ROOM: 'new/room',

REPORT: 'r',
Expand Down Expand Up @@ -226,6 +227,18 @@ const ROUTES = {
route: 'r/:reportID/participants',
getRoute: (reportID: string) => `r/${reportID}/participants` as const,
},
REPORT_PARTICIPANTS_INVITE: {
route: 'r/:reportID/participants/invite',
getRoute: (reportID: string) => `r/${reportID}/participants/invite` as const,
},
REPORT_PARTICIPANTS_DETAILS: {
route: 'r/:reportID/participants/:accountID',
getRoute: (reportID: string, accountID: number) => `r/${reportID}/participants/${accountID}` as const,
},
REPORT_PARTICIPANTS_ROLE_SELECTION: {
route: 'r/:reportID/participants/:accountID/role',
getRoute: (reportID: string, accountID: number) => `r/${reportID}/participants/${accountID}/role` as const,
},
REPORT_WITH_ID_DETAILS: {
route: 'r/:reportID/details',
getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/details`, backTo),
Expand All @@ -238,6 +251,10 @@ const ROUTES = {
route: 'r/:reportID/settings/room-name',
getRoute: (reportID: string) => `r/${reportID}/settings/room-name` as const,
},
REPORT_SETTINGS_GROUP_NAME: {
route: 'r/:reportID/settings/group-name',
getRoute: (reportID: string) => `r/${reportID}/settings/group-name` as const,
},
REPORT_SETTINGS_NOTIFICATION_PREFERENCES: {
route: 'r/:reportID/settings/notification-preferences',
getRoute: (reportID: string) => `r/${reportID}/settings/notification-preferences` as const,
Expand Down
9 changes: 8 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const SCREENS = {
REPORT_SETTINGS: {
ROOT: 'Report_Settings_Root',
ROOM_NAME: 'Report_Settings_Room_Name',
GROUP_NAME: 'Report_Settings_Group_Name',
NOTIFICATION_PREFERENCES: 'Report_Settings_Notification_Preferences',
WRITE_CAPABILITY: 'Report_Settings_Write_Capability',
VISIBILITY: 'Report_Settings_Visibility',
Expand Down Expand Up @@ -273,6 +274,7 @@ const SCREENS = {
ROOT: 'NewChat_Root',
NEW_CHAT: 'chat',
NEW_CHAT_CONFIRM: 'NewChat_Confirm',
NEW_CHAT_EDIT_NAME: 'NewChat_Edit_Name',
NEW_ROOM: 'room',
},

Expand Down Expand Up @@ -309,7 +311,12 @@ const SCREENS = {
PROFILE_ROOT: 'Profile_Root',
PROCESS_MONEY_REQUEST_HOLD_ROOT: 'ProcessMoneyRequestHold_Root',
REPORT_DESCRIPTION_ROOT: 'Report_Description_Root',
REPORT_PARTICIPANTS_ROOT: 'ReportParticipants_Root',
REPORT_PARTICIPANTS: {
ROOT: 'ReportParticipants_Root',
INVITE: 'ReportParticipants_Invite',
DETAILS: 'ReportParticipants_Details',
ROLE: 'ReportParticipants_Role',
},
ROOM_MEMBERS_ROOT: 'RoomMembers_Root',
ROOM_INVITE_ROOT: 'RoomInvite_Root',
SEARCH_ROOT: 'Search_Root',
Expand Down
14 changes: 11 additions & 3 deletions src/components/AvatarWithImagePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ type AvatarWithImagePickerProps = {

/** Allows to open an image without Attachment Picker. */
enablePreview?: boolean;

/** Hard disables the "View photo" option */
shouldDisableViewPhoto?: boolean;

/** Optionally override the default "Edit" icon */
editIcon?: IconAsset;
};

function AvatarWithImagePicker({
Expand Down Expand Up @@ -144,6 +150,8 @@ function AvatarWithImagePicker({
disabled = false,
onViewPhotoPress,
enablePreview = false,
shouldDisableViewPhoto = false,
editIcon = Expensicons.Pencil,
}: AvatarWithImagePickerProps) {
const theme = useTheme();
const styles = useThemeStyles();
Expand Down Expand Up @@ -332,7 +340,7 @@ function AvatarWithImagePicker({
{!disabled && (
<View style={StyleSheet.flatten([styles.smallEditIcon, styles.smallAvatarEditIcon, editIconStyle])}>
<Icon
src={Expensicons.Pencil}
src={editIcon}
width={variables.iconSizeSmall}
height={variables.iconSizeSmall}
fill={theme.icon}
Expand All @@ -354,8 +362,8 @@ function AvatarWithImagePicker({
{({openPicker}) => {
const menuItems = createMenuItems(openPicker);

// If the current avatar isn't a default avatar, allow the "View Photo" option
if (!isUsingDefaultAvatar) {
// If the current avatar isn't a default avatar and we are not overriding this behavior allow the "View Photo" option
if (!shouldDisableViewPhoto && !isUsingDefaultAvatar) {
menuItems.push({
icon: Expensicons.Eye,
text: translate('avatarWithImagePicker.viewPhoto'),
Expand Down
64 changes: 64 additions & 0 deletions src/components/ChatDetailsQuickActionsBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import React, {useState} from 'react';
import {View} from 'react-native';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Report from '@userActions/Report';
import type {Report as OnyxReportType} from '@src/types/onyx';
import Button from './Button';
import ConfirmModal from './ConfirmModal';
import * as Expensicons from './Icon/Expensicons';

type ChatDetailsQuickActionsBarProps = {
report: OnyxReportType;
};

function ChatDetailsQuickActionsBar({report}: ChatDetailsQuickActionsBarProps) {
const styles = useThemeStyles();
const [isLastMemberLeavingGroupModalVisible, setIsLastMemberLeavingGroupModalVisible] = useState(false);
const {translate} = useLocalize();
const isPinned = !!report.isPinned;
return (
<View style={[styles.flexRow, styles.ph5, styles.mb5]}>
<View style={[styles.flex1, styles.pr3]}>
<ConfirmModal
danger
title={translate('groupChat.lastMemberTitle')}
isVisible={isLastMemberLeavingGroupModalVisible}
onConfirm={() => {
setIsLastMemberLeavingGroupModalVisible(false);
Report.leaveGroupChat(report.reportID);
}}
onCancel={() => setIsLastMemberLeavingGroupModalVisible(false)}
prompt={translate('groupChat.lastMemberWarning')}
confirmText={translate('common.leave')}
cancelText={translate('common.cancel')}
/>
<Button
onPress={() => {
if (Object.keys(report?.participants ?? {}).length === 1) {
setIsLastMemberLeavingGroupModalVisible(true);
return;
}

Report.leaveGroupChat(report.reportID);
}}
icon={Expensicons.Exit}
style={styles.flex1}
text={translate('common.leave')}
/>
</View>
<View style={[styles.flex1]}>
<Button
onPress={() => Report.togglePinnedState(report.reportID, isPinned)}
icon={Expensicons.Pin}
style={styles.flex1}
text={isPinned ? translate('common.unPin') : translate('common.pin')}
/>
</View>
</View>
);
}

ChatDetailsQuickActionsBar.displayName = 'ChatDetailsQuickActionsBar';

export default ChatDetailsQuickActionsBar;
9 changes: 7 additions & 2 deletions src/components/ContextMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import getButtonState from '@libs/getButtonState';
import type IconAsset from '@src/types/utils/IconAsset';
import BaseMiniContextMenuItem from './BaseMiniContextMenuItem';
import FocusableMenuItem from './FocusableMenuItem';
import Icon from './Icon';
import MenuItem from './MenuItem';

type ContextMenuItemProps = {
/** Icon Component */
Expand Down Expand Up @@ -49,6 +49,9 @@ type ContextMenuItemProps = {

/** The ref of mini context menu item */
buttonRef?: React.RefObject<View>;

/** Handles what to do when the item is focused */
onFocus?: () => void;
};

type ContextMenuItemHandle = {
Expand All @@ -70,6 +73,7 @@ function ContextMenuItem(
wrapperStyle,
shouldPreventDefaultFocusOnPress = true,
buttonRef = {current: null},
onFocus = () => {},
}: ContextMenuItemProps,
ref: ForwardedRef<ContextMenuItemHandle>,
) {
Expand Down Expand Up @@ -113,7 +117,7 @@ function ContextMenuItem(
)}
</BaseMiniContextMenuItem>
) : (
<MenuItem
<FocusableMenuItem
title={itemText}
icon={itemIcon}
onPress={triggerPressAndUpdateSuccess}
Expand All @@ -125,6 +129,7 @@ function ContextMenuItem(
isAnonymousAction={isAnonymousAction}
focused={isFocused}
interactive={isThrottledButtonActive}
onFocus={onFocus}
/>
);
}
Expand Down
24 changes: 24 additions & 0 deletions src/components/FocusableMenuItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, {useRef} from 'react';
import type {View} from 'react-native';
import useSyncFocus from '@hooks/useSyncFocus';
import type {MenuItemProps} from './MenuItem';
import MenuItem from './MenuItem';

function FocusableMenuItem(props: MenuItemProps) {
const ref = useRef<HTMLDivElement | View>(null);

// Sync focus on an item
useSyncFocus(ref, Boolean(props.focused));

return (
<MenuItem
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
/>
);
}

FocusableMenuItem.displayName = 'FocusableMenuItem';

export default FocusableMenuItem;
4 changes: 2 additions & 2 deletions src/components/FormAlertWithSubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type FormAlertWithSubmitButtonProps = {
buttonStyles?: StyleProp<ViewStyle>;

/** Whether to show the alert text */
isAlertVisible: boolean;
isAlertVisible?: boolean;

/** Text for the button */
buttonText: string;
Expand All @@ -69,7 +69,7 @@ function FormAlertWithSubmitButton({
footerContent,
buttonStyles,
buttonText,
isAlertVisible,
isAlertVisible = false,
onSubmit,
useSmallerSubmitButtonSize = false,
errorMessageStyle,
Expand Down
Loading

0 comments on commit 4e7878f

Please sign in to comment.