Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rushatgabhane/exfy into trip-room-2
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Jun 2, 2024
2 parents 22c472e + 6af6811 commit 5eba1aa
Show file tree
Hide file tree
Showing 88 changed files with 1,208 additions and 755 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001047703
versionName "1.4.77-3"
versionCode 1001047708
versionName "1.4.77-8"
// 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
1 change: 1 addition & 0 deletions docs/Hidden/Instructions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This folder is used to house articles that should not be live articles on the helpsite.
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.77.3</string>
<string>1.4.77.8</string>
<key>FullStory</key>
<dict>
<key>OrgId</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.77.3</string>
<string>1.4.77.8</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.77</string>
<key>CFBundleVersion</key>
<string>1.4.77.3</string>
<string>1.4.77.8</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
259 changes: 139 additions & 120 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.77-3",
"version": "1.4.77-8",
"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 Expand Up @@ -134,7 +134,7 @@
"react-error-boundary": "^4.0.11",
"react-fast-pdf": "1.0.13",
"react-map-gl": "^7.1.3",
"react-native": "0.73.5",
"react-native": "0.73.4",
"react-native-android-location-enabler": "^2.0.1",
"react-native-blob-util": "0.19.4",
"react-native-collapsible": "^1.6.1",
Expand Down Expand Up @@ -302,7 +302,7 @@
"yaml": "^2.2.1"
},
"overrides": {
"react-native": "0.73.5",
"react-native": "0.73.4",
"expo": "$expo",
"react-native-svg": "$react-native-svg"
},
Expand Down
19 changes: 14 additions & 5 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,9 +662,9 @@ const CONST = {
DELETED_ACCOUNT: 'DELETEDACCOUNT', // OldDot Action
DISMISSED_VIOLATION: 'DISMISSEDVIOLATION',
DONATION: 'DONATION', // OldDot Action
EXPORTED_TO_CSV: 'EXPORTEDTOCSV', // OldDot Action
EXPORTED_TO_INTEGRATION: 'EXPORTEDTOINTEGRATION', // OldDot Action
EXPORTED_TO_QUICK_BOOKS: 'EXPORTEDTOQUICKBOOKS', // OldDot Action
EXPORTED_TO_CSV: 'EXPORTCSV', // OldDot Action
EXPORTED_TO_INTEGRATION: 'EXPORTINTEGRATION', // OldDot Action
EXPORTED_TO_QUICK_BOOKS: 'EXPORTED', // OldDot Action
FORWARDED: 'FORWARDED', // OldDot Action
HOLD: 'HOLD',
HOLD_COMMENT: 'HOLDCOMMENT',
Expand Down Expand Up @@ -1188,6 +1188,10 @@ const CONST = {
WEBP: 'image/webp',
JPEG: 'image/jpeg',
},
ATTACHMENT_TYPE: {
REPORT: 'r',
NOTE: 'n',
},

IMAGE_OBJECT_POSITION: {
TOP: 'top',
Expand Down Expand Up @@ -1307,12 +1311,13 @@ const CONST = {
SYNC: 'sync',
ENABLE_NEW_CATEGORIES: 'enableNewCategories',
EXPORT: 'export',
TENANT_ID: 'tenantID',
IMPORT_CUSTOMERS: 'importCustomers',
IMPORT_TAX_RATES: 'importTaxRates',
INVOICE_STATUS: {
AWAITING_PAYMENT: 'AWT_PAYMENT',
DRAFT: 'DRAFT',
AWAITING_APPROVAL: 'AWT_APPROVAL',
AWAITING_PAYMENT: 'AWT_PAYMENT',
},
IMPORT_TRACKING_CATEGORIES: 'importTrackingCategories',
MAPPINGS: 'mappings',
Expand Down Expand Up @@ -1597,6 +1602,9 @@ const CONST = {
ACCOUNTANT: 'accountant',
},
},
ACCESS_VARIANTS: {
CREATE: 'create',
},
},

GROWL: {
Expand Down Expand Up @@ -1777,7 +1785,8 @@ const CONST = {
XERO: 'xero',
},
SYNC_STAGE_NAME: {
STARTING_IMPORT: 'startingImport',
STARTING_IMPORT_QBO: 'startingImportQBO',
STARTING_IMPORT_XERO: 'startingImportXero',
QBO_IMPORT_MAIN: 'quickbooksOnlineImportMain',
QBO_IMPORT_CUSTOMERS: 'quickbooksOnlineImportCustomers',
QBO_IMPORT_EMPLOYEES: 'quickbooksOnlineImportEmployees',
Expand Down
43 changes: 24 additions & 19 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ const ROUTES = {
SETTINGS_STATUS_CLEAR_AFTER_DATE: 'settings/profile/status/clear-after/date',
SETTINGS_STATUS_CLEAR_AFTER_TIME: 'settings/profile/status/clear-after/time',
SETTINGS_TROUBLESHOOT: 'settings/troubleshoot',
SETTINGS_CONSOLE: 'settings/troubleshoot/console',
SETTINGS_CONSOLE: {
route: 'settings/troubleshoot/console',
getRoute: (backTo?: string) => getUrlWithBackToParam(`settings/troubleshoot/console`, backTo),
},
SETTINGS_SHARE_LOG: {
route: 'settings/troubleshoot/console/share-log',
getRoute: (source: string) => `settings/troubleshoot/console/share-log?source=${encodeURI(source)}` as const,
Expand Down Expand Up @@ -248,9 +251,10 @@ const ROUTES = {
route: 'r/:reportID/details/shareCode',
getRoute: (reportID: string) => `r/${reportID}/details/shareCode` as const,
},
REPORT_ATTACHMENTS: {
route: 'r/:reportID/attachment',
getRoute: (reportID: string, source: string) => `r/${reportID}/attachment?source=${encodeURIComponent(source)}` as const,
ATTACHMENTS: {
route: 'attachment',
getRoute: (reportID: string, type: ValueOf<typeof CONST.ATTACHMENT_TYPE>, url: string, accountID?: number) =>
`attachment?source=${encodeURIComponent(url)}&type=${type}${reportID ? `&reportID=${reportID}` : ''}${accountID ? `&accountID=${accountID}` : ''}` as const,
},
REPORT_PARTICIPANTS: {
route: 'r/:reportID/participants',
Expand Down Expand Up @@ -686,12 +690,12 @@ const ROUTES = {
getRoute: (policyID: string, orderWeight: number) => `settings/workspaces/${policyID}/tags/${orderWeight}/edit` as const,
},
WORKSPACE_TAG_EDIT: {
route: 'settings/workspace/:policyID/tag/:tagName/edit',
getRoute: (policyID: string, tagName: string) => `settings/workspace/${policyID}/tag/${encodeURIComponent(tagName)}/edit` as const,
route: 'settings/workspaces/:policyID/tag/:orderWeight/:tagName/edit',
getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}/edit` as const,
},
WORKSPACE_TAG_SETTINGS: {
route: 'settings/workspaces/:policyID/tag/:tagName',
getRoute: (policyID: string, tagName: string) => `settings/workspaces/${policyID}/tag/${encodeURIComponent(tagName)}` as const,
route: 'settings/workspaces/:policyID/tag/:orderWeight/:tagName',
getRoute: (policyID: string, orderWeight: number, tagName: string) => `settings/workspaces/${policyID}/tag/${orderWeight}/${encodeURIComponent(tagName)}` as const,
},
WORKSPACE_TAG_LIST_VIEW: {
route: 'settings/workspaces/:policyID/tag-list/:orderWeight',
Expand Down Expand Up @@ -809,17 +813,14 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/tracking-categories` as const,
},
POLICY_ACCOUNTING_XERO_TRACKING_CATEGORIES_MAP_COST_CENTERS: {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories/cost-centers',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/tracking-categories/cost-centers` as const,
},
POLICY_ACCOUNTING_XERO_TRACKING_CATEGORIES_MAP_REGION: {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories/region',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/tracking-categories/region` as const,
POLICY_ACCOUNTING_XERO_TRACKING_CATEGORIES_MAP: {
route: 'settings/workspaces/:policyID/accounting/xero/import/tracking-categories/mapping/:categoryId/:categoryName',
getRoute: (policyID: string, categoryId: string, categoryName: string) =>
`settings/workspaces/${policyID}/accounting/xero/import/tracking-categories/mapping/${categoryId}/${encodeURIComponent(categoryName)}` as const,
},
POLICY_ACCOUNTING_XERO_CUSTOMER: {
route: '/settings/workspaces/:policyID/accounting/xero/import/customers',
getRoute: (policyID: string) => `/settings/workspaces/${policyID}/accounting/xero/import/customers` as const,
route: 'settings/workspaces/:policyID/accounting/xero/import/customers',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/import/customers` as const,
},
POLICY_ACCOUNTING_XERO_TAXES: {
route: 'settings/workspaces/:policyID/accounting/xero/import/taxes',
Expand All @@ -830,8 +831,8 @@ const ROUTES = {
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export` as const,
},
POLICY_ACCOUNTING_XERO_PREFERRED_EXPORTER_SELECT: {
route: '/settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select',
getRoute: (policyID: string) => `/settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const,
route: 'settings/workspaces/:policyID/connections/xero/export/preferred-exporter/select',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/connections/xero/export/preferred-exporter/select` as const,
},
POLICY_ACCOUNTING_XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: {
route: 'settings/workspaces/:policyID/accounting/xero/export/purchase-bill-date-select',
Expand All @@ -845,6 +846,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/accounting/xero/advanced',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced` as const,
},
POLICY_ACCOUNTING_XERO_BILL_STATUS_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/xero/export/purchase-bill-status-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/export/purchase-bill-status-selector` as const,
},
POLICY_ACCOUNTING_XERO_INVOICE_SELECTOR: {
route: 'settings/workspaces/:policyID/accounting/xero/advanced/invoice-account-selector',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting/xero/advanced/invoice-account-selector` as const,
Expand Down
6 changes: 3 additions & 3 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type DeepValueOf from './types/utils/DeepValueOf';
const PROTECTED_SCREENS = {
HOME: 'Home',
CONCIERGE: 'Concierge',
REPORT_ATTACHMENTS: 'ReportAttachments',
ATTACHMENTS: 'Attachments',
} as const;

const SCREENS = {
Expand Down Expand Up @@ -248,11 +248,11 @@ const SCREENS = {
XERO_CUSTOMER: 'Policy_Acounting_Xero_Import_Customer',
XERO_TAXES: 'Policy_Accounting_Xero_Taxes',
XERO_TRACKING_CATEGORIES: 'Policy_Accounting_Xero_Tracking_Categories',
XERO_MAP_COST_CENTERS: 'Policy_Accounting_Xero_Map_Cost_Centers',
XERO_MAP_REGION: 'Policy_Accounting_Xero_Map_Region',
XERO_MAP_TRACKING_CATEGORY: 'Policy_Accounting_Xero_Map_Tracking_Category',
XERO_EXPORT: 'Policy_Accounting_Xero_Export',
XERO_EXPORT_PURCHASE_BILL_DATE_SELECT: 'Policy_Accounting_Xero_Export_Purchase_Bill_Date_Select',
XERO_ADVANCED: 'Policy_Accounting_Xero_Advanced',
XERO_BILL_STATUS_SELECTOR: 'Policy_Accounting_Xero_Export_Bill_Status_Selector',
XERO_INVOICE_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Invoice_Account_Selector',
XERO_EXPORT_PREFERRED_EXPORTER_SELECT: 'Workspace_Accounting_Xero_Export_Preferred_Exporter_Select',
XERO_BILL_PAYMENT_ACCOUNT_SELECTOR: 'Policy_Accounting_Xero_Bill_Payment_Account_Selector',
Expand Down
22 changes: 22 additions & 0 deletions src/components/AttachmentContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {createContext} from 'react';
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';

type AttachmentContextProps = {
type?: ValueOf<typeof CONST.ATTACHMENT_TYPE>;
reportID?: string;
accountID?: number;
};

const AttachmentContext = createContext<AttachmentContextProps>({
type: undefined,
reportID: undefined,
accountID: undefined,
});

AttachmentContext.displayName = 'AttachmentContext';

export {
// eslint-disable-next-line import/prefer-default-export
AttachmentContext,
};
11 changes: 11 additions & 0 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {GestureHandlerRootView} from 'react-native-gesture-handler';
import {withOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import {useSharedValue} from 'react-native-reanimated';
import type {ValueOf} from 'type-fest';
import useLocalize from '@hooks/useLocalize';
import useNetwork from '@hooks/useNetwork';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand Down Expand Up @@ -101,6 +102,12 @@ type AttachmentModalProps = AttachmentModalOnyxProps & {
/** The report that has this attachment */
report?: OnyxEntry<OnyxTypes.Report> | EmptyObject;

/** The type of the attachment */
type?: ValueOf<typeof CONST.ATTACHMENT_TYPE>;

/** If the attachment originates from a note, the accountID will represent the author of that note. */
accountID?: number;

/** Optional callback to fire when we want to do something after modal show. */
onModalShow?: () => void;

Expand Down Expand Up @@ -156,6 +163,8 @@ function AttachmentModal({
onModalClose = () => {},
isLoading = false,
shouldShowNotFoundPage = false,
type = undefined,
accountID = undefined,
}: AttachmentModalProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -519,6 +528,8 @@ function AttachmentModal({
)}
{!isEmptyObject(report) && !isReceiptAttachment ? (
<AttachmentCarousel
accountID={accountID}
type={type}
report={report}
onNavigate={onNavigate}
onClose={closeModal}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import {Parser as HtmlParser} from 'htmlparser2';
import type {OnyxEntry} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import type {Attachment} from '@components/Attachments/types';
import * as FileUtils from '@libs/fileDownload/FileUtils';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import {getReport} from '@libs/ReportUtils';
import tryResolveUrlFromApiRoot from '@libs/tryResolveUrlFromApiRoot';
import CONST from '@src/CONST';
import type {ReportAction, ReportActions} from '@src/types/onyx';

/**
* Constructs the initial component state from report actions
*/
function extractAttachmentsFromReport(parentReportAction?: OnyxEntry<ReportAction>, reportActions?: OnyxEntry<ReportActions>) {
const actions = [...(parentReportAction ? [parentReportAction] : []), ...ReportActionsUtils.getSortedReportActions(Object.values(reportActions ?? {}))];
function extractAttachments(
type: ValueOf<typeof CONST.ATTACHMENT_TYPE>,
{reportID, accountID, parentReportAction, reportActions}: {reportID?: string; accountID?: number; parentReportAction?: OnyxEntry<ReportAction>; reportActions?: OnyxEntry<ReportActions>},
) {
const report = getReport(reportID);
const privateNotes = report?.privateNotes;
const targetNote = privateNotes?.[Number(accountID)]?.note ?? '';
const attachments: Attachment[] = [];

// We handle duplicate image sources by considering the first instance as original. Selecting any duplicate
Expand Down Expand Up @@ -71,6 +78,14 @@ function extractAttachmentsFromReport(parentReportAction?: OnyxEntry<ReportActio
},
});

if (type === CONST.ATTACHMENT_TYPE.NOTE) {
htmlParser.write(targetNote);
htmlParser.end();

return attachments.reverse();
}

const actions = [...(parentReportAction ? [parentReportAction] : []), ...ReportActionsUtils.getSortedReportActions(Object.values(reportActions ?? {}))];
actions.forEach((action, key) => {
if (!ReportActionsUtils.shouldReportActionBeVisible(action, key) || ReportActionsUtils.isMoneyRequestAction(action)) {
return;
Expand All @@ -86,4 +101,4 @@ function extractAttachmentsFromReport(parentReportAction?: OnyxEntry<ReportActio
return attachments.reverse();
}

export default extractAttachmentsFromReport;
export default extractAttachments;
Loading

0 comments on commit 5eba1aa

Please sign in to comment.