Skip to content

Commit

Permalink
Merge branch 'main' into expo-image
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Nov 19, 2023
2 parents 1ef612e + 5d5af8f commit 819a669
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ const CONST = {
ATTACHMENT_SOURCE_ATTRIBUTE: 'data-expensify-source',
ATTACHMENT_PREVIEW_ATTRIBUTE: 'src',
ATTACHMENT_ORIGINAL_FILENAME_ATTRIBUTE: 'data-name',
ATTACHMENT_LOCAL_URL_PREFIX: ['blob:', 'file:'],

ATTACHMENT_PICKER_TYPE: {
FILE: 'file',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function BaseAnchorForCommentsOnly({onPressIn, onPressOut, href = '', rel = '',
return (
<PressableWithSecondaryInteraction
inline
suppressHighlighting
style={[styles.cursorDefault, StyleUtils.getFontSizeStyle(style.fontSize)]}
onSecondaryInteraction={(event) => {
ReportActionContextMenu.showContextMenu(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function extractAttachmentsFromReport(parentReportAction, reportActions, transac

if (TransactionUtils.hasReceipt(transaction)) {
const {image} = ReceiptUtils.getThumbnailAndImageURIs(transaction);
const isLocalFile = typeof image === 'string' && (image.startsWith('blob:') || image.startsWith('file:'));
const isLocalFile = typeof image === 'string' && _.some(CONST.ATTACHMENT_LOCAL_URL_PREFIX, (prefix) => image.startsWith(prefix));
attachments.unshift({
source: tryResolveUrlFromApiRoot(image),
isAuthTokenRequired: !isLocalFile,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ const propTypes = {

/** Whether the view needs to be rendered offscreen (for Android only) */
needsOffscreenAlphaCompositing: PropTypes.bool,

/** Whether the text has a gray highlights on press down (for IOS only) */
suppressHighlighting: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -63,6 +66,7 @@ const defaultProps = {
activeOpacity: 1,
enableLongPressWithHover: false,
needsOffscreenAlphaCompositing: false,
suppressHighlighting: false,
};

export {propTypes, defaultProps};
2 changes: 2 additions & 0 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -2936,6 +2936,8 @@ function navigateToNextPage(iou, iouType, report, path = '') {
.map((accountID) => ({accountID, selected: true}))
.value();
setMoneyRequestParticipants(participants);
resetMoneyRequestCategory();
resetMoneyRequestTag();
}
Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID));
return;
Expand Down
4 changes: 3 additions & 1 deletion src/libs/fileDownload/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import _ from 'lodash';
import * as ApiUtils from '@libs/ApiUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import * as Link from '@userActions/Link';
import CONST from '@src/CONST';
import * as FileUtils from './FileUtils';

/**
Expand All @@ -11,7 +13,7 @@ import * as FileUtils from './FileUtils';
*/
export default function fileDownload(url, fileName) {
const resolvedUrl = tryResolveUrlFromApiRoot(url);
if (!resolvedUrl.startsWith(ApiUtils.getApiRoot())) {
if (!resolvedUrl.startsWith(ApiUtils.getApiRoot()) && !_.some(CONST.ATTACHMENT_LOCAL_URL_PREFIX, (prefix) => resolvedUrl.startsWith(prefix))) {
// Different origin URLs might pose a CORS issue during direct downloads.
// Opening in a new tab avoids this limitation, letting the browser handle the download.
Link.openExternalLink(url);
Expand Down
5 changes: 0 additions & 5 deletions src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ function MoneyRequestConfirmPage(props) {
const isPolicyExpenseChat = useMemo(() => ReportUtils.isPolicyExpenseChat(ReportUtils.getRootParentReport(props.report)), [props.report]);
const isManualRequestDM = props.selectedTab === CONST.TAB.MANUAL && iouType === CONST.IOU.TYPE.REQUEST;

useEffect(() => {
IOU.resetMoneyRequestCategory();
IOU.resetMoneyRequestTag();
}, []);

useEffect(() => {
const policyExpenseChat = _.find(participants, (participant) => participant.isPolicyExpenseChat);
if (policyExpenseChat) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route, transaction}) {

const navigateToConfirmationStep = (moneyRequestType) => {
IOU.setMoneyRequestId(moneyRequestType);
IOU.resetMoneyRequestCategory();
IOU.resetMoneyRequestTag();
Navigation.navigate(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(moneyRequestType, reportID));
};

Expand Down
7 changes: 1 addition & 6 deletions src/pages/settings/InitialSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ function InitialSettingsPage(props) {
.filter((policy) => PolicyUtils.shouldShowPolicy(policy, props.network.isOffline))
.sortBy((policy) => policy.name.toLowerCase())
.map((policy) => ({
id: policy.id,
source: policy.avatar || ReportUtils.getDefaultWorkspaceAvatar(policy.name),
name: policy.name,
type: CONST.ICON_TYPE_WORKSPACE,
Expand Down Expand Up @@ -325,12 +326,6 @@ function InitialSettingsPage(props) {
);
}, [getDefaultMenuItems, props.betas, props.userWallet.currentBalance, translate, isExecuting, singleExecution]);

// On the very first sign in or after clearing storage these
// details will not be present on the first render so we'll just
// return nothing for now.
if (_.isEmpty(props.currentUserPersonalDetails)) {
return null;
}
const headerContent = (
<View style={[styles.avatarSectionWrapper, styles.justifyContentCenter]}>
{_.isEmpty(props.currentUserPersonalDetails) || _.isUndefined(props.currentUserPersonalDetails.displayName) ? (
Expand Down

0 comments on commit 819a669

Please sign in to comment.