Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🍒 Cherry pick PR #5360 to staging 🍒 #5362

Merged
merged 2 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001009903
versionName "1.0.99-3"
versionCode 1001009904
versionName "1.0.99-4"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.99.3</string>
<string>1.0.99.4</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.0.99.3</string>
<string>1.0.99.4</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.0.99-3",
"version": "1.0.99-4",
"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
46 changes: 9 additions & 37 deletions src/pages/home/sidebar/SidebarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {Component} from 'react';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import PropTypes from 'prop-types';
import _ from 'underscore';
import styles from '../../../styles/styles';
import SidebarLinks from './SidebarLinks';
import PopoverMenu from '../../../components/PopoverMenu';
Expand All @@ -29,32 +28,17 @@ import Performance from '../../../libs/Performance';
import NameValuePair from '../../../libs/actions/NameValuePair';

const propTypes = {
/* Onyx Props */

/** Beta features list */
/* Beta features list */
betas: PropTypes.arrayOf(PropTypes.string).isRequired,

/** Flag for new users used to open the Global Create menu on first load */
/* Flag for new users used to open the Global Create menu on first load */
isFirstTimeNewExpensifyUser: PropTypes.bool.isRequired,

/** The list of this user's policies */
policies: PropTypes.objectOf(PropTypes.shape({
/** The type of the policy */
type: PropTypes.string,

/** The user's role in the policy */
role: PropTypes.string,
})),

...windowDimensionsPropTypes,

...withLocalizePropTypes,
};

const defaultProps = {
policies: {},
};

class SidebarScreen extends Component {
constructor(props) {
super(props);
Expand All @@ -74,21 +58,13 @@ class SidebarScreen extends Component {
Timing.start(CONST.TIMING.SIDEBAR_LOADED, true);

if (this.props.isFirstTimeNewExpensifyUser) {
const hasFreePolicy = _.chain(this.props.policies)
.some(policy => policy && policy.type === CONST.POLICY.TYPE.FREE && policy.role === CONST.POLICY.ROLE.ADMIN)
.value();

// If user doesn't have any free policies (workspaces) set up, automatically open create menu
if (!hasFreePolicy) {
// For some reason, the menu doesn't open without the timeout
setTimeout(() => {
this.toggleCreateMenu();
}, 200);
}

// Set the NVP to false so we don't automatically open the menu again
// Note: this may need to be moved if this NVP is used for anything else later
NameValuePair.set(CONST.NVP.IS_FIRST_TIME_NEW_EXPENSIFY_USER, false, ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER);
// For some reason, the menu doesn't open without the timeout
setTimeout(() => {
this.toggleCreateMenu();

// Set the NVP back to false (this may need to be moved if this NVP is used for anything else later)
NameValuePair.set(CONST.NVP.IS_FIRST_TIME_NEW_EXPENSIFY_USER, false, ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER);
}, 200);
}
}

Expand Down Expand Up @@ -201,7 +177,6 @@ class SidebarScreen extends Component {
}

SidebarScreen.propTypes = propTypes;
SidebarScreen.defaultProps = defaultProps;
export default compose(
withLocalize,
withWindowDimensions,
Expand All @@ -212,8 +187,5 @@ export default compose(
isFirstTimeNewExpensifyUser: {
key: ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER,
},
policies: {
key: ONYXKEYS.COLLECTION.POLICY,
},
}),
)(SidebarScreen);