Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rushatgabhane/exfy into upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed Jul 30, 2024
2 parents d787c29 + a5a17b0 commit 0836ad5
Show file tree
Hide file tree
Showing 40 changed files with 145 additions and 91 deletions.
4 changes: 2 additions & 2 deletions .github/actions/composite/setupNode/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ runs:

- name: Install root project node packages
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
with:
timeout_minutes: 30
max_attempts: 3
command: npm ci

- name: Install node packages for desktop submodule
if: steps.cache-desktop-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@v2
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
with:
timeout_minutes: 30
max_attempts: 3
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/verifyPodfile.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

START_DIR=$(pwd)
ROOT_DIR=$(dirname "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")
cd "$ROOT_DIR" || exit 1
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,13 @@ jobs:
with:
path: ios/Pods
key: ${{ runner.os }}-pods-cache-${{ hashFiles('ios/Podfile.lock', 'firebase.json') }}
restore-keys: ${{ runner.os }}-pods-cache-

- name: Compare Podfile.lock and Manifest.lock
id: compare-podfile-and-manifest
run: echo "IS_PODFILE_SAME_AS_MANIFEST=${{ hashFiles('ios/Podfile.lock') == hashFiles('ios/Pods/Manifest.lock') }}" >> "$GITHUB_OUTPUT"

- name: Install cocoapods
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
if: steps.pods-cache.outputs.cache-hit != 'true' || steps.compare-podfile-and-manifest.outputs.IS_PODFILE_SAME_AS_MANIFEST != 'true' || steps.setup-node.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,13 @@ jobs:
with:
path: ios/Pods
key: ${{ runner.os }}-pods-cache-${{ hashFiles('ios/Podfile.lock', 'firebase.json') }}
restore-keys: ${{ runner.os }}-pods-cache-

- name: Compare Podfile.lock and Manifest.lock
id: compare-podfile-and-manifest
run: echo "IS_PODFILE_SAME_AS_MANIFEST=${{ hashFiles('ios/Podfile.lock') == hashFiles('ios/Pods/Manifest.lock') }}" >> "$GITHUB_OUTPUT"

- name: Install cocoapods
uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
if: steps.pods-cache.outputs.cache-hit != 'true' || steps.compare-podfile-and-manifest.outputs.IS_PODFILE_SAME_AS_MANIFEST != 'true' || steps.setup-node.outputs.cache-hit != 'true'
with:
timeout_minutes: 10
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009001401
versionName "9.0.14-1"
versionCode 1009001402
versionName "9.0.14-2"
// 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>9.0.14.1</string>
<string>9.0.14.2</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>9.0.14.1</string>
<string>9.0.14.2</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>9.0.14</string>
<key>CFBundleVersion</key>
<string>9.0.14.1</string>
<string>9.0.14.2</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": "9.0.14-1",
"version": "9.0.14-2",
"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
4 changes: 1 addition & 3 deletions src/components/ConnectToNetSuiteButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ function ConnectToNetSuiteButton({policyID, shouldDisconnectIntegrationBeforeCon
<Button
onPress={() => {
if (!isControlPolicy(policy)) {
Navigation.navigate(
ROUTES.WORKSPACE_UPGRADE.getRoute(policyID, CONST.UPGRADE_FEATURE_INTRO_MAPPING.netsuite.alias, ROUTES.POLICY_ACCOUNTING_NETSUITE_TOKEN_INPUT.getRoute(policyID)),
);
Navigation.navigate(ROUTES.WORKSPACE_UPGRADE.getRoute(policyID, CONST.UPGRADE_FEATURE_INTRO_MAPPING.netsuite.alias));
return;
}

Expand Down
8 changes: 1 addition & 7 deletions src/components/ConnectToSageIntacctButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,7 @@ function ConnectToSageIntacctButton({policyID, shouldDisconnectIntegrationBefore
<Button
onPress={() => {
if (!isControlPolicy(policy)) {
Navigation.navigate(
ROUTES.WORKSPACE_UPGRADE.getRoute(
policyID,
CONST.UPGRADE_FEATURE_INTRO_MAPPING.intacct.alias,
ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_PREREQUISITES.getRoute(policyID),
),
);
Navigation.navigate(ROUTES.WORKSPACE_UPGRADE.getRoute(policyID, CONST.UPGRADE_FEATURE_INTRO_MAPPING.intacct.alias));
return;
}

Expand Down
17 changes: 16 additions & 1 deletion src/components/HybridAppMiddleware/index.ios.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from 'react';
import {useContext, useEffect, useState} from 'react';
import {useContext, useEffect, useRef, useState} from 'react';
import {NativeEventEmitter, NativeModules} from 'react-native';
import type {NativeModule} from 'react-native';
import {useOnyx} from 'react-native-onyx';
Expand All @@ -15,6 +15,7 @@ import * as Welcome from '@userActions/Welcome';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {HybridAppRoute, Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import type {TryNewDot} from '@src/types/onyx';

type HybridAppMiddlewareProps = {
Expand Down Expand Up @@ -50,6 +51,20 @@ function HybridAppMiddleware({children, authenticated}: HybridAppMiddlewareProps
const [sessionEmail] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email});
const [completedHybridAppOnboarding] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT, {selector: onboardingStatusSelector});

const maxTimeoutRef = useRef<NodeJS.Timeout | null>(null);

// We need to ensure that the BootSplash is always hidden after a certain period.
useEffect(() => {
if (!NativeModules.HybridAppModule) {
return;
}

maxTimeoutRef.current = setTimeout(() => {
Log.info('[HybridApp] Forcing transition due to unknown problem', true);
setStartedTransition(true);
setExitTo(ROUTES.HOME);
}, 3000);
}, []);
/**
* This useEffect tracks changes of `nvp_tryNewDot` value.
* We propagate it from OldDot to NewDot with native method due to limitations of old app.
Expand Down
25 changes: 21 additions & 4 deletions src/components/HybridAppMiddleware/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type React from 'react';
import {useContext, useEffect, useState} from 'react';
import {useContext, useEffect, useRef, useState} from 'react';
import {NativeModules} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
Expand All @@ -14,6 +14,7 @@ import * as Welcome from '@userActions/Welcome';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {HybridAppRoute, Route} from '@src/ROUTES';
import ROUTES from '@src/ROUTES';
import type {TryNewDot} from '@src/types/onyx';

type HybridAppMiddlewareProps = {
Expand Down Expand Up @@ -49,6 +50,20 @@ function HybridAppMiddleware({children, authenticated}: HybridAppMiddlewareProps
const [sessionEmail] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email});
const [completedHybridAppOnboarding] = useOnyx(ONYXKEYS.NVP_TRYNEWDOT, {selector: onboardingStatusSelector});

const maxTimeoutRef = useRef<NodeJS.Timeout | null>(null);

// We need to ensure that the BootSplash is always hidden after a certain period.
useEffect(() => {
if (!NativeModules.HybridAppModule) {
return;
}

maxTimeoutRef.current = setTimeout(() => {
Log.info('[HybridApp] Forcing transition due to unknown problem', true);
setStartedTransition(true);
setExitTo(ROUTES.HOME);
}, 3000);
}, []);
/**
* This useEffect tracks changes of `nvp_tryNewDot` value.
* We propagate it from OldDot to NewDot with native method due to limitations of old app.
Expand Down Expand Up @@ -93,13 +108,15 @@ function HybridAppMiddleware({children, authenticated}: HybridAppMiddlewareProps
Navigation.isNavigationReady().then(() => {
// We need to remove /transition from route history.
// `useExitTo` returns undefined for routes other than /transition.
if (exitToParam) {
if (exitToParam && Navigation.getActiveRoute().includes(ROUTES.TRANSITION_BETWEEN_APPS)) {
Log.info('[HybridApp] Removing /transition route from history', true);
Navigation.goBack();
}

Log.info('[HybridApp] Navigating to `exitTo` route', true, {exitTo});
Navigation.navigate(Navigation.parseHybridAppUrl(exitTo));
if (exitTo !== ROUTES.HOME) {
Log.info('[HybridApp] Navigating to `exitTo` route', true, {exitTo});
Navigation.navigate(Navigation.parseHybridAppUrl(exitTo));
}
setExitTo(undefined);

setTimeout(() => {
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useAutoFocusInput.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {useFocusEffect} from '@react-navigation/native';
import {useCallback, useContext, useEffect, useRef, useState} from 'react';
import type {RefObject} from 'react';
import type {TextInput} from 'react-native';
import {InteractionManager} from 'react-native';
import CONST from '@src/CONST';
import * as Expensify from '@src/Expensify';

type UseAutoFocusInput = {
inputCallbackRef: (ref: TextInput | null) => void;
inputRef: RefObject<TextInput | null>;
};

export default function useAutoFocusInput(): UseAutoFocusInput {
Expand Down Expand Up @@ -55,5 +57,5 @@ export default function useAutoFocusInput(): UseAutoFocusInput {
setIsInputInitialized(true);
};

return {inputCallbackRef};
return {inputCallbackRef, inputRef};
}
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,8 @@ export default {
headsUp: 'Heads up!',
unapproveWithIntegrationWarning: (accountingIntegration: string) =>
`This report has already been exported to ${accountingIntegration}. Changes to this report in Expensify may lead to data discrepancies and Expensify Card reconciliation issues. Are you sure you want to unapprove this report?`,
reimbursable: 'reimbursable',
nonReimbursable: 'non-reimbursable',
},
notificationPreferencesPage: {
header: 'Notification preferences',
Expand Down
4 changes: 3 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ export default {
`estableció la distancia a ${newDistanceToDisplay}, lo que estableció el importe a ${newAmountToDisplay}`,
removedTheRequest: ({valueName, oldValueToDisplay}: RemovedTheRequestParams) => `${valueName === 'comerciante' ? 'el' : 'la'} ${valueName} (previamente ${oldValueToDisplay})`,
updatedTheRequest: ({valueName, newValueToDisplay, oldValueToDisplay}: UpdatedTheRequestParams) =>
`${valueName === 'comerciante' || valueName === 'importe' ? 'el' : 'la'} ${valueName} a ${newValueToDisplay} (previamente ${oldValueToDisplay})`,
`${valueName === 'comerciante' || valueName === 'importe' || valueName === 'gasto' ? 'el' : 'la'} ${valueName} a ${newValueToDisplay} (previamente ${oldValueToDisplay})`,
updatedTheDistance: ({newDistanceToDisplay, oldDistanceToDisplay, newAmountToDisplay, oldAmountToDisplay}: UpdatedTheDistanceParams) =>
`cambió la distancia a ${newDistanceToDisplay} (previamente ${oldDistanceToDisplay}), lo que cambió el importe a ${newAmountToDisplay} (previamente ${oldAmountToDisplay})`,
threadExpenseReportName: ({formattedAmount, comment}: ThreadRequestReportNameParams) => `${comment ? `${formattedAmount} para ${comment}` : `Gasto de ${formattedAmount}`}`,
Expand Down Expand Up @@ -841,6 +841,8 @@ export default {
headsUp: 'Atención!',
unapproveWithIntegrationWarning: (accountingIntegration: string) =>
`Este informe ya se ha exportado a ${accountingIntegration}. Los cambios realizados en este informe en Expensify pueden provocar discrepancias en los datos y problemas de conciliación de la tarjeta Expensify. ¿Está seguro de que desea anular la aprobación de este informe?`,
reimbursable: 'reembolsable',
nonReimbursable: 'no reembolsable',
},
notificationPreferencesPage: {
header: 'Preferencias de avisos',
Expand Down
20 changes: 20 additions & 0 deletions src/libs/ModifiedExpenseMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ Onyx.connect({
},
});

/**
* Utility to get message based on boolean literal value.
*/
function getBooleanLiteralMessage(value: string | undefined, truthyMessage: string, falsyMessage: string): string {
return value === 'true' ? truthyMessage : falsyMessage;
}

/**
* Builds the partial message fragment for a modified field on the expense.
*/
Expand Down Expand Up @@ -261,6 +268,19 @@ function getForReportAction(reportID: string | undefined, reportAction: OnyxEntr
);
}

const hasModifiedReimbursable = reportActionOriginalMessage && 'oldReimbursable' in reportActionOriginalMessage && 'reimbursable' in reportActionOriginalMessage;
if (hasModifiedReimbursable) {
buildMessageFragmentForValue(
getBooleanLiteralMessage(reportActionOriginalMessage?.reimbursable, Localize.translateLocal('iou.reimbursable'), Localize.translateLocal('iou.nonReimbursable')),
getBooleanLiteralMessage(reportActionOriginalMessage?.oldReimbursable, Localize.translateLocal('iou.reimbursable'), Localize.translateLocal('iou.nonReimbursable')),
Localize.translateLocal('iou.expense'),
true,
setFragments,
removalFragments,
changeFragments,
);
}

const message =
getMessageLine(`\n${Localize.translateLocal('iou.changed')}`, changeFragments) +
getMessageLine(`\n${Localize.translateLocal('iou.set')}`, setFragments) +
Expand Down
3 changes: 2 additions & 1 deletion src/libs/Navigation/AppNavigator/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {memo, useContext, useEffect} from 'react';
import {NativeModules} from 'react-native';
import {InitialURLContext} from '@components/InitialURLContextProvider';
import Navigation from '@libs/Navigation/Navigation';
import ROUTES from '@src/ROUTES';
import type ReactComponentModule from '@src/types/utils/ReactComponentModule';

type AppNavigatorProps = {
Expand All @@ -13,7 +14,7 @@ function AppNavigator({authenticated}: AppNavigatorProps) {
const initUrl = useContext(InitialURLContext);

useEffect(() => {
if (!NativeModules.HybridAppModule || !initUrl) {
if (!NativeModules.HybridAppModule || !initUrl || !initUrl.includes(ROUTES.TRANSITION_BETWEEN_APPS)) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/libs/Navigation/AppNavigator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {lazy, memo, Suspense, useContext, useEffect} from 'react';
import {NativeModules} from 'react-native';
import {InitialURLContext} from '@components/InitialURLContextProvider';
import Navigation from '@libs/Navigation/Navigation';
import ROUTES from '@src/ROUTES';
import lazyRetry from '@src/utils/lazyRetry';

const AuthScreens = lazy(() => lazyRetry(() => import('./AuthScreens')));
Expand All @@ -16,7 +17,7 @@ function AppNavigator({authenticated}: AppNavigatorProps) {
const initUrl = useContext(InitialURLContext);

useEffect(() => {
if (!NativeModules.HybridAppModule || !initUrl) {
if (!NativeModules.HybridAppModule || !initUrl || !initUrl.includes(ROUTES.TRANSITION_BETWEEN_APPS)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {NativeModules} from 'react-native';
import Onyx from 'react-native-onyx';
import applyOnyxUpdatesReliably from '@libs/actions/applyOnyxUpdatesReliably';
import * as ActiveClientManager from '@libs/ActiveClientManager';
Expand Down Expand Up @@ -85,6 +86,10 @@ function navigateToReport({reportID, reportActionID}: ReportActionPushNotificati
// The attachment modal remains open when navigating to the report so we need to close it
Modal.close(() => {
try {
// Get rid of the transition screen, if it is on the top of the stack
if (NativeModules.HybridAppModule && Navigation.getActiveRoute().includes(ROUTES.TRANSITION_BETWEEN_APPS)) {
Navigation.goBack();
}
// If a chat is visible other than the one we are trying to navigate to, then we need to navigate back
if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) {
Navigation.goBack();
Expand Down
3 changes: 1 addition & 2 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6628,9 +6628,8 @@ function canApproveIOU(
return false;
}

const isOnInstantSubmitPolicy = PolicyUtils.isInstantSubmitEnabled(policy);
const isOnSubmitAndClosePolicy = PolicyUtils.isSubmitAndClose(policy);
if (isOnInstantSubmitPolicy && isOnSubmitAndClosePolicy) {
if (isOnSubmitAndClosePolicy) {
return false;
}

Expand Down
4 changes: 3 additions & 1 deletion src/pages/PrivateNotes/PrivateNotesEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ function PrivateNotesEditPage({route, personalDetailsList, report, session}: Pri
if (!el) {
return;
}
if (!privateNotesInput.current) {
updateMultilineInputRange(el);
}
privateNotesInput.current = el;
updateMultilineInputRange(privateNotesInput.current);
}}
isMarkdownEnabled
/>
Expand Down
Loading

0 comments on commit 0836ad5

Please sign in to comment.