Skip to content

Commit

Permalink
Merge branch 'main' into fix/20759-remove-new-notifiers-when-deleting…
Browse files Browse the repository at this point in the history
…-last-message
  • Loading branch information
DanutGavrus committed Jun 28, 2023
2 parents a6e9ca6 + ecfcd83 commit 607451d
Show file tree
Hide file tree
Showing 25 changed files with 178 additions and 160 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 1001033304
versionName "1.3.33-4"
versionCode 1001033401
versionName "1.3.34-1"
}

splits {
Expand Down
2 changes: 1 addition & 1 deletion contributingGuides/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Additionally if you want to discuss an idea with the open source community witho
3. If you cannot reproduce the problem, pause on this step and add a comment to the issue explaining where you are stuck or that you don't think the issue can be reproduced.

#### Propose a solution for the job
4. You can propose solutions on any issue at at any time, but if you propose solutions to jobs before the `Help Wanted` label is applied, you do so at your own risk. Proposals will not be reviewed until the label is added and there is always a chance that we might not add the label or hire an external contributor for the job.
4. You can propose solutions on any issue at any time, but if you propose solutions to jobs before the `Help Wanted` label is applied, you do so at your own risk. Proposals will not be reviewed until the label is added and there is always a chance that we might not add the label or hire an external contributor for the job.
5. After you reproduce the issue, complete the [proposal template here](./PROPOSAL_TEMPLATE.md) and post it as a comment in the corresponding GitHub issue (linked in the Upwork job).
- Note: Before submitting a proposal on an issue, be sure to read any other existing proposals. ALL NEW PROPOSALS MUST BE DIFFERENT FROM EXISTING PROPOSALS. The *difference* should be important, meaningful or considerable.
6. Refrain from leaving additional comments until someone from the Contributor-Plus team and / or someone from Expensify provides feedback on your proposal (do not create a pull request yet).
Expand Down
2 changes: 1 addition & 1 deletion desktop/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ const localizeMenuItems = (browserWindow, systemMenu) => {
const keyboardShortcutsMenuItem = new MenuItem({
id: `keyboardShortcutsMenuItem-${preferredLocale}`,
label: Localize.translate(preferredLocale, 'initialSettingsPage.aboutPage.viewKeyboardShortcuts'),
accelerator: 'CmdOrCtrl+I',
accelerator: 'CmdOrCtrl+J',
click: () => {
showKeyboardShortcutsModal(browserWindow);
},
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.33</string>
<string>1.3.34</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.33.4</string>
<string>1.3.34.1</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.3.33</string>
<string>1.3.34</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.33.4</string>
<string>1.3.34.1</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.33-4",
"version": "1.3.34-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
4 changes: 2 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import SafeArea from './components/SafeArea';
import * as Environment from './libs/Environment/Environment';
import {WindowDimensionsProvider} from './components/withWindowDimensions';
import {KeyboardStateProvider} from './components/withKeyboardState';
import {CurrentReportIdContextProvider} from './components/withCurrentReportId';
import {CurrentReportIDContextProvider} from './components/withCurrentReportID';

// For easier debugging and development, when we are in web we expose Onyx to the window, so you can more easily set data into Onyx
if (window && Environment.isDevelopment()) {
Expand Down Expand Up @@ -46,7 +46,7 @@ function App() {
HTMLEngineProvider,
WindowDimensionsProvider,
KeyboardStateProvider,
CurrentReportIdContextProvider,
CurrentReportIDContextProvider,
PickerStateProvider,
]}
>
Expand Down
7 changes: 7 additions & 0 deletions src/components/DeeplinkWrapper/index.website.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as Browser from '../../libs/Browser';
import ONYXKEYS from '../../ONYXKEYS';
import * as Authentication from '../../libs/Authentication';
import DeeplinkRedirectLoadingIndicator from './DeeplinkRedirectLoadingIndicator';
import * as Session from '../../libs/actions/Session';

const propTypes = {
/** Children to render. */
Expand Down Expand Up @@ -61,6 +62,12 @@ class DeeplinkWrapper extends PureComponent {
this.openRouteInDesktopApp(expensifyDeeplinkUrl);
return;
}

// There's no support for anonymous users on desktop
if (Session.isAnonymousUser()) {
return;
}

Authentication.getShortLivedAuthToken()
.then((shortLivedAuthToken) => {
params.set('email', this.props.session.email);
Expand Down
6 changes: 4 additions & 2 deletions src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,10 @@ function Form(props) {
const focusKey = _.find(_.keys(inputRefs.current), (key) => _.keys(errorFields).includes(key));
const focusInput = inputRefs.current[focusKey];

// Start with dismissing the keyboard, so when we focus a non-text input, the keyboard is hidden
Keyboard.dismiss();
// Dismiss the keyboard for non-text fields by checking if the component has the isFocused method, as only TextInput has this method.
if (typeof focusInput.isFocused !== 'function') {
Keyboard.dismiss();
}

// We subtract 10 to scroll slightly above the input
if (focusInput.measureLayout && typeof focusInput.measureLayout === 'function') {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ function MenuItem(props) {
</Text>
)}
{Boolean(props.furtherDetails) && (
<View style={[styles.flexRow, styles.mt2, styles.alignItemsCenter]}>
<View style={[styles.flexRow, styles.mt1, styles.alignItemsCenter]}>
<Icon
src={props.furtherDetailsIcon}
height={variables.iconSizeNormal}
Expand Down
76 changes: 76 additions & 0 deletions src/components/withCurrentReportID.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React, {createContext, forwardRef, useCallback, useState, useMemo} from 'react';
import PropTypes from 'prop-types';

import getComponentDisplayName from '../libs/getComponentDisplayName';
import Navigation from '../libs/Navigation/Navigation';

const CurrentReportIDContext = createContext(null);

const withCurrentReportIDPropTypes = {
/** Function to update the state */
updateCurrentReportID: PropTypes.func.isRequired,

/** The top most report id */
currentReportID: PropTypes.string,
};

const withCurrentReportIDDefaultProps = {
currentReportID: '',
};

function CurrentReportIDContextProvider(props) {
const [currentReportID, setCurrentReportID] = useState('');

/**
* This function is used to update the currentReportID
* @param {Object} state root navigation state
*/
const updateCurrentReportID = useCallback(
(state) => {
setCurrentReportID(Navigation.getTopmostReportId(state));
},
[setCurrentReportID],
);

/**
* The context this component exposes to child components
* @returns {Object} currentReportID to share between central pane and LHN
*/
const contextValue = useMemo(
() => ({
updateCurrentReportID,
currentReportID,
}),
[updateCurrentReportID, currentReportID],
);

return <CurrentReportIDContext.Provider value={contextValue}>{props.children}</CurrentReportIDContext.Provider>;
}

CurrentReportIDContextProvider.displayName = 'CurrentReportIDContextProvider';
CurrentReportIDContextProvider.propTypes = {
/** Actual content wrapped by this component */
children: PropTypes.node.isRequired,
};

export default function withCurrentReportID(WrappedComponent) {
const WithCurrentReportID = forwardRef((props, ref) => (
<CurrentReportIDContext.Consumer>
{(currentReportIDUtils) => (
<WrappedComponent
// eslint-disable-next-line react/jsx-props-no-spreading
{...currentReportIDUtils}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
ref={ref}
/>
)}
</CurrentReportIDContext.Consumer>
));

WithCurrentReportID.displayName = `withCurrentReportID(${getComponentDisplayName(WrappedComponent)})`;

return WithCurrentReportID;
}

export {withCurrentReportIDPropTypes, withCurrentReportIDDefaultProps, CurrentReportIDContextProvider};
72 changes: 0 additions & 72 deletions src/components/withCurrentReportId.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/libs/EmojiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,10 @@ const getEmojiCodeWithSkinColor = (item, preferredSkinToneIndex) => {
* If we're on mobile, we also add a space after the emoji granted there's no text after it.
*
* @param {String} text
* @param {Boolean} isSmallScreenWidth
* @param {Number} preferredSkinTone
* @returns {Object}
*/
function replaceEmojis(text, isSmallScreenWidth = false, preferredSkinTone = CONST.EMOJI_DEFAULT_SKIN_TONE) {
function replaceEmojis(text, preferredSkinTone = CONST.EMOJI_DEFAULT_SKIN_TONE) {
let newText = text;
const emojis = [];
const emojiData = text.match(CONST.REGEX.EMOJI_NAME);
Expand All @@ -244,9 +243,10 @@ function replaceEmojis(text, isSmallScreenWidth = false, preferredSkinTone = CON

// If this is the last emoji in the message and it's the end of the message so far,
// add a space after it so the user can keep typing easily.
if (isSmallScreenWidth && i === emojiData.length - 1 && text.endsWith(emojiData[i])) {
if (i === emojiData.length - 1) {
emojiReplacement += ' ';
}

newText = newText.replace(emojiData[i], emojiReplacement);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/libs/Navigation/NavigationRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AppNavigator from './AppNavigator';
import themeColors from '../../styles/themes/default';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions';
import Log from '../Log';
import withCurrentReportId, {withCurrentReportIdPropTypes} from '../../components/withCurrentReportId';
import withCurrentReportID, {withCurrentReportIDPropTypes} from '../../components/withCurrentReportID';
import compose from '../compose';

// https://reactnavigation.org/docs/themes
Expand All @@ -28,7 +28,7 @@ const propTypes = {

/** Fired when react-navigation is ready */
onReady: PropTypes.func.isRequired,
...withCurrentReportIdPropTypes,
...withCurrentReportIDPropTypes,
};

/**
Expand Down Expand Up @@ -61,7 +61,7 @@ function NavigationRoot(props) {
return;
}
navigationStateRef.current = state;
props.updateCurrentReportId(state);
props.updateCurrentReportID(state);
parseAndLogRoute(state);
};

Expand All @@ -85,4 +85,4 @@ function NavigationRoot(props) {

NavigationRoot.displayName = 'NavigationRoot';
NavigationRoot.propTypes = propTypes;
export default compose(withWindowDimensions, withCurrentReportId)(NavigationRoot);
export default compose(withWindowDimensions, withCurrentReportID)(NavigationRoot);
16 changes: 16 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1950,6 +1950,11 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, iouRep
return false;
}

// Hide thread reports that haven't been commented on
if (isThread(report) && !report.lastMessageText) {
return false;
}

return true;
}

Expand Down Expand Up @@ -2258,6 +2263,16 @@ function getParentReport(report) {
return lodashGet(allReports, `${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`, {});
}

/**
* Return true if the composer should be hidden
* @param {Object} report
* @param {Object} reportErrors
* @returns {Boolean}
*/
function shouldHideComposer(report, reportErrors) {
return isArchivedRoom(report) || !_.isEmpty(reportErrors) || !isAllowedToComment(report);
}

/**
* Returns ID of the original report from which the given reportAction is first created.
*
Expand Down Expand Up @@ -2361,5 +2376,6 @@ export {
getMoneyRequestAction,
getBankAccountRoute,
getParentReport,
shouldHideComposer,
getOriginalReportID,
};
3 changes: 1 addition & 2 deletions src/pages/FlagCommentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ function FlagCommentPage(props) {
title={item.name}
description={item.description}
onPress={Session.checkIfActionIsAllowed(() => flagComment(item.severity))}
style={[styles.pt2, styles.pb4, styles.mh5, styles.ph0, styles.flexRow, styles.borderBottom]}
style={[styles.pt2, styles.pb4, styles.ph5, styles.flexRow]}
furtherDetails={item.furtherDetails}
furtherDetailsIcon={item.furtherDetailsIcon}
hoverAndPressStyle={[styles.mh0, styles.ph5]}
/>
));

Expand Down
Loading

0 comments on commit 607451d

Please sign in to comment.