Skip to content

Commit d5a90b8

Browse files
committed
Pull latest changes
2 parents fe9fac5 + 96f2300 commit d5a90b8

36 files changed

+161
-151
lines changed

android/app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ android {
150150
minSdkVersion rootProject.ext.minSdkVersion
151151
targetSdkVersion rootProject.ext.targetSdkVersion
152152
multiDexEnabled rootProject.ext.multiDexEnabled
153-
versionCode 1001010803
154-
versionName "1.1.8-3"
153+
versionCode 1001010804
154+
versionName "1.1.8-4"
155155
}
156156
splits {
157157
abi {

ios/NewExpensify/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</dict>
3232
</array>
3333
<key>CFBundleVersion</key>
34-
<string>1.1.8.3</string>
34+
<string>1.1.8.4</string>
3535
<key>ITSAppUsesNonExemptEncryption</key>
3636
<false/>
3737
<key>LSApplicationQueriesSchemes</key>

ios/NewExpensifyTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>1.1.8.3</string>
22+
<string>1.1.8.4</string>
2323
</dict>
2424
</plist>

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "new.expensify",
3-
"version": "1.1.8-3",
3+
"version": "1.1.8-4",
44
"author": "Expensify, Inc.",
55
"homepage": "https://new.expensify.com",
66
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",

src/components/AddPlaidBankAccount.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
import PropTypes from 'prop-types';
88
import lodashGet from 'lodash/get';
99
import {withOnyx} from 'react-native-onyx';
10+
import Log from '../libs/Log';
1011
import PlaidLink from './PlaidLink';
1112
import {
1213
clearPlaidBankAccountsAndToken,
@@ -163,12 +164,12 @@ class AddPlaidBankAccount extends React.Component {
163164
<PlaidLink
164165
token={this.props.plaidLinkToken}
165166
onSuccess={({publicToken, metadata}) => {
166-
console.debug('[PlaidLink] Success: ', {publicToken, metadata});
167+
Log.info('[PlaidLink] Success!');
167168
getPlaidBankAccounts(publicToken, metadata.institution.name);
168169
this.setState({institution: metadata.institution});
169170
}}
170171
onError={(error) => {
171-
console.debug(`Plaid Error: ${error.message}`);
172+
Log.hmmm('[PlaidLink] Error: ', error.message);
172173
}}
173174

174175
// User prematurely exited the Plaid flow

src/components/ImageWithSizeCalculation.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {PureComponent} from 'react';
22
import {Image} from 'react-native';
33
import PropTypes from 'prop-types';
4+
import Log from '../libs/Log';
45
import styles from '../styles/styles';
56

67
const propTypes = {
@@ -63,7 +64,7 @@ class ImageWithSizeCalculation extends PureComponent {
6364

6465
this.props.onMeasure({width, height});
6566
}, (error) => {
66-
console.debug('Unable to fetch image to calculate size', {error});
67+
Log.hmmm('Unable to fetch image to calculate size', {error, url: this.props.url});
6768
});
6869
}
6970

src/components/OptionsList.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import _ from 'underscore';
22
import React, {forwardRef, Component} from 'react';
33
import {Keyboard, View} from 'react-native';
44
import PropTypes from 'prop-types';
5+
import Log from '../libs/Log';
56
import styles from '../styles/styles';
67
import OptionRow from '../pages/home/sidebar/OptionRow';
78
import optionPropTypes from './optionPropTypes';
@@ -154,7 +155,7 @@ class OptionsList extends Component {
154155
* @param {Object} info
155156
*/
156157
onScrollToIndexFailed(info) {
157-
console.debug(info);
158+
Log.hmmm('[OptionsList] scrollToIndex failed', info);
158159
}
159160

160161
/**

src/components/PlaidLink/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {useCallback, useEffect} from 'react';
22
import {usePlaidLink} from 'react-plaid-link';
33
import {plaidLinkPropTypes, plaidLinkDefaultProps} from './plaidLinkPropTypes';
4+
import Log from '../../libs/Log';
45

56
const PlaidLink = (props) => {
67
const onSuccess = useCallback((publicToken, metadata) => {
@@ -11,11 +12,11 @@ const PlaidLink = (props) => {
1112
token: props.token,
1213
onSuccess,
1314
onExit: (exitError, metadata) => {
14-
console.debug('[PlaidLink] Exit: ', {exitError, metadata});
15+
Log.info('[PlaidLink] Exit: ', false, {exitError, metadata});
1516
props.onExit();
1617
},
1718
onEvent: (event, metadata) => {
18-
console.debug('[PlaidLink] Event: ', {event, metadata});
19+
Log.info('[PlaidLink] Event: ', false, {event, metadata});
1920
},
2021
});
2122

src/components/PlaidLink/index.native.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import {NativeEventEmitter} from 'react-native';
33
import {openLink} from 'react-native-plaid-link-sdk';
4+
import Log from '../../libs/Log';
45
import CONST from '../../CONST';
56
import nativeModule from './nativeModule';
67
import {plaidLinkPropTypes, plaidLinkDefaultProps} from './plaidLinkPropTypes';
@@ -35,7 +36,7 @@ class PlaidLink extends React.Component {
3536
* @param {*} event
3637
*/
3738
onEvent(event) {
38-
console.debug('[PlaidLink] Handled Plaid Event: ', event);
39+
Log.info('[PlaidLink] Handled Plaid Event: ', false, event);
3940
if (event.eventName === CONST.PLAID.EVENT.ERROR) {
4041
this.props.onError(event.metadata);
4142
} else if (event.eventName === CONST.PLAID.EVENT.EXIT) {

src/libs/API.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import redirectToSignIn from './actions/SignInRedirect';
77
import * as Network from './Network';
88
import isViaExpensifyCashNative from './isViaExpensifyCashNative';
99

10+
// eslint-disable-next-line import/no-cycle
11+
import LogUtil from './Log';
12+
1013
let isAuthenticating;
1114
let credentials;
1215
Onyx.connect({
@@ -57,7 +60,7 @@ function addDefaultValuesToParameters(command, parameters) {
5760
if (!authToken) {
5861
redirectToSignIn();
5962

60-
console.debug('A request was made without an authToken', {command, parameters});
63+
LogUtil.info('A request was made without an authToken', false, {command, parameters});
6164
Network.pauseRequestQueue();
6265
Network.clearRequestQueue();
6366
Network.unpauseRequestQueue();
@@ -172,7 +175,11 @@ Network.registerResponseHandler((queuedRequest, response) => {
172175
});
173176

174177
Network.registerErrorHandler((queuedRequest, error) => {
175-
console.debug('[API] Handled error when making request', error);
178+
if (queuedRequest.command !== 'Log') {
179+
LogUtil.hmmm('[API] Handled error when making request', error);
180+
} else {
181+
console.debug('[API] There was an error in the Log API command, unable to log to server!', error);
182+
}
176183

177184
// Set an error state and signify we are done loading
178185
Onyx.merge(ONYXKEYS.SESSION, {loading: false, error: 'Cannot connect to server'});
@@ -304,7 +311,7 @@ function reauthenticate(command = '') {
304311
// If we experience something other than a network error then redirect the user to sign in
305312
redirectToSignIn(error.message);
306313

307-
console.debug('Redirecting to Sign In because we failed to reauthenticate', {
314+
LogUtil.hmmm('Redirecting to Sign In because we failed to reauthenticate', {
308315
command,
309316
error: error.message,
310317
});

src/libs/Log.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Logger from 'expensify-common/lib/Logger';
2-
import * as API from './API';
32
import CONFIG from '../CONFIG';
43
import getPlatform from './getPlatform';
54
import {version} from '../../package.json';
65
import NetworkConnection from './NetworkConnection';
76
import HttpUtils from './HttpUtils';
87

8+
// eslint-disable-next-line import/no-cycle
9+
import * as API from './API';
10+
911
let timeout = null;
1012

1113
/**

src/libs/Navigation/CustomActions.js

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,42 @@
11
import {CommonActions, StackActions, DrawerActions} from '@react-navigation/native';
22
import lodashGet from 'lodash/get';
33

4+
/**
5+
* Go back to the Main Drawer
6+
* @param {Object} navigationRef
7+
*/
8+
function navigateBackToRootDrawer(navigationRef) {
9+
let isLeavingNestedDrawerNavigator = false;
10+
11+
// This should take us to the first view of the modal's stack navigator
12+
navigationRef.current.dispatch((state) => {
13+
// If this is a nested drawer navigator then we pop the screen and
14+
// prevent calling goBack() as it's default behavior is to toggle open the active drawer
15+
if (state.type === 'drawer') {
16+
isLeavingNestedDrawerNavigator = true;
17+
return StackActions.pop();
18+
}
19+
20+
// If there are multiple routes then we can pop back to the first route
21+
if (state.routes.length > 1) {
22+
return StackActions.popToTop();
23+
}
24+
25+
// Otherwise, we are already on the last page of a modal so just do nothing here as goBack() will navigate us
26+
// back to the screen we were on before we opened the modal.
27+
return StackActions.pop(0);
28+
});
29+
30+
if (isLeavingNestedDrawerNavigator) {
31+
return;
32+
}
33+
34+
// Navigate back to where we were before we launched the modal
35+
if (navigationRef.current.canGoBack()) {
36+
navigationRef.current.goBack();
37+
}
38+
}
39+
440
/**
541
* In order to create the desired browser navigation behavior on web and mobile web we need to replace any
642
* type: 'drawer' routes with a type: 'route' so that when pushing to a report screen we never show the
@@ -24,7 +60,7 @@ function pushDrawerRoute(screenName, params, navigationRef) {
2460

2561
if (activeReportID === params.reportID) {
2662
if (state.type !== 'drawer') {
27-
navigationRef.current.dispatch(StackActions.pop());
63+
navigateBackToRootDrawer(navigationRef);
2864
}
2965
return DrawerActions.closeDrawer();
3066
}
@@ -52,4 +88,5 @@ function pushDrawerRoute(screenName, params, navigationRef) {
5288

5389
export default {
5490
pushDrawerRoute,
91+
navigateBackToDrawer: navigateBackToRootDrawer,
5592
};

src/libs/Navigation/Navigation.js

+10-38
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@react-navigation/native';
99
import PropTypes from 'prop-types';
1010
import Onyx from 'react-native-onyx';
11+
import Log from '../Log';
1112
import linkTo from './linkTo';
1213
import ROUTES from '../../ROUTES';
1314
import SCREENS from '../../SCREENS';
@@ -39,7 +40,7 @@ function setDidTapNotification() {
3940
*/
4041
function openDrawer() {
4142
if (!navigationRef.isReady()) {
42-
console.debug('[Navigation] openDrawer failed because navigation ref was not yet ready');
43+
Log.hmmm('[Navigation] openDrawer failed because navigation ref was not yet ready');
4344
return;
4445
}
4546
navigationRef.current.dispatch(DrawerActions.openDrawer());
@@ -51,7 +52,7 @@ function openDrawer() {
5152
*/
5253
function closeDrawer() {
5354
if (!navigationRef.isReady()) {
54-
console.debug('[Navigation] closeDrawer failed because navigation ref was not yet ready');
55+
Log.hmmm('[Navigation] closeDrawer failed because navigation ref was not yet ready');
5556
return;
5657
}
5758
navigationRef.current.dispatch(DrawerActions.closeDrawer());
@@ -74,12 +75,12 @@ function getDefaultDrawerState(isSmallScreenWidth) {
7475
*/
7576
function goBack(shouldOpenDrawer = true) {
7677
if (!navigationRef.isReady()) {
77-
console.debug('[Navigation] goBack failed because navigation ref was not yet ready');
78+
Log.hmmm('[Navigation] goBack failed because navigation ref was not yet ready');
7879
return;
7980
}
8081

8182
if (!navigationRef.current.canGoBack()) {
82-
console.debug('Unable to go back');
83+
Log.hmmm('[Navigation] Unable to go back');
8384
if (shouldOpenDrawer) {
8485
openDrawer();
8586
}
@@ -95,7 +96,7 @@ function goBack(shouldOpenDrawer = true) {
9596
*/
9697
function navigate(route = ROUTES.HOME) {
9798
if (!navigationRef.isReady()) {
98-
console.debug('[Navigation] navigate failed because navigation ref was not yet ready');
99+
Log.hmmm('[Navigation] navigate failed because navigation ref was not yet ready', {route});
99100
return;
100101
}
101102

@@ -129,47 +130,18 @@ function navigate(route = ROUTES.HOME) {
129130
*/
130131
function dismissModal(shouldOpenDrawer = false) {
131132
if (!navigationRef.isReady()) {
132-
console.debug('[Navigation] dismissModal failed because navigation ref was not yet ready');
133+
Log.hmmm('[Navigation] dismissModal failed because navigation ref was not yet ready');
133134
return;
134135
}
135136

136137
const normalizedShouldOpenDrawer = _.isBoolean(shouldOpenDrawer)
137138
? shouldOpenDrawer
138139
: false;
139140

140-
let isLeavingDrawerNavigator;
141-
142-
// This should take us to the first view of the modal's stack navigator
143-
navigationRef.current.dispatch((state) => {
144-
// If this is a nested drawer navigator then we pop the screen and
145-
// prevent calling goBack() as it's default behavior is to toggle open the active drawer
146-
if (state.type === 'drawer') {
147-
isLeavingDrawerNavigator = true;
148-
return StackActions.pop();
149-
}
150-
151-
// If there are multiple routes then we can pop back to the first route
152-
if (state.routes.length > 1) {
153-
return StackActions.popToTop();
154-
}
155-
156-
// Otherwise, we are already on the last page of a modal so just do nothing here as goBack() will navigate us
157-
// back to the screen we were on before we opened the modal.
158-
return StackActions.pop(0);
159-
});
160-
161-
if (isLeavingDrawerNavigator) {
162-
return;
163-
}
164-
165-
// Navigate back to where we were before we launched the modal
166-
goBack(shouldOpenDrawer);
167-
168-
if (!normalizedShouldOpenDrawer) {
169-
return;
141+
CustomActions.navigateBackToDrawer(navigationRef);
142+
if (normalizedShouldOpenDrawer) {
143+
openDrawer();
170144
}
171-
172-
openDrawer();
173145
}
174146

175147
/**

0 commit comments

Comments
 (0)