Skip to content

Commit

Permalink
Merge branch 'main' into fix-20699
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed Jun 19, 2023
2 parents 1771ef6 + b49ca20 commit 4ec4af6
Show file tree
Hide file tree
Showing 46 changed files with 719 additions and 667 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001032900
versionName "1.3.29-0"
versionCode 1001032905
versionName "1.3.29-5"
}

splits {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.29.0</string>
<string>1.3.29.5</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.3.29.0</string>
<string>1.3.29.5</string>
</dict>
</plist>
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": "1.3.29-0",
"version": "1.3.29-5",
"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
85 changes: 0 additions & 85 deletions patches/@react-navigation+stack+6.3.16.patch

This file was deleted.

29 changes: 21 additions & 8 deletions src/components/AttachmentCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ class AttachmentCarousel extends React.Component {
_.forEach(actions, (action) => htmlParser.write(_.get(action, ['message', 0, 'html'])));
htmlParser.end();

// Inverting the list for touchscreen devices that can swipe or have an animation when scrolling
// promotes the natural feeling of swiping left/right to go to the next/previous image
// We don't want to invert the list for desktop/web because this interferes with mouse
// wheel or trackpad scrolling (in cases like document preview where you can scroll vertically)
if (this.canUseTouchScreen) {
attachments.reverse();
}

const page = _.findIndex(attachments, (a) => a.source === this.props.source);
if (page === -1) {
throw new Error('Attachment not found');
Expand All @@ -195,7 +203,12 @@ class AttachmentCarousel extends React.Component {
* @param {Number} deltaSlide
*/
cycleThroughAttachments(deltaSlide) {
const nextIndex = this.state.page - deltaSlide;
let delta = deltaSlide;
if (this.canUseTouchScreen) {
delta = deltaSlide * -1;
}

const nextIndex = this.state.page - delta;
const nextItem = this.state.attachments[nextIndex];

if (!nextItem || !this.scrollRef.current) {
Expand Down Expand Up @@ -262,8 +275,13 @@ class AttachmentCarousel extends React.Component {
}

render() {
const isForwardDisabled = this.state.page === 0;
const isBackDisabled = this.state.page === _.size(this.state.attachments) - 1;
let isForwardDisabled = this.state.page === 0;
let isBackDisabled = this.state.page === _.size(this.state.attachments) - 1;

if (this.canUseTouchScreen) {
isForwardDisabled = isBackDisabled;
isBackDisabled = this.state.page === 0;
}

return (
<View
Expand Down Expand Up @@ -319,11 +337,6 @@ class AttachmentCarousel extends React.Component {
<FlatList
listKey="AttachmentCarousel"
horizontal
// Inverting the list for touchscreen devices that can swipe or have an animation when scrolling
// promotes the natural feeling of swiping left/right to go to the next/previous image
// We don't want to invert the list for desktop/web because this interferes with mouse
// wheel or trackpad scrolling (in cases like document preview where you can scroll vertically)
inverted={this.canUseTouchScreen}
decelerationRate="fast"
showsHorizontalScrollIndicator={false}
bounces={false}
Expand Down
5 changes: 2 additions & 3 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import MenuItemWithTopDescription from './MenuItemWithTopDescription';
import Navigation from '../libs/Navigation/Navigation';
import optionPropTypes from './optionPropTypes';
import * as CurrencyUtils from '../libs/CurrencyUtils';
import * as ReportUtils from '../libs/ReportUtils';

const propTypes = {
/** Callback to inform parent modal of success */
Expand Down Expand Up @@ -234,10 +233,10 @@ function MoneyRequestConfirmationList(props) {
* @param {Object} option
*/
const navigateToUserDetail = (option) => {
if (!option.login) {
if (!option.accountID) {
return;
}
Navigation.navigate(ROUTES.getProfileRoute(ReportUtils.getAccountIDForLogin(option.login)));
Navigation.navigate(ROUTES.getProfileRoute(option.accountID));
};

/**
Expand Down
8 changes: 4 additions & 4 deletions src/components/MultipleAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function MultipleAvatars(props) {
if (props.icons.length === 1 && !props.shouldStackHorizontally) {
return (
<UserDetailsTooltip
accountID={ReportUtils.getAccountIDForLogin(props.icons[0].name)}
accountID={props.icons[0].id}
fallbackUserDetails={{
displayName: ReportUtils.getDisplayNameForParticipant(props.icons[0].name),
login: lodashGet(props.icons[0], 'name', tooltipTexts[0]),
Expand Down Expand Up @@ -124,7 +124,7 @@ function MultipleAvatars(props) {
{_.map([...props.icons].splice(0, 4), (icon, index) => (
<UserDetailsTooltip
key={`stackedAvatars-${index}`}
accountID={ReportUtils.getAccountIDForLogin(icon.name)}
accountID={icon.id}
>
<View
style={[
Expand Down Expand Up @@ -183,7 +183,7 @@ function MultipleAvatars(props) {
</>
) : (
<View style={singleAvatarStyles}>
<UserDetailsTooltip accountID={ReportUtils.getAccountIDForLogin(props.icons[0].name)}>
<UserDetailsTooltip accountID={props.icons[0].id}>
{/* View is necessary for tooltip to show for multiple avatars in LHN */}
<View>
<Avatar
Expand All @@ -198,7 +198,7 @@ function MultipleAvatars(props) {
</UserDetailsTooltip>
<View style={secondAvatarStyles}>
{props.icons.length === 2 ? (
<UserDetailsTooltip accountID={ReportUtils.getAccountIDForLogin(props.icons[1].name)}>
<UserDetailsTooltip accountID={props.icons[1].id}>
<View>
<Avatar
source={props.icons[1].source || props.fallbackIcon}
Expand Down
2 changes: 1 addition & 1 deletion src/components/PopoverMenu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ const defaultProps = {
function PopoverMenu(props) {
const {isSmallScreenWidth} = useWindowDimensions();
const [selectedItemIndex, setSelectedItemIndex] = useState(null);
const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({initialFocusedIndex: -1, maxIndex: props.menuItems.length - 1, isActive: props.isVisible});

const selectItem = (index) => {
const selectedItem = props.menuItems[index];
props.onItemSelected(selectedItem);
setSelectedItemIndex(index);
};

const [focusedIndex, setFocusedIndex] = useArrowKeyFocusManager({initialFocusedIndex: -1, maxIndex: props.menuItems.length - 1});
useKeyboardShortcut(
CONST.KEYBOARD_SHORTCUTS.ENTER,
() => {
Expand Down
33 changes: 28 additions & 5 deletions src/components/TaskHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, {useEffect} from 'react';
import {View} from 'react-native';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
import reportPropTypes from '../pages/reportPropTypes';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import * as ReportUtils from '../libs/ReportUtils';
Expand All @@ -22,6 +23,7 @@ import Button from './Button';
import * as TaskUtils from '../libs/actions/Task';
import * as UserUtils from '../libs/UserUtils';
import PressableWithFeedback from './Pressable/PressableWithFeedback';
import ONYXKEYS from '../ONYXKEYS';

const propTypes = {
/** The report currently being looked at */
Expand All @@ -30,13 +32,25 @@ const propTypes = {
/** Personal details so we can get the ones for the report participants */
personalDetails: PropTypes.objectOf(participantPropTypes).isRequired,

/** Current user session */
session: PropTypes.shape({
accountID: PropTypes.number,
}),

...withLocalizePropTypes,
};

const defaultProps = {
session: {
accountID: 0,
},
};

function TaskHeader(props) {
const title = ReportUtils.getReportName(props.report);
const assigneeName = ReportUtils.getDisplayNameForParticipant(props.report.managerID);
const assigneeAvatar = UserUtils.getAvatar(lodashGet(props.personalDetails, [props.report.managerID, 'avatar']), props.report.managerID);
const assigneeAccountID = TaskUtils.getTaskAssigneeAccountID(props.report);
const assigneeName = ReportUtils.getDisplayNameForParticipant(assigneeAccountID);
const assigneeAvatar = UserUtils.getAvatar(lodashGet(props.personalDetails, [assigneeAccountID, 'avatar']), assigneeAccountID);
const isOpen = props.report.stateNum === CONST.REPORT.STATE_NUM.OPEN && props.report.statusNum === CONST.REPORT.STATUS.OPEN;
const isCompleted = ReportUtils.isTaskCompleted(props.report);

Expand All @@ -59,7 +73,7 @@ function TaskHeader(props) {
>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween, styles.pv3]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentBetween]}>
{props.report.managerID && props.report.managerID > 0 && (
{assigneeAccountID && assigneeAccountID > 0 && (
<>
<Avatar
source={assigneeAvatar}
Expand Down Expand Up @@ -92,7 +106,7 @@ function TaskHeader(props) {
) : (
<Button
success
isDisabled={TaskUtils.isTaskCanceled(props.report)}
isDisabled={TaskUtils.isTaskCanceled(props.report) || !TaskUtils.isTaskAssigneeOrTaskOwner(props.report, props.session.accountID)}
medium
text={props.translate('newTaskPage.markAsDone')}
onPress={() => TaskUtils.completeTask(props.report.reportID, title)}
Expand Down Expand Up @@ -123,6 +137,15 @@ function TaskHeader(props) {
}

TaskHeader.propTypes = propTypes;
TaskHeader.defaultProps = defaultProps;
TaskHeader.displayName = 'TaskHeader';

export default compose(withWindowDimensions, withLocalize)(TaskHeader);
export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
session: {
key: ONYXKEYS.SESSION,
},
}),
)(TaskHeader);
Loading

0 comments on commit 4ec4af6

Please sign in to comment.