Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Mar 1, 2024
2 parents 1ad8d37 + 5d2933d commit c151114
Show file tree
Hide file tree
Showing 27 changed files with 810 additions and 106 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ const CONST = {
BETA_COMMENT_LINKING: 'commentLinking',
VIOLATIONS: 'violations',
REPORT_FIELDS: 'reportFields',
WORKFLOWS_DELAYED_SUBMISSION: 'workflowsDelayedSubmission',
},
BUTTON_STATES: {
DEFAULT: 'default',
Expand Down
12 changes: 12 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,14 @@ const ROUTES = {
route: 'workspace/:policyID/workflows',
getRoute: (policyID: string) => `workspace/${policyID}/workflows` as const,
},
WORKSPACE_WORKFLOWS_AUTOREPORTING_FREQUENCY: {
route: 'workspace/:policyID/settings/workflows/auto-reporting-frequency',
getRoute: (policyID: string) => `workspace/${policyID}/settings/workflows/auto-reporting-frequency` as const,
},
WORKSPACE_WORKFLOWS_AUTOREPORTING_MONTHLY_OFFSET: {
route: 'workspace/:policyID/settings/workflows/auto-reporting-frequency/monthly-offset',
getRoute: (policyID: string) => `workspace/${policyID}/settings/workflows/auto-reporting-frequency/monthly-offset` as const,
},
WORKSPACE_CARD: {
route: 'workspace/:policyID/card',
getRoute: (policyID: string) => `workspace/${policyID}/card` as const,
Expand Down Expand Up @@ -526,6 +534,10 @@ const ROUTES = {
route: 'workspace/:policyID/categories',
getRoute: (policyID: string) => `workspace/${policyID}/categories` as const,
},
WORKSPACE_CATEGORY_SETTINGS: {
route: 'workspace/:policyID/categories/:categoryName',
getRoute: (policyID: string, categoryName: string) => `workspace/${policyID}/categories/${encodeURI(categoryName)}` as const,
},
WORKSPACE_CATEGORIES_SETTINGS: {
route: 'workspace/:policyID/categories/settings',
getRoute: (policyID: string) => `workspace/${policyID}/categories/settings` as const,
Expand Down
3 changes: 3 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,12 @@ const SCREENS = {
CATEGORIES: 'Workspace_Categories',
CURRENCY: 'Workspace_Profile_Currency',
WORKFLOWS: 'Workspace_Workflows',
WORKFLOWS_AUTO_REPORTING_FREQUENCY: 'Workspace_Workflows_Auto_Reporting_Frequency',
WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET: 'Workspace_Workflows_Auto_Reporting_Monthly_Offset',
DESCRIPTION: 'Workspace_Profile_Description',
SHARE: 'Workspace_Profile_Share',
NAME: 'Workspace_Profile_Name',
CATEGORY_SETTINGS: 'Category_Settings',
CATEGORIES_SETTINGS: 'Categories_Settings',
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ function CarouselItem({item, onPress, isFocused, isModalHovered}) {
isHovered={isModalHovered}
isFocused={isFocused}
optionalVideoDuration={item.duration}
isUsedInCarousel
/>
</View>

Expand Down
9 changes: 8 additions & 1 deletion src/components/LocaleContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type LocaleContextProps = {
/** Gets the locale digit corresponding to a standard digit */
toLocaleDigit: (digit: string) => string;

/** Formats a number into its localized ordinal representation */
toLocaleOrdinal: (number: number) => string;

/** Gets the standard digit corresponding to a locale digit */
fromLocaleDigit: (digit: string) => string;

Expand All @@ -65,6 +68,7 @@ const LocaleContext = createContext<LocaleContextProps>({
updateLocale: () => '',
formatPhoneNumber: () => '',
toLocaleDigit: () => '',
toLocaleOrdinal: () => '',
fromLocaleDigit: () => '',
preferredLocale: CONST.LOCALES.DEFAULT,
});
Expand Down Expand Up @@ -98,6 +102,8 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails = {}

const toLocaleDigit = useMemo<LocaleContextProps['toLocaleDigit']>(() => (digit) => LocaleDigitUtils.toLocaleDigit(locale, digit), [locale]);

const toLocaleOrdinal = useMemo<LocaleContextProps['toLocaleOrdinal']>(() => (number) => LocaleDigitUtils.toLocaleOrdinal(locale, number), [locale]);

const fromLocaleDigit = useMemo<LocaleContextProps['fromLocaleDigit']>(() => (localeDigit) => LocaleDigitUtils.fromLocaleDigit(locale, localeDigit), [locale]);

const contextValue = useMemo<LocaleContextProps>(
Expand All @@ -109,10 +115,11 @@ function LocaleContextProvider({preferredLocale, currentUserPersonalDetails = {}
updateLocale,
formatPhoneNumber,
toLocaleDigit,
toLocaleOrdinal,
fromLocaleDigit,
preferredLocale: locale,
}),
[translate, numberFormat, datetimeToRelative, datetimeToCalendarTime, updateLocale, formatPhoneNumber, toLocaleDigit, fromLocaleDigit, locale],
[translate, numberFormat, datetimeToRelative, datetimeToCalendarTime, updateLocale, formatPhoneNumber, toLocaleDigit, toLocaleOrdinal, fromLocaleDigit, locale],
);

return <LocaleContext.Provider value={contextValue}>{children}</LocaleContext.Provider>;
Expand Down
78 changes: 40 additions & 38 deletions src/components/VideoPlayer/BaseVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeed
import {usePlaybackContext} from '@components/VideoPlayerContexts/PlaybackContext';
import VideoPopoverMenu from '@components/VideoPopoverMenu';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import addEncryptedAuthTokenToURL from '@libs/addEncryptedAuthTokenToURL';
import * as Browser from '@libs/Browser';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
Expand Down Expand Up @@ -43,7 +42,6 @@ function BaseVideoPlayer({
isVideoHovered,
}) {
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const {pauseVideo, playVideo, currentlyPlayingURL, updateSharedElements, sharedElement, originalParent, shareVideoPlayerElements, currentVideoPlayerRef, updateCurrentlyPlayingURL} =
usePlaybackContext();
const [duration, setDuration] = useState(videoDuration * 1000);
Expand Down Expand Up @@ -99,20 +97,24 @@ function BaseVideoPlayer({

const handlePlaybackStatusUpdate = useCallback(
(e) => {
if (shouldReplayVideo(e, isPlaying, duration, position)) {
const isVideoPlaying = e.isPlaying || false;
const currentDuration = e.durationMillis || videoDuration * 1000;
const currentPositon = e.positionMillis || 0;

if (shouldReplayVideo(e, isVideoPlaying, currentDuration, currentPositon)) {
videoPlayerRef.current.setStatusAsync({positionMillis: 0, shouldPlay: true});
}
const isVideoPlaying = e.isPlaying || false;

preventPausingWhenExitingFullscreen(isVideoPlaying);
setIsPlaying(isVideoPlaying);
setIsLoading(!e.isLoaded || Number.isNaN(e.durationMillis)); // when video is ready to display duration is not NaN
setIsBuffering(e.isBuffering || false);
setDuration(e.durationMillis || videoDuration * 1000);
setPosition(e.positionMillis || 0);
setDuration(currentDuration);
setPosition(currentPositon);

onPlaybackStatusUpdate(e);
},
[onPlaybackStatusUpdate, preventPausingWhenExitingFullscreen, videoDuration, isPlaying, duration, position],
[onPlaybackStatusUpdate, preventPausingWhenExitingFullscreen, videoDuration],
);

const handleFullscreenUpdate = useCallback(
Expand Down Expand Up @@ -168,44 +170,44 @@ function BaseVideoPlayer({
}
originalParent.appendChild(sharedElement);
};
}, [bindFunctions, currentVideoPlayerRef, currentlyPlayingURL, isSmallScreenWidth, originalParent, sharedElement, shouldUseSharedVideoElement, url]);
}, [bindFunctions, currentVideoPlayerRef, currentlyPlayingURL, originalParent, sharedElement, shouldUseSharedVideoElement, url]);

return (
<>
<View style={style}>
<Hoverable>
{(isHovered) => (
<View style={[styles.w100, styles.h100]}>
{shouldUseSharedVideoElement ? (
<>
<View
ref={sharedVideoPlayerParentRef}
style={[styles.flex1]}
/>
{/* We are adding transparent absolute View between appended video component and control buttons to enable
<PressableWithoutFeedback
accessibilityRole="button"
onPress={() => {
togglePlayCurrentVideo();
}}
style={styles.flex1}
>
{shouldUseSharedVideoElement ? (
<>
<View
ref={sharedVideoPlayerParentRef}
style={[styles.flex1]}
/>
{/* We are adding transparent absolute View between appended video component and control buttons to enable
catching onMouse events from Attachment Carousel. Due to late appending React doesn't handle
element's events properly. */}
<View style={[styles.w100, styles.h100, styles.pAbsolute]} />
</>
) : (
<View
style={styles.flex1}
ref={(el) => {
if (!el) {
return;
}
videoPlayerElementParentRef.current = el;
if (el.childNodes && el.childNodes[0]) {
videoPlayerElementRef.current = el.childNodes[0];
}
}}
>
<PressableWithoutFeedback
accessibilityRole="button"
onPress={() => {
togglePlayCurrentVideo();
}}
<View style={[styles.w100, styles.h100, styles.pAbsolute]} />
</>
) : (
<View
style={styles.flex1}
ref={(el) => {
if (!el) {
return;
}
videoPlayerElementParentRef.current = el;
if (el.childNodes && el.childNodes[0]) {
videoPlayerElementRef.current = el.childNodes[0];
}
}}
>
<Video
ref={videoPlayerRef}
Expand All @@ -222,9 +224,9 @@ function BaseVideoPlayer({
onPlaybackStatusUpdate={handlePlaybackStatusUpdate}
onFullscreenUpdate={handleFullscreenUpdate}
/>
</PressableWithoutFeedback>
</View>
)}
</View>
)}
</PressableWithoutFeedback>

{(isLoading || isBuffering) && <FullScreenLoadingIndicator style={[styles.opacity1, styles.bgTransparent]} />}

Expand Down
28 changes: 22 additions & 6 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,18 +1037,32 @@ export default {
delaySubmissionTitle: 'Delay submissions',
delaySubmissionDescription: 'Expenses are shared right away for better spend visibility. Set a slower cadence if needed.',
submissionFrequency: 'Submission frequency',
weeklyFrequency: 'Weekly',
monthlyFrequency: 'Monthly',
twiceAMonthFrequency: 'Twice a month',
byTripFrequency: 'By trip',
manuallyFrequency: 'Manually',
dailyFrequency: 'Daily',
submissionFrequencyDateOfMonth: 'Date of month',
addApprovalsTitle: 'Add approvals',
approver: 'Approver',
connectBankAccount: 'Connect bank account',
addApprovalsDescription: 'Require additional approval before authorizing a payment.',
makeOrTrackPaymentsTitle: 'Make or track payments',
makeOrTrackPaymentsDescription: 'Add an authorized payer for payments made in Expensify, or simply track payments made elsewhere.',
editor: {
submissionFrequency: 'Choose how long Expensify should wait before sharing error-free spend.',
},
frequencies: {
weekly: 'Weekly',
monthly: 'Monthly',
twiceAMonth: 'Twice a month',
byTrip: 'By trip',
manually: 'Manually',
daily: 'Daily',
lastDayOfMonth: 'Last day of the month',
lastBusinessDayOfMonth: 'Last business day of the month',
ordinals: {
one: 'st',
two: 'nd',
few: 'rd',
other: 'th',
},
},
},
reportFraudPage: {
title: 'Report virtual card fraud',
Expand Down Expand Up @@ -1742,13 +1756,15 @@ export default {
collect: 'Collect',
},
categories: {
categoryName: 'Category name',
requiresCategory: 'Members must categorize all spend',
enableCategory: 'Enable category',
subtitle: 'Get a better overview of where money is being spent. Use our default categories or add your own.',
emptyCategories: {
title: "You haven't created any categories",
subtitle: 'Add a category to organize your spend.',
},
genericFailureMessage: 'An error occurred while updating the category, please try again.',
},
emptyWorkspace: {
title: 'Create a workspace',
Expand Down
28 changes: 22 additions & 6 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1033,18 +1033,32 @@ export default {
delaySubmissionTitle: 'Retrasar envíos',
delaySubmissionDescription: 'Los gastos se comparten de inmediato para una mejor visibilidad del gasto. Establece una cadencia más lenta si es necesario.',
submissionFrequency: 'Frecuencia de envíos',
weeklyFrequency: 'Semanal',
monthlyFrequency: 'Mensual',
twiceAMonthFrequency: 'Dos veces al mes',
byTripFrequency: 'Por viaje',
manuallyFrequency: 'Manual',
dailyFrequency: 'Diaria',
submissionFrequencyDateOfMonth: 'Fecha del mes',
addApprovalsTitle: 'Requerir aprobaciones',
approver: 'Aprobador',
connectBankAccount: 'Conectar cuenta bancaria',
addApprovalsDescription: 'Requiere una aprobación adicional antes de autorizar un pago.',
makeOrTrackPaymentsTitle: 'Realizar o seguir pagos',
makeOrTrackPaymentsDescription: 'Añade un pagador autorizado para los pagos realizados en Expensify, o simplemente realiza un seguimiento de los pagos realizados en otro lugar.',
editor: {
submissionFrequency: 'Elige cuánto tiempo Expensify debe esperar antes de compartir los gastos sin errores.',
},
frequencies: {
weekly: 'Semanal',
monthly: 'Mensual',
twiceAMonth: 'Dos veces al mes',
byTrip: 'Por viaje',
manually: 'Manualmente',
daily: 'Diaria',
lastDayOfMonth: 'Último día del mes',
lastBusinessDayOfMonth: 'Último día hábil del mes',
ordinals: {
one: '.º',
two: '.º',
few: '.º',
other: '.º',
},
},
},
reportFraudPage: {
title: 'Reportar fraude con la tarjeta virtual',
Expand Down Expand Up @@ -1766,13 +1780,15 @@ export default {
collect: 'Recolectar',
},
categories: {
categoryName: 'Nombre de la categoría',
requiresCategory: 'Los miembros deben categorizar todos los gastos',
enableCategory: 'Activar categoría',
subtitle: 'Obtén una visión general de dónde te gastas el dinero. Utiliza las categorías predeterminadas o añade las tuyas propias.',
emptyCategories: {
title: 'No has creado ninguna categoría',
subtitle: 'Añade una categoría para organizar tu gasto.',
},
genericFailureMessage: 'Se ha producido un error al intentar eliminar la categoría. Por favor, inténtalo más tarde.',
},
emptyWorkspace: {
title: 'Crea un espacio de trabajo',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';

type SetWorkspaceAutoReportingFrequencyParams = {
policyID: string;
frequency: ValueOf<typeof CONST.POLICY.AUTO_REPORTING_FREQUENCIES>;
};

export default SetWorkspaceAutoReportingFrequencyParams;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type SetWorkspaceAutoReportingMonthlyOffsetParams = {
policyID: string;
value: string;
};

export default SetWorkspaceAutoReportingMonthlyOffsetParams;
10 changes: 10 additions & 0 deletions src/libs/API/parameters/SetWorkspaceCategoriesEnabledParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type SetWorkspaceCategoriesEnabledParams = {
policyID: string;
/**
* Stringified JSON object with type of following structure:
* Array<{name: string; enabled: boolean}>
*/
categories: string;
};

export default SetWorkspaceCategoriesEnabledParams;
3 changes: 3 additions & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ export type {default as CancelPaymentParams} from './CancelPaymentParams';
export type {default as AcceptACHContractForBankAccount} from './AcceptACHContractForBankAccount';
export type {default as UpdateWorkspaceDescriptionParams} from './UpdateWorkspaceDescriptionParams';
export type {default as UpdateWorkspaceMembersRoleParams} from './UpdateWorkspaceMembersRoleParams';
export type {default as SetWorkspaceCategoriesEnabledParams} from './SetWorkspaceCategoriesEnabledParams';
export type {default as SetWorkspaceRequiresCategoryParams} from './SetWorkspaceRequiresCategoryParams';
export type {default as SetWorkspaceAutoReportingParams} from './SetWorkspaceAutoReportingParams';
export type {default as SetWorkspaceAutoReportingFrequencyParams} from './SetWorkspaceAutoReportingFrequencyParams';
export type {default as SetWorkspaceAutoReportingMonthlyOffsetParams} from './SetWorkspaceAutoReportingMonthlyOffsetParams';
export type {default as SetWorkspaceApprovalModeParams} from './SetWorkspaceApprovalModeParams';
export type {default as SwitchToOldDotParams} from './SwitchToOldDotParams';
Loading

0 comments on commit c151114

Please sign in to comment.