Skip to content

Commit

Permalink
Fix conflicts again
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Sep 30, 2022
2 parents a4e360b + 6c81537 commit f9491de
Show file tree
Hide file tree
Showing 24 changed files with 265 additions and 249 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001021000
versionName "1.2.10-0"
versionCode 1001021001
versionName "1.2.10-1"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.10.0</string>
<string>1.2.10.1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</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.2.10.0</string>
<string>1.2.10.1</string>
</dict>
</plist>
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.2.10-0",
"version": "1.2.10-1",
"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 @@ -94,7 +94,7 @@
"react-native-image-picker": "^4.8.5",
"react-native-image-size": "git+https://github.com/Expensify/react-native-image-size#6b5ab5110dc3ed554f8eafbc38d7d87c17147972",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.15",
"react-native-onyx": "1.0.17",
"react-native-pdf": "^6.6.2",
"react-native-performance": "^2.0.0",
"react-native-permissions": "^3.0.1",
Expand All @@ -104,7 +104,7 @@
"react-native-render-html": "6.3.1",
"react-native-safe-area-context": "^3.1.4",
"react-native-screens": "^3.10.1",
"react-native-svg": "^12.1.0",
"react-native-svg": "^12.4.4",
"react-native-webview": "^11.17.2",
"react-pdf": "5.7.2",
"react-plaid-link": "3.3.2",
Expand Down
1 change: 1 addition & 0 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ export default {
FORMS: {
ADD_DEBIT_CARD_FORM: 'addDebitCardForm',
REQUEST_CALL_FORM: 'requestCallForm',
REIMBURSEMENT_ACCOUNT_FORM: 'reimbursementAccount',
},

// Whether we should show the compose input or not
Expand Down
29 changes: 25 additions & 4 deletions src/components/BlockingViews/FullPageNotFoundView.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,30 @@ const propTypes = {

/** If true, child components are replaced with a blocking "not found" view */
shouldShow: PropTypes.bool,

/** The key in the translations file to use for the title */
titleKey: PropTypes.string,

/** The key in the translations file to use for the subtitle */
subtitleKey: PropTypes.string,

/** Whether we should show a back icon */
shouldShowBackButton: PropTypes.bool,

/** Whether we should show a close button */
shouldShowCloseButton: PropTypes.bool,

/** Method to trigger when pressing the back button of the header */
onBackButtonPress: PropTypes.func,
};

const defaultProps = {
shouldShow: false,
titleKey: 'notFound.notHere',
subtitleKey: 'notFound.pageNotFound',
shouldShowBackButton: true,
shouldShowCloseButton: true,
onBackButtonPress: () => Navigation.dismissModal(),
};

// eslint-disable-next-line rulesdir/no-negated-variables
Expand All @@ -30,15 +50,16 @@ const FullPageNotFoundView = (props) => {
return (
<>
<HeaderWithCloseButton
shouldShowBackButton
onBackButtonPress={() => Navigation.dismissModal()}
shouldShowBackButton={props.shouldShowBackButton}
shouldShowCloseButton={props.shouldShowCloseButton}
onBackButtonPress={props.onBackButtonPress}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<View style={styles.flex1}>
<BlockingView
icon={Expensicons.QuestionMark}
title={props.translate('notFound.notHere')}
subtitle={props.translate('notFound.pageNotFound')}
title={props.translate(props.titleKey)}
subtitle={props.translate(props.subtitleKey)}
/>
</View>
</>
Expand Down
24 changes: 18 additions & 6 deletions src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {withOnyx} from 'react-native-onyx';
import compose from '../libs/compose';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import * as FormActions from '../libs/actions/FormActions';
import * as ErrorUtils from '../libs/ErrorUtils';
import styles from '../styles/styles';
import FormAlertWithSubmitButton from './FormAlertWithSubmitButton';

Expand All @@ -16,6 +17,9 @@ const propTypes = {
/** Text to be displayed in the submit button */
submitButtonText: PropTypes.string.isRequired,

/** Controls the submit button's visibility */
isSubmitButtonVisible: PropTypes.bool,

/** Callback to validate the form */
validate: PropTypes.func.isRequired,

Expand All @@ -32,8 +36,8 @@ const propTypes = {
/** Controls the loading state of the form */
isLoading: PropTypes.bool,

/** Server side error message */
error: PropTypes.string,
/** Server side errors keyed by microtime */
errors: PropTypes.objectOf(PropTypes.string),
}),

/** Contains draft values for each input in the form */
Expand All @@ -44,9 +48,10 @@ const propTypes = {
};

const defaultProps = {
isSubmitButtonVisible: true,
formState: {
isLoading: false,
error: '',
errors: null,
},
draftValues: {},
};
Expand Down Expand Up @@ -75,6 +80,11 @@ class Form extends React.Component {
this.touchedInputs[inputID] = true;
}

getErrorMessage() {
const latestErrorMessage = ErrorUtils.getLatestErrorMessage(this.props.formState);
return this.props.formState.error || (typeof latestErrorMessage === 'string' ? latestErrorMessage : '');
}

submit() {
// Return early if the form is already submitting to avoid duplicate submission
if (this.props.formState.isLoading) {
Expand All @@ -100,7 +110,7 @@ class Form extends React.Component {
* @returns {Object} - An object containing the errors for each inputID, e.g. {inputID1: error1, inputID2: error2}
*/
validate(values) {
FormActions.setErrorMessage(this.props.formID, '');
FormActions.setErrors(this.props.formID, null);
const validationErrors = this.props.validate(values);

if (!_.isObject(validationErrors)) {
Expand Down Expand Up @@ -184,17 +194,19 @@ class Form extends React.Component {
>
<View style={[this.props.style]}>
{this.childrenWrapperWithProps(this.props.children)}
{this.props.isSubmitButtonVisible && (
<FormAlertWithSubmitButton
buttonText={this.props.submitButtonText}
isAlertVisible={_.size(this.state.errors) > 0 || Boolean(this.props.formState.error)}
isAlertVisible={_.size(this.state.errors) > 0 || Boolean(this.getErrorMessage())}
isLoading={this.props.formState.isLoading}
message={this.props.formState.error}
message={this.getErrorMessage()}
onSubmit={this.submit}
onFixTheErrorsLinkPressed={() => {
this.inputRefs[_.first(_.keys(this.state.errors))].focus();
}}
containerStyles={[styles.mh0, styles.mt5]}
/>
)}
</View>
</ScrollView>
</>
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ export default {
iouReportNotFound: 'The payment details you are looking for cannot be found.',
notHere: "Hmm... it's not here",
pageNotFound: 'That page is nowhere to be found.',
noAccess: 'You don\'t have access to this chat',
},
setPasswordPage: {
enterPassword: 'Enter a password',
Expand Down Expand Up @@ -822,6 +823,7 @@ export default {
error: {
genericAdd: 'There was a problem adding this workspace member.',
cannotRemove: 'You cannot remove yourself or the workspace owner.',
genericRemove: 'There was a problem removing that workspace member.',
},
},
card: {
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ export default {
iouReportNotFound: 'Los detalles del pago que estás buscando no se pudieron encontrar.',
notHere: 'Hmm… no está aquí',
pageNotFound: 'La página que buscas no existe.',
noAccess: 'No tienes acceso a este chat',
},
setPasswordPage: {
enterPassword: 'Escribe una contraseña',
Expand Down Expand Up @@ -824,6 +825,7 @@ export default {
error: {
genericAdd: 'Ha ocurrido un problema al agregar el miembro al espacio de trabajo',
cannotRemove: 'No puedes eliminarte ni a ti mismo ni al dueño del espacio de trabajo.',
genericRemove: 'Ha ocurrido un problema al eliminar al miembro del espacio de trabajo.',
},
},
card: {
Expand Down
39 changes: 27 additions & 12 deletions src/libs/ActiveClientManager/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/**
* When you have many tabs in one browser, the data of Onyx is shared between all of them. Since we persist write requests in Onyx, we need to ensure that
* only one tab is processing those saved requests or we would be duplicating data (or creating errors).
* This file ensures exactly that by tracking all the clientIDs connected, storing the most recent one last and it considers that last clientID the "leader".
*/

import _ from 'underscore';
import Onyx from 'react-native-onyx';
import Str from 'expensify-common/lib/str';
Expand All @@ -6,38 +12,47 @@ import * as ActiveClients from '../actions/ActiveClients';

const clientID = Str.guid();
const maxClients = 20;

let activeClients;

let resolveIsReadyPromise;
const isReadyPromise = new Promise((resolve) => {
resolveIsReadyPromise = resolve;
let activeClients = [];
let resolveSavedSelfPromise;
const savedSelfPromise = new Promise((resolve) => {
resolveSavedSelfPromise = resolve;
});

/**
* Determines when the client is ready. We need to wait both till we saved our ID in onyx AND the init method was called
* @returns {Promise}
*/
function isReady() {
return isReadyPromise;
return savedSelfPromise;
}

Onyx.connect({
key: ONYXKEYS.ACTIVE_CLIENTS,
callback: (val) => {
activeClients = !val ? [] : val;
if (activeClients.length >= maxClients) {
activeClients = val;

// Remove from the beginning of the list any clients that are past the limit, to avoid having thousands of them
let removed = false;
while (activeClients.length >= maxClients) {
activeClients.shift();
removed = true;
}

// Save the clients back to onyx, if they changed
if (removed) {
ActiveClients.setActiveClients(activeClients);
}
},
});

/**
* Add our client ID to the list of active IDs
* Add our client ID to the list of active IDs.
* We want to ensure we have no duplicates and that the activeClient gets added at the end of the array (see isClientTheLeader)
*/
function init() {
ActiveClients.addClient(clientID)
.then(resolveIsReadyPromise);
activeClients = _.without(activeClients, clientID);
activeClients.push(clientID);
ActiveClients.setActiveClients(activeClients).then(resolveSavedSelfPromise);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import KeyboardShortcut from '../../KeyboardShortcut';
import Navigation from '../Navigation';
import * as User from '../../actions/User';
import * as Modal from '../../actions/Modal';
import * as Policy from '../../actions/Policy';
import modalCardStyleInterpolator from './modalCardStyleInterpolator';
import createCustomModalStackNavigator from './createCustomModalStackNavigator';

Expand Down Expand Up @@ -100,7 +99,6 @@ class AuthScreens extends React.Component {
authEndpoint: `${CONFIG.EXPENSIFY.URL_API_ROOT}api?command=AuthenticatePusher`,
}).then(() => {
User.subscribeToUserEvents();
Policy.subscribeToPolicyEvents();
});

// Listen for report changes and fetch some data we need on initialization
Expand Down
6 changes: 6 additions & 0 deletions src/libs/Navigation/AppNavigator/BaseDrawerNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ class BaseDrawerNavigator extends Component {
};
}

componentDidMount() {
// We need to resolve the isDrawerReady promise so that any pending drawer actions, like direct navigation from OldDot to
// a NewDot report, can happen.
Navigation.setIsDrawerReady();
}

componentDidUpdate(prevProps) {
if (prevProps.isSmallScreenWidth === this.props.isSmallScreenWidth) {
return;
Expand Down
Loading

0 comments on commit f9491de

Please sign in to comment.