Skip to content

Commit

Permalink
Merge pull request #10747 from Expensify/update-staging-from-main
Browse files Browse the repository at this point in the history
Update version to 1.1.96-0 on staging
  • Loading branch information
OSBotify authored Sep 1, 2022
2 parents 3e889f0 + 171b502 commit bcc4a42
Show file tree
Hide file tree
Showing 32 changed files with 481 additions and 482 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001019504
versionName "1.1.95-4"
versionCode 1001019600
versionName "1.1.96-0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
6 changes: 5 additions & 1 deletion contributingGuides/OFFLINE_UX.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ This is the pattern where we queue the request to be sent when the user is onlin
- the user should be given instant feedback and
- the user does not need to know when the change is done on the server in the background

**How to implement:** Use [`API.write()`](https://github.com/Expensify/App/blob/3493f3ca3a1dc6cdbf9cb8bd342866fcaf45cf1d/src/libs/API.js#L7-L28) to implement this pattern. For this pattern we should only put `optimisticData` in the options. We don't need successData or failureData as we don't care what response comes back at all.
**How to implement:** Use [`API.write()`](https://github.com/Expensify/App/blob/3493f3ca3a1dc6cdbf9cb8bd342866fcaf45cf1d/src/libs/API.js#L7-L28) to implement this pattern. For this pattern we should only put `optimisticData` in the options. We don't need `successData` or `failureData` as we don't care what response comes back at all.

**Example:** Pinning a chat.

Expand All @@ -78,6 +78,10 @@ When the user is offline:
- Use API.write() to implement this pattern
- Optimistic data should include `pendingAction` ([with these possible values](https://github.com/Expensify/App/blob/15f7fa622805ee2971808d6bc67181c4715f0c62/src/CONST.js#L775-L779))
- To ensure the UI is shown as described above, you should enclose the components that contain the data that was added/updated/deleted with the OfflineWithFeedback component
- Include this data in the action call:
- `optimisticData` - always include this object when using the Pattern B
- `successData` - include this if the action is `update` or `delete`. You do not have to include this if the action is `add` (same data was already passed using the `optimisticData` object)
- `failureData` - always include this object. In case of `add` action, you will want to add some generic error which covers some unexpected failures which were not handled in the backend

**Handling errors:**
- The [OfflineWithFeedback component](https://github.com/Expensify/App/blob/main/src/components/OfflineWithFeedback.js) already handles showing errors too, as long as you pass the error field in the [errors prop](https://github.com/Expensify/App/blob/128ea378f2e1418140325c02f0b894ee60a8e53f/src/components/OfflineWithFeedback.js#L29-L31)
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.95</string>
<string>1.1.96</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.95.4</string>
<string>1.1.96.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.1.95</string>
<string>1.1.96</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.95.4</string>
<string>1.1.96.0</string>
</dict>
</plist>
34 changes: 17 additions & 17 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.1.95-4",
"version": "1.1.96-0",
"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 @@ -87,7 +87,7 @@
"react-native-collapsible": "^1.6.0",
"react-native-config": "^1.4.5",
"react-native-document-picker": "^8.0.0",
"react-native-gesture-handler": "2.5.0",
"react-native-gesture-handler": "2.6.0",
"react-native-google-places-autocomplete": "git+https://github.com/Expensify/react-native-google-places-autocomplete.git#3bbd17d63e6c38d38d857b50f6037c1c0376ff06",
"react-native-haptic-feedback": "^1.13.0",
"react-native-image-pan-zoom": "^2.1.12",
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": "^13.1.0",
"react-native-webview": "^11.17.2",
"react-pdf": "5.7.2",
"react-plaid-link": "3.3.2",
Expand Down
68 changes: 68 additions & 0 deletions src/components/DotIndicatorMessage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React from 'react';
import _ from 'underscore';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import styles from '../styles/styles';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import colors from '../styles/colors';
import variables from '../styles/variables';
import Text from './Text';

const propTypes = {
/**
* In most cases this should just be errors from onxyData
* if you are not passing that data then this needs to be in a similar shape like
* {
* timestamp: 'message',
* }
*/
messages: PropTypes.objectOf(PropTypes.string),

// The type of message, 'error' shows a red dot, 'success' shows a green dot
type: PropTypes.oneOf(['error', 'success']).isRequired,

// Additional styles to apply to the container */
// eslint-disable-next-line react/forbid-prop-types
style: PropTypes.arrayOf(PropTypes.object),
};

const defaultProps = {
messages: {},
style: [],
};

const DotIndicatorMessage = (props) => {
if (_.isEmpty(props.messages)) {
return null;
}

// To ensure messages are presented in order we are sort of destroying the data we are given
// and rebuilding as an array so we can render the messages in order. We don't really care about
// the microtime timestamps anyways so isn't the end of the world that we sort of lose them here.
// BEWARE: if you decide to refactor this and keep the microtime keys it could cause performance issues
const sortedMessages = _.chain(props.messages)
.keys()
.sortBy()
.map(key => props.messages[key])
.value();

return (
<View style={[styles.dotIndicatorMessage, ...props.style]}>
<View style={styles.offlineFeedback.errorDot}>
<Icon src={Expensicons.DotIndicator} fill={props.type === 'error' ? colors.red : colors.green} height={variables.iconSizeSmall} width={variables.iconSizeSmall} />
</View>
<View style={styles.offlineFeedback.textContainer}>
{_.map(sortedMessages, (message, i) => (
<Text key={i} style={styles.offlineFeedback.text}>{message}</Text>
))}
</View>
</View>
);
};

DotIndicatorMessage.propTypes = propTypes;
DotIndicatorMessage.defaultProps = defaultProps;

export default DotIndicatorMessage;

18 changes: 2 additions & 16 deletions src/components/OfflineWithFeedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import withLocalize, {withLocalizePropTypes} from './withLocalize';
import {withNetwork} from './OnyxProvider';
import networkPropTypes from './networkPropTypes';
import stylePropTypes from '../styles/stylePropTypes';
import Text from './Text';
import styles from '../styles/styles';
import Tooltip from './Tooltip';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import * as StyleUtils from '../styles/StyleUtils';
import colors from '../styles/colors';
import variables from '../styles/variables';
import DotIndicatorMessage from './DotIndicatorMessage';

/**
* This component should be used when we are using the offline pattern B (offline with feedback).
Expand Down Expand Up @@ -83,11 +81,6 @@ const OfflineWithFeedback = (props) => {
const needsStrikeThrough = props.network.isOffline && props.pendingAction === 'delete';
const hideChildren = !props.network.isOffline && props.pendingAction === 'delete' && !hasErrors;
let children = props.children;
const sortedErrors = _.chain(props.errors)
.keys()
.sortBy()
.map(key => props.errors[key])
.value();

// Apply strikethrough to children if needed, but skip it if we are not going to render them
if (needsStrikeThrough && !hideChildren) {
Expand All @@ -102,14 +95,7 @@ const OfflineWithFeedback = (props) => {
)}
{hasErrors && (
<View style={StyleUtils.combineStyles(styles.offlineFeedback.error, props.errorRowStyles)}>
<View style={styles.offlineFeedback.errorDot}>
<Icon src={Expensicons.DotIndicator} fill={colors.red} height={variables.iconSizeSmall} width={variables.iconSizeSmall} />
</View>
<View style={styles.offlineFeedback.textContainer}>
{_.map(sortedErrors, (error, i) => (
<Text key={i} style={styles.offlineFeedback.text}>{error}</Text>
))}
</View>
<DotIndicatorMessage messages={props.errors} type="error" />
<Tooltip text={props.translate('common.close')}>
<Pressable
onPress={props.onClose}
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default {
beginningOfChatHistoryPolicyExpenseChatPartTwo: ' and ',
beginningOfChatHistoryPolicyExpenseChatPartThree: ' starts here! 🎉 This is the place to chat, request money and settle up.',
},
newMessageCount: ({count}) => `${count} new message${count > 1 ? 's' : ''}`,
newMessages: 'New messages',
reportTypingIndicator: {
isTyping: 'is typing...',
areTyping: 'are typing...',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export default {
beginningOfChatHistoryPolicyExpenseChatPartTwo: ' y ',
beginningOfChatHistoryPolicyExpenseChatPartThree: ' empieza aquí! :tada: Este es el lugar donde chatear, pedir dinero y pagar.',
},
newMessageCount: ({count}) => `${count} mensaje${count > 1 ? 's' : ''} nuevo${count > 1 ? 's' : ''}`,
newMessages: 'Mensajes nuevos',
reportTypingIndicator: {
isTyping: 'está escribiendo...',
areTyping: 'están escribiendo...',
Expand Down
17 changes: 17 additions & 0 deletions src/libs/ErrorUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'underscore';
import CONST from '../CONST';

/**
Expand Down Expand Up @@ -35,7 +36,23 @@ function getAuthenticateErrorMessage(response) {
}
}

/**
* @param {Object} onyxData
* @param {Object} onyxData.errors
* @returns {String}
*/
function getLatestErrorMessage(onyxData) {
return _.chain(onyxData.errors || [])
.keys()
.sortBy()
.reverse()
.map(key => onyxData.errors[key])
.first()
.value();
}

export {
// eslint-disable-next-line import/prefer-default-export
getAuthenticateErrorMessage,
getLatestErrorMessage,
};
2 changes: 0 additions & 2 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as StyleUtils from '../../../styles/StyleUtils';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import CONST from '../../../CONST';
import compose from '../../compose';
import * as Report from '../../actions/Report';
import * as PersonalDetails from '../../actions/PersonalDetails';
import * as Pusher from '../../Pusher/pusher';
import PusherConnectionManager from '../../PusherConnectionManager';
Expand Down Expand Up @@ -110,7 +109,6 @@ class AuthScreens extends React.Component {
cluster: CONFIG.PUSHER.CLUSTER,
authEndpoint: `${CONFIG.EXPENSIFY.URL_API_ROOT}api?command=AuthenticatePusher`,
}).then(() => {
Report.subscribeToUserEvents();
User.subscribeToUserEvents();
Policy.subscribeToPolicyEvents();
});
Expand Down
1 change: 0 additions & 1 deletion src/libs/NumberUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import CONST from '../CONST';
* Generates a random positive 64 bit numeric string by randomly generating the left, middle, and right parts and concatenating them. Used to generate client-side ids.
* @returns {String} string representation of a randomly generated 64 bit signed integer
*/
/* eslint-disable no-unused-vars */
function rand64() {
// Max 64-bit signed:
// 9,223,372,036,854,775,807
Expand Down
Loading

0 comments on commit bcc4a42

Please sign in to comment.