Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/rezkiy37/Expensify into fix…
Browse files Browse the repository at this point in the history
…/36859-no-search-when-many-tags
  • Loading branch information
rezkiy37 committed Feb 20, 2024
2 parents 675d9b5 + 00c5fd2 commit 7438d94
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 80 deletions.
15 changes: 15 additions & 0 deletions android/app/src/main/java/com/expensify/chat/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.expensify.chat

import android.app.ActivityManager
import android.content.res.Configuration
import android.database.CursorWindow
import android.os.Process
import androidx.multidex.MultiDexApplication
import com.expensify.chat.bootsplash.BootSplashPackage
import com.facebook.react.PackageList
Expand Down Expand Up @@ -40,6 +42,10 @@ class MainApplication : MultiDexApplication(), ReactApplication {
override fun onCreate() {
super.onCreate()

if (isOnfidoProcess()) {
return
}

SoLoader.init(this, /* native exopackage */false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
Expand Down Expand Up @@ -73,4 +79,13 @@ class MainApplication : MultiDexApplication(), ReactApplication {
super.onConfigurationChanged(newConfig)
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
}

private fun isOnfidoProcess(): Boolean {
val pid = Process.myPid()
val manager = this.getSystemService(ACTIVITY_SERVICE) as ActivityManager

return manager.runningAppProcesses.any {
it.pid == pid && it.processName.endsWith(":onfido_process")
}
}
}
7 changes: 7 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ allprojects {
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
force "com.facebook.react:hermes-engine:" + REACT_NATIVE_VERSION

eachDependency { dependency ->
if (dependency.requested.group == 'org.bouncycastle') {
println dependency.requested.module
dependency.useTarget 'org.bouncycastle:bcprov-jdk15to18:1.71'
}
}
}
}
repositories {
Expand Down
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ PODS:
- nanopb/encode (= 2.30908.0)
- nanopb/decode (2.30908.0)
- nanopb/encode (2.30908.0)
- Onfido (28.3.1)
- onfido-react-native-sdk (8.3.0):
- Onfido (~> 28.3.0)
- Onfido (29.6.0)
- onfido-react-native-sdk (10.6.0):
- Onfido (~> 29.6.0)
- React
- OpenSSL-Universal (1.1.1100)
- Plaid (4.7.0)
Expand Down Expand Up @@ -1903,8 +1903,8 @@ SPEC CHECKSUMS:
MapboxMaps: cbb38845a9bf49b124f0e937975d560a4e01894e
MapboxMobileEvents: de50b3a4de180dd129c326e09cd12c8adaaa46d6
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
Onfido: 564f60c39819635ec5b549285a1eec278cc9ba67
onfido-react-native-sdk: b346a620af5669f9fecb6dc3052314a35a94ad9f
Onfido: c52e797b10cc9e6d29ba91996cb62e501000bfdd
onfido-react-native-sdk: 4e7f0a7a986ed93cb906d2e0b67a6aab9202de0b
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
Plaid: 431ef9be5314a1345efb451bc5e6b067bfb3b4c6
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
Expand Down
21 changes: 16 additions & 5 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
Expand Up @@ -72,7 +72,7 @@
"@kie/act-js": "^2.6.0",
"@kie/mock-github": "^1.0.0",
"@oguzhnatly/react-native-image-manipulator": "github:Expensify/react-native-image-manipulator#5cdae3d4455b03a04c57f50be3863e2fe6c92c52",
"@onfido/react-native-sdk": "8.3.0",
"@onfido/react-native-sdk": "10.6.0",
"@react-native-async-storage/async-storage": "1.21.0",
"@react-native-camera-roll/camera-roll": "7.4.0",
"@react-native-clipboard/clipboard": "^1.13.2",
Expand Down
18 changes: 18 additions & 0 deletions patches/@onfido+react-native-sdk+10.6.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/node_modules/@onfido/react-native-sdk/android/build.gradle b/node_modules/@onfido/react-native-sdk/android/build.gradle
index 33a4229..1720bef 100644
--- a/node_modules/@onfido/react-native-sdk/android/build.gradle
+++ b/node_modules/@onfido/react-native-sdk/android/build.gradle
@@ -84,6 +84,13 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+
+ publishing {
+ singleVariant('release') {
+ withSourcesJar()
+ withJavadocJar()
+ }
+ }
}

repositories {
31 changes: 0 additions & 31 deletions patches/@onfido+react-native-sdk+8.3.0.patch

This file was deleted.

10 changes: 5 additions & 5 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const CONST = {
},

DATE_BIRTH: {
MIN_AGE: 5,
MIN_AGE: 0,
MIN_AGE_FOR_PAYMENT: 18,
MAX_AGE: 150,
},
Expand All @@ -148,23 +148,23 @@ const CONST = {
SMALL_SCREEN: {
IMAGE_HEIGHT: 300,
CONTAINER_MINHEIGHT: 200,
VIEW_HEIGHT: 185,
VIEW_HEIGHT: 240,
},
WIDE_SCREEN: {
IMAGE_HEIGHT: 450,
CONTAINER_MINHEIGHT: 500,
VIEW_HEIGHT: 275,
VIEW_HEIGHT: 390,
},
MONEY_OR_TASK_REPORT: {
SMALL_SCREEN: {
IMAGE_HEIGHT: 300,
CONTAINER_MINHEIGHT: 280,
VIEW_HEIGHT: 220,
VIEW_HEIGHT: 240,
},
WIDE_SCREEN: {
IMAGE_HEIGHT: 450,
CONTAINER_MINHEIGHT: 280,
VIEW_HEIGHT: 275,
VIEW_HEIGHT: 390,
},
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/DatePicker/CalendarPicker/YearPickerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear
const yearsList = searchText === '' ? years : years.filter((year) => year.text.includes(searchText));
return {
headerMessage: !yearsList.length ? translate('common.noResultsFound') : '',
sections: [{data: yearsList, indexOffset: 0}],
sections: [{data: yearsList.sort((a, b) => b.value - a.value), indexOffset: 0}],
};
}, [years, searchText, translate]);

Expand Down Expand Up @@ -78,6 +78,7 @@ function YearPickerModal({isVisible, years, currentYear = new Date().getFullYear
initiallyFocusedOptionKey={currentYear.toString()}
showScrollIndicator
shouldStopPropagation
shouldUseDynamicMaxToRenderPerBatch
/>
</ScreenWrapper>
</Modal>
Expand Down
10 changes: 8 additions & 2 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class BaseOptionsSelector extends Component {
const allOptions = this.flattenSections();
const sections = this.sliceSections();
const focusedIndex = this.getInitiallyFocusedIndex(allOptions);
this.focusedOption = allOptions[focusedIndex];

this.state = {
sections,
Expand Down Expand Up @@ -146,6 +147,10 @@ class BaseOptionsSelector extends Component {
});
}

if (prevState.focusedIndex !== this.state.focusedIndex) {
this.focusedOption = this.state.allOptions[this.state.focusedIndex];
}

if (_.isEqual(this.props.sections, prevProps.sections)) {
return;
}
Expand All @@ -162,13 +167,14 @@ class BaseOptionsSelector extends Component {
}
const newFocusedIndex = this.props.selectedOptions.length;
const isNewFocusedIndex = newFocusedIndex !== this.state.focusedIndex;

const prevFocusedOption = _.find(newOptions, (option) => this.focusedOption && option.keyForList === this.focusedOption.keyForList);
const prevFocusedOptionIndex = prevFocusedOption ? _.findIndex(newOptions, (option) => this.focusedOption && option.keyForList === this.focusedOption.keyForList) : undefined;
// eslint-disable-next-line react/no-did-update-set-state
this.setState(
{
sections: newSections,
allOptions: newOptions,
focusedIndex: _.isNumber(this.props.focusedIndex) ? this.props.focusedIndex : newFocusedIndex,
focusedIndex: prevFocusedOptionIndex || (_.isNumber(this.props.focusedIndex) ? this.props.focusedIndex : newFocusedIndex),
},
() => {
// If we just toggled an option on a multi-selection page or cleared the search input, scroll to top
Expand Down
1 change: 1 addition & 0 deletions src/libs/GooglePlacesUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ function getPlaceAutocompleteTerms(addressTerms: AddressTerm[]): GetPlaceAutocom
}

export {getAddressComponents, getPlaceAutocompleteTerms};
export type {AddressComponent, FieldsToExtract, AddressTerm};
12 changes: 8 additions & 4 deletions src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,22 @@ function parseMessage(messages: Message[] | undefined) {
}

type BuildNextStepParameters = {
isPaidWithWallet?: boolean;
isPaidWithExpensify?: boolean;
};

/**
* Generates an optimistic nextStep based on a current report status and other properties.
*
* @param report
* @param predictedNextStatus - a next expected status of the report
* @param parameters.isPaidWithWallet - Whether a report has been paid with the wallet or outside of Expensify
* @param parameters.isPaidWithExpensify - Whether a report has been paid with Expensify or outside
* @returns nextStep
*/
function buildNextStep(report: Report | EmptyObject, predictedNextStatus: ValueOf<typeof CONST.REPORT.STATUS_NUM>, {isPaidWithWallet}: BuildNextStepParameters = {}): ReportNextStep | null {
function buildNextStep(
report: Report | EmptyObject,
predictedNextStatus: ValueOf<typeof CONST.REPORT.STATUS_NUM>,
{isPaidWithExpensify}: BuildNextStepParameters = {},
): ReportNextStep | null {
if (!ReportUtils.isExpenseReport(report)) {
return null;
}
Expand Down Expand Up @@ -317,7 +321,7 @@ function buildNextStep(report: Report | EmptyObject, predictedNextStatus: ValueO
};

// Paid outside of Expensify
if (isPaidWithWallet === false) {
if (isPaidWithExpensify === false) {
optimisticNextStep.message?.push({text: ' outside of Expensify'});
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3314,7 +3314,7 @@ function getPayMoneyRequestParams(chatReport: OnyxTypes.Report, iouReport: OnyxT
}

const currentNextStep = allNextSteps[`${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport.reportID}`] ?? null;
const optimisticNextStep = NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithWallet: paymentMethodType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY});
const optimisticNextStep = NextStepUtils.buildNextStep(iouReport, CONST.REPORT.STATUS_NUM.REIMBURSED, {isPaidWithExpensify: paymentMethodType === CONST.IOU.PAYMENT_TYPE.VBBA});

const optimisticData: OnyxUpdate[] = [
{
Expand Down
1 change: 0 additions & 1 deletion src/pages/WorkspaceSwitcherPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ function WorkspaceSwitcherPage({policies}: WorkspaceSwitcherPageProps) {
highlightSelectedOptions
shouldShowOptions
autoFocus={false}
disableFocusOptions={!activeWorkspaceID}
canSelectMultipleOptions={false}
shouldShowSubscript={false}
showTitleTooltip={false}
Expand Down
38 changes: 31 additions & 7 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,28 @@ function ReportActionItem(props) {
if (props.action.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED) {
const parentReportAction = props.parentReportActions[props.report.parentReportActionID];
if (ReportActionsUtils.isTransactionThread(parentReportAction)) {
const isReversedTransaction = ReportActionsUtils.isReversedTransaction(parentReportAction);
if (ReportActionsUtils.isDeletedParentAction(parentReportAction) || isReversedTransaction) {
return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth, true), styles.justifyContentEnd]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]}>
<OfflineWithFeedback pendingAction={lodashGet(parentReportAction, 'pendingAction', null)}>
<ReportActionItemSingle
action={parentReportAction}
showHeader
report={props.report}
>
<RenderHTML
html={`<comment>${props.translate(isReversedTransaction ? 'parentReportAction.reversedTransaction' : 'parentReportAction.deletedRequest')}</comment>`}
/>
</ReportActionItemSingle>
<View style={styles.threadDividerLine} />
</OfflineWithFeedback>
</View>
</View>
);
}
return (
<ShowContextMenuContext.Provider value={contextValue}>
<MoneyRequestView
Expand All @@ -639,7 +661,7 @@ function ReportActionItem(props) {
if (ReportUtils.isTaskReport(props.report)) {
if (ReportUtils.isCanceledTaskReport(props.report, parentReportAction)) {
return (
<View style={[StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth, true)]}>
<View style={[StyleUtils.getReportWelcomeContainerStyle(props.isSmallScreenWidth)]}>
<AnimatedEmptyStateBackground />
<View style={[StyleUtils.getReportWelcomeTopMarginStyle(props.isSmallScreenWidth)]}>
<ReportActionItemSingle
Expand All @@ -649,7 +671,6 @@ function ReportActionItem(props) {
>
<RenderHTML html={`<comment>${props.translate('parentReportAction.deletedTask')}</comment>`} />
</ReportActionItemSingle>
<View style={styles.reportHorizontalRule} />
</View>
</View>
);
Expand Down Expand Up @@ -857,9 +878,10 @@ export default compose(
},
}),
)(
memo(
ReportActionItem,
(prevProps, nextProps) =>
memo(ReportActionItem, (prevProps, nextProps) => {
const prevParentReportAction = prevProps.parentReportActions[prevProps.report.parentReportActionID];
const nextParentReportAction = nextProps.parentReportActions[nextProps.report.parentReportActionID];
return (
prevProps.displayAsGroup === nextProps.displayAsGroup &&
prevProps.draftMessage === nextProps.draftMessage &&
prevProps.isMostRecentIOUReportAction === nextProps.isMostRecentIOUReportAction &&
Expand Down Expand Up @@ -888,6 +910,8 @@ export default compose(
prevProps.linkedReportActionID === nextProps.linkedReportActionID &&
_.isEqual(prevProps.policyReportFields, nextProps.policyReportFields) &&
_.isEqual(prevProps.report.reportFields, nextProps.report.reportFields) &&
_.isEqual(prevProps.policy, nextProps.policy),
),
_.isEqual(prevProps.policy, nextProps.policy) &&
_.isEqual(prevParentReportAction, nextParentReportAction)
);
}),
);
Loading

0 comments on commit 7438d94

Please sign in to comment.