Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mananjadhav/App into feat/e…
Browse files Browse the repository at this point in the history
…moji-picker-in-edit-message
  • Loading branch information
mananjadhav committed Mar 24, 2022
2 parents 38a602e + 633d1a1 commit dac1391
Show file tree
Hide file tree
Showing 40 changed files with 404 additions and 134 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001014403
versionName "1.1.44-3"
versionCode 1001014500
versionName "1.1.45-0"
}
splits {
abi {
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.44</string>
<string>1.1.45</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.44.3</string>
<string>1.1.45.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.44</string>
<string>1.1.45</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.44.3</string>
<string>1.1.45.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion 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.1.44-3",
"version": "1.1.45-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
17 changes: 16 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,20 @@ const CONST = {
ACTIONS: {
LIMIT: 50,
TYPE: {
IOU: 'IOU',
ADDCOMMENT: 'ADDCOMMENT',
CLOSED: 'CLOSED',
CREATED: 'CREATED',
IOU: 'IOU',
RENAMED: 'RENAMED',
},
},
ARCHIVE_REASON: {
DEFAULT: 'default',
ACCOUNT_CLOSED: 'accountClosed',
ACCOUNT_MERGED: 'accountMerged',
REMOVED_FROM_POLICY: 'removedFromPolicy',
POLICY_DELETED: 'policyDeleted',
},
ERROR: {
INACCESSIBLE_REPORT: 'Report not found',
},
Expand All @@ -245,6 +253,13 @@ const CONST = {
PROCESSING: 1,
SUBMITTED: 2,
},
STATUS: {
OPEN: 0,
SUBMITTED: 1,
CLOSED: 2,
APPROVED: 3,
REIMBURSED: 4,
},
NOTIFICATION_PREFERENCE: {
MUTE: 'mute',
DAILY: 'daily',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'underscore';
import React from 'react';
import {Pressable, StyleSheet} from 'react-native';
import lodashGet from 'lodash/get';
import Str from 'expensify-common/lib/str';
import Text from '../../Text';
import {propTypes, defaultProps} from '../anchorForCommentsOnlyPropTypes';
import PressableWithSecondaryInteraction from '../../PressableWithSecondaryInteraction';
Expand Down Expand Up @@ -44,12 +45,12 @@ class BaseAnchorForCommentsOnly extends React.Component {
if (this.state.isDownloading) {
return;
}
this.processDownload(this.props.href, this.props.fileName);
this.processDownload(this.props.href, this.props.displayName);
}}
>
<AttachmentView
sourceURL={this.props.href}
file={{name: this.props.fileName}}
file={{name: this.props.displayName}}
shouldShowDownloadIcon
shouldShowLoadingSpinnerIcon={this.state.isDownloading}
/>
Expand All @@ -61,7 +62,7 @@ class BaseAnchorForCommentsOnly extends React.Component {
onSecondaryInteraction={
(event) => {
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
Str.isValidEmail(this.props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
event,
this.props.href,
lodashGet(linkRef, 'current'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ from 'underscore';
import React from 'react';
import lodashGet from 'lodash/get';
import {Linking, StyleSheet, Pressable} from 'react-native';
import Str from 'expensify-common/lib/str';
import {propTypes, defaultProps} from '../anchorForCommentsOnlyPropTypes';
import fileDownload from '../../../libs/fileDownload';
import Text from '../../Text';
Expand Down Expand Up @@ -47,12 +48,12 @@ class BaseAnchorForCommentsOnly extends React.Component {
if (this.state.isDownloading) {
return;
}
this.processDownload(this.props.href, this.props.fileName);
this.processDownload(this.props.href, this.props.displayName);
}}
>
<AttachmentView
sourceURL={this.props.href}
file={{name: this.props.fileName}}
file={{name: this.props.displayName}}
shouldShowDownloadIcon
shouldShowLoadingSpinnerIcon={this.state.isDownloading}
/>
Expand All @@ -64,7 +65,7 @@ class BaseAnchorForCommentsOnly extends React.Component {
onSecondaryInteraction={
(event) => {
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
Str.isValidEmail(this.props.displayName) ? ContextMenuActions.CONTEXT_MENU_TYPES.EMAIL : ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
event,
this.props.href,
lodashGet(linkRef, 'current'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const propTypes = {
/** Any children to display */
children: PropTypes.node,

/** Display label in case of attachments */
fileName: PropTypes.string,
/** Filename in case of attachments, anchor text in case of URLs or emails. */
displayName: PropTypes.string,

/** Any additional styles to apply */
// eslint-disable-next-line react/forbid-prop-types
Expand All @@ -37,7 +37,7 @@ const defaultProps = {
isAttachment: false,
children: null,
style: {},
fileName: '',
displayName: '',
};

export {propTypes, defaultProps};
93 changes: 93 additions & 0 deletions src/components/ArchivedReportFooter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import lodashGet from 'lodash/get';
import React from 'react';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import CONST from '../CONST';
import Banner from './Banner';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import compose from '../libs/compose';
import personalDetailsPropType from '../pages/personalDetailsPropType';
import ONYXKEYS from '../ONYXKEYS';

const propTypes = {
/** The reason this report was archived */
reportClosedAction: PropTypes.shape({
/** Message attached to the report closed action */
originalMessage: PropTypes.shape({
/** The reason the report was closed */
reason: PropTypes.string.isRequired,

/** (For accountMerged reason only), the email of the previous owner of this report. */
oldLogin: PropTypes.string,

/** (For accountMerged reason only), the email of the account the previous owner was merged into */
newLogin: PropTypes.string,
}).isRequired,
}),

/** The archived report */
report: PropTypes.shape({
/** The policy this report is attached to */
policyID: PropTypes.string,
}).isRequired,

/** Personal details of all users */
personalDetails: PropTypes.objectOf(personalDetailsPropType).isRequired,

/** The list of policies the user has access to. */
policies: PropTypes.objectOf(PropTypes.shape({
/** The name of the policy */
name: PropTypes.string,
})).isRequired,

...withLocalizePropTypes,
};

const defaultProps = {
reportClosedAction: {
originalMessage: {
reason: CONST.REPORT.ARCHIVE_REASON.DEFAULT,
},
},
};

const ArchivedReportFooter = (props) => {
const archiveReason = lodashGet(props.reportClosedAction, 'originalMessage.reason', CONST.REPORT.ARCHIVE_REASON.DEFAULT);
const policyName = lodashGet(props.policies, `${ONYXKEYS.COLLECTION.POLICY}${props.report.policyID}.name`);
let displayName = lodashGet(props.personalDetails, `${props.report.ownerEmail}.displayName`, props.report.ownerEmail);

let oldDisplayName;
if (archiveReason === CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED) {
const newLogin = props.reportClosedAction.originalMessage.newLogin;
const oldLogin = props.reportClosedAction.originalMessage.oldLogin;
displayName = lodashGet(props.personalDetails, `${newLogin}.displayName`, newLogin);
oldDisplayName = lodashGet(props.personalDetails, `${oldLogin}.displayName`, oldLogin);
}

return (
<Banner
text={props.translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
oldDisplayName: `<strong>${oldDisplayName}</strong>`,
policyName: `<strong>${policyName}</strong>`,
})}
shouldRenderHTML={archiveReason !== CONST.REPORT.ARCHIVE_REASON.DEFAULT}
/>
);
};

ArchivedReportFooter.propTypes = propTypes;
ArchivedReportFooter.defaultProps = defaultProps;
ArchivedReportFooter.displayName = 'ArchivedReportFooter';

export default compose(
withLocalize,
withOnyx({
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS,
},
policies: {
key: ONYXKEYS.COLLECTION.POLICY,
},
}),
)(ArchivedReportFooter);
56 changes: 56 additions & 0 deletions src/components/Banner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React, {memo} from 'react';
import PropTypes from 'prop-types';
import {View} from 'react-native';
import Hoverable from './Hoverable';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import RenderHTML from './RenderHTML';
import Text from './Text';
import styles from '../styles/styles';
import * as StyleUtils from '../styles/StyleUtils';
import getButtonState from '../libs/getButtonState';

const propTypes = {
/** Text to display in the banner. */
text: PropTypes.string.isRequired,

/** Should this component render the text as HTML? */
shouldRenderHTML: PropTypes.bool,
};

const defaultProps = {
shouldRenderHTML: false,
};

const Banner = props => (
<Hoverable>
{isHovered => (
<View style={[
styles.flexRow,
styles.alignItemsCenter,
styles.p5,
styles.borderRadiusNormal,
isHovered ? styles.activeComponentBG : styles.hoveredComponentBG,
]}
>
<View style={[styles.mr3]}>
<Icon
src={Expensicons.Exclamation}
fill={StyleUtils.getIconFillColor(getButtonState(isHovered))}
/>
</View>
{
props.shouldRenderHTML
? <RenderHTML html={props.text} />
: <Text>{props.text}</Text>
}
</View>
)}
</Hoverable>
);

Banner.propTypes = propTypes;
Banner.defaultProps = defaultProps;
Banner.displayName = 'Banner';

export default memo(Banner);
11 changes: 8 additions & 3 deletions src/components/GrowlNotification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as Expensicons from '../Icon/Expensicons';
import styles from '../../styles/styles';
import GrowlNotificationContainer from './GrowlNotificationContainer';
import CONST from '../../CONST';
import * as Growl from '../../libs/Growl';

const types = {
[CONST.GROWL.SUCCESS]: {
Expand All @@ -31,8 +32,8 @@ const types = {
const INACTIVE_POSITION_Y = -255;

class GrowlNotification extends Component {
constructor() {
super();
constructor(props) {
super(props);

this.state = {
bodyText: '',
Expand All @@ -44,6 +45,10 @@ class GrowlNotification extends Component {
this.fling = this.fling.bind(this);
}

componentDidMount() {
Growl.setIsReady();
}

/**
* Show the growl notification
*
Expand Down Expand Up @@ -92,10 +97,10 @@ class GrowlNotification extends Component {
<GrowlNotificationContainer translateY={this.state.translateY}>
<TouchableWithoutFeedback onPress={this.fling}>
<View style={styles.growlNotificationBox}>
<Icon src={types[this.state.type].icon} fill={types[this.state.type].iconColor} />
<Text style={styles.growlNotificationText}>
{this.state.bodyText}
</Text>
<Icon src={types[this.state.type].icon} fill={types[this.state.type].iconColor} />
</View>
</TouchableWithoutFeedback>
</GrowlNotificationContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const AnchorRenderer = (props) => {

// An auth token is needed to download Expensify chat attachments
const isAttachment = Boolean(htmlAttribs['data-expensify-source']);
const fileName = lodashGet(props.tnode, 'domNode.children[0].data', '');
const displayName = lodashGet(props.tnode, 'domNode.children[0].data', '');
const parentStyle = lodashGet(props.tnode, 'parent.styles.nativeTextRet', {});
const attrHref = htmlAttribs.href || '';
const internalExpensifyPath = (attrHref.startsWith(CONST.NEW_EXPENSIFY_URL) && attrHref.replace(CONST.NEW_EXPENSIFY_URL, ''))
Expand Down Expand Up @@ -64,7 +64,7 @@ const AnchorRenderer = (props) => {
rel={htmlAttribs.rel || 'noopener noreferrer'}
style={{...props.style, ...parentStyle}}
key={props.key}
fileName={fileName}
displayName={displayName}
>
<TNodeChildrenRenderer tnode={props.tnode} />
</AnchorForCommentsOnly>
Expand Down
Loading

0 comments on commit dac1391

Please sign in to comment.