Skip to content

Commit

Permalink
Merge branch 'main' into jules-buildOptimisticIOUReport
Browse files Browse the repository at this point in the history
  • Loading branch information
Julesssss committed Sep 8, 2022
2 parents 1c857bb + 1718572 commit 81abe37
Show file tree
Hide file tree
Showing 19 changed files with 68 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/contributorChecklists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on: pull_request
jobs:
checklist:
runs-on: ubuntu-latest
if: github.actor != 'OSBotify' && (github.event_name == 'pull_request' && contains(github.event.pull_request.body, '- ['))
if: github.actor != 'OSBotify'
steps:
- name: contributorChecklist.js
uses: Expensify/App/.github/actions/javascript/contributorChecklist@andrew-checklist-3
uses: Expensify/App/.github/actions/javascript/contributorChecklist@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHECKLIST: 'contributor'
6 changes: 3 additions & 3 deletions .github/workflows/contributorPlusChecklists.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Contributor+ Checklist

on: issue_comment
on: pull_request_review

jobs:
checklist:
runs-on: ubuntu-latest
if: github.actor != 'OSBotify' && (contains(github.event.issue.pull_request.url, 'http') && github.event_name == 'issue_comment' && contains(github.event.comment.body, '- ['))
if: github.actor != 'OSBotify'
steps:
- name: contributorChecklist.js
uses: Expensify/App/.github/actions/javascript/contributorChecklist@andrew-checklist-3
uses: Expensify/App/.github/actions/javascript/contributorChecklist@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHECKLIST: 'contributorPlus'
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 1001019707
versionName "1.1.97-7"
versionCode 1001019800
versionName "1.1.98-0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
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.97</string>
<string>1.1.98</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.97.7</string>
<string>1.1.98.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.97</string>
<string>1.1.98</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.97.7</string>
<string>1.1.98.0</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.1.97-7",
"version": "1.1.98-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
5 changes: 5 additions & 0 deletions src/CONFIG.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import CONST from './CONST';
const ENVIRONMENT = lodashGet(Config, 'ENVIRONMENT', CONST.ENVIRONMENT.DEV);
const newExpensifyURL = Url.addTrailingForwardSlash(lodashGet(Config, 'NEW_EXPENSIFY_URL', 'https://new.expensify.com/'));
const expensifyURL = Url.addTrailingForwardSlash(lodashGet(Config, 'EXPENSIFY_URL', 'https://www.expensify.com/'));
const stagingExpensifyURL = Url.addTrailingForwardSlash(lodashGet(Config, 'STAGING_EXPENSIFY_URL', 'https://staging.expensify.com/'));
const stagingSecureExpensifyUrl = Url.addTrailingForwardSlash(lodashGet(Config, 'STAGING_SECURE_EXPENSIFY_URL', 'https://staging-secure.expensify.com/'));
const ngrokURL = Url.addTrailingForwardSlash(lodashGet(Config, 'NGROK_URL', ''));
const secureNgrokURL = Url.addTrailingForwardSlash(lodashGet(Config, 'SECURE_NGROK_URL', ''));
const secureExpensifyUrl = Url.addTrailingForwardSlash(lodashGet(
Expand Down Expand Up @@ -46,12 +48,15 @@ export default {
SECURE_EXPENSIFY_URL: secureURLRoot,
NEW_EXPENSIFY_URL: newExpensifyURL,
URL_API_ROOT: expensifyURLRoot,
STAGING_EXPENSIFY_URL: stagingExpensifyURL,
STAGING_SECURE_EXPENSIFY_URL: stagingSecureExpensifyUrl,
PARTNER_NAME: lodashGet(Config, 'EXPENSIFY_PARTNER_NAME', 'chat-expensify-com'),
PARTNER_PASSWORD: lodashGet(Config, 'EXPENSIFY_PARTNER_PASSWORD', 'e21965746fd75f82bb66'),
EXPENSIFY_CASH_REFERER: 'ecash',
CONCIERGE_URL: conciergeUrl,
},
IS_IN_PRODUCTION: Platform.OS === 'web' ? process.env.NODE_ENV === 'production' : !__DEV__,
IS_IN_STAGING: ENVIRONMENT === CONST.ENVIRONMENT.STAGING,
IS_USING_LOCAL_WEB: useNgrok || expensifyURLRoot.includes('dev'),
PUSHER: {
APP_KEY: lodashGet(Config, 'PUSHER_APP_KEY', '268df511a204fbb60884'),
Expand Down
2 changes: 1 addition & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ const CONST = {
MANAGE_CARDS_URL: 'domain_companycards',
FEES_URL: `${USE_EXPENSIFY_URL}/fees`,
CFPB_PREPAID_URL: 'https://cfpb.gov/prepaid',
STAGING_SECURE_URL: 'https://staging-secure.expensify.com/',
STAGING_NEW_EXPENSIFY_URL: 'https://staging.new.expensify.com',

// Use Environment.getEnvironmentURL to get the complete URL with port number
Expand Down Expand Up @@ -515,6 +514,7 @@ const CONST = {
SVFG: 'svfg@expensify.com',
INTEGRATION_TESTING_CREDS: 'integrationtestingcreds@expensify.com',
ADMIN: 'admin@expensify.com',
GUIDES_DOMAIN: 'team.expensify.com',
},

ENVIRONMENT: {
Expand Down
3 changes: 2 additions & 1 deletion src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Text from '../Text';
import compose from '../../libs/compose';
import CONST from '../../CONST';
import styles from '../../styles/styles';
import withLocalize from '../withLocalize';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import TextInput from '../TextInput';
import ArrowKeyFocusManager from '../ArrowKeyFocusManager';
import KeyboardShortcut from '../../libs/KeyboardShortcut';
Expand All @@ -24,6 +24,7 @@ const propTypes = {
shouldDelayFocus: PropTypes.bool,

...optionsSelectorPropTypes,
...withLocalizePropTypes,
};

const defaultProps = {
Expand Down
3 changes: 0 additions & 3 deletions src/components/OptionsSelector/optionsSelectorPropTypes.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PropTypes from 'prop-types';
import optionPropTypes from '../optionPropTypes';
import {withLocalizePropTypes} from '../withLocalize';
import styles from '../../styles/styles';

const propTypes = {
Expand Down Expand Up @@ -93,8 +92,6 @@ const propTypes = {

/** Whether to show options list */
shouldShowOptions: PropTypes.bool,

...withLocalizePropTypes,
};

const defaultProps = {
Expand Down
11 changes: 6 additions & 5 deletions src/components/TestToolMenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import styles from '../styles/styles';
import Switch from './Switch';
import Text from './Text';
Expand All @@ -18,7 +19,7 @@ const propTypes = {
/** User object in Onyx */
user: PropTypes.shape({
/** Whether we should use the staging version of the secure API server */
shouldUseSecureStaging: PropTypes.bool,
shouldUseStagingServer: PropTypes.bool,
}),

/** Network object in Onyx */
Expand All @@ -27,7 +28,7 @@ const propTypes = {

const defaultProps = {
user: {
shouldUseSecureStaging: false,
shouldUseStagingServer: false,
},
};

Expand All @@ -39,10 +40,10 @@ const TestToolMenu = props => (

{/* Option to switch from using the staging secure endpoint or the production secure endpoint.
This enables QA and internal testers to take advantage of sandbox environments for 3rd party services like Plaid and Onfido. */}
<TestToolRow title="Use Secure Staging Server">
<TestToolRow title="Use Staging Server">
<Switch
isOn={props.user.shouldUseSecureStaging || false}
onToggle={() => User.setShouldUseSecureStaging(!props.user.shouldUseSecureStaging)}
isOn={lodashGet(props, 'user.shouldUseStagingServer', true)}
onToggle={() => User.setShouldUseStagingServer(!lodashGet(props, 'user.shouldUseStagingServer', true))}
/>
</TestToolRow>

Expand Down
10 changes: 6 additions & 4 deletions src/libs/HttpUtils.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Onyx from 'react-native-onyx';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import CONFIG from '../CONFIG';
import CONST from '../CONST';
import ONYXKEYS from '../ONYXKEYS';
import HttpsError from './Errors/HttpsError';

let shouldUseSecureStaging = false;
let shouldUseStagingServer = false;
Onyx.connect({
key: ONYXKEYS.USER,
callback: val => shouldUseSecureStaging = (val && _.isBoolean(val.shouldUseSecureStaging)) ? val.shouldUseSecureStaging : false,
callback: val => shouldUseStagingServer = lodashGet(val, 'shouldUseStagingServer', true),
});

let shouldFailAllRequests = false;
Expand Down Expand Up @@ -94,10 +95,11 @@ function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure =

formData.append(key, val);
});

let apiRoot = shouldUseSecure ? CONFIG.EXPENSIFY.SECURE_EXPENSIFY_URL : CONFIG.EXPENSIFY.URL_API_ROOT;

if (shouldUseSecure && shouldUseSecureStaging) {
apiRoot = CONST.STAGING_SECURE_URL;
if (CONFIG.IS_IN_STAGING && shouldUseStagingServer) {
apiRoot = shouldUseSecure ? CONFIG.EXPENSIFY.STAGING_SECURE_EXPENSIFY_URL : CONFIG.EXPENSIFY.STAGING_EXPENSIFY_URL;
}

return processHTTPRequest(`${apiRoot}api?command=${command}`, type, formData, data.canCancel);
Expand Down
10 changes: 8 additions & 2 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,14 @@ function getOptions(reports, personalDetails, activeReportID, {
return;
}

// We let Free Plan default rooms to be shown in the App - it's the one exception to the beta, otherwise do not show policy rooms in product
if (ReportUtils.isDefaultRoom(report) && !Permissions.canUseDefaultRooms(betas) && ReportUtils.getPolicyType(report, policies) !== CONST.POLICY.TYPE.FREE) {
// We create policy rooms for all policies, however we don't show them unless
// - It's a free plan workspace
// - The report includes guides participants (@team.expensify.com) for 1:1 Assigned
if (!Permissions.canUseDefaultRooms(betas)
&& ReportUtils.isDefaultRoom(report)
&& ReportUtils.getPolicyType(report, policies) !== CONST.POLICY.TYPE.FREE
&& !ReportUtils.hasExpensifyGuidesEmails(logins)
) {
return;
}

Expand Down
14 changes: 13 additions & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ function getPolicyType(report, policies) {
return lodashGet(policies, [`${ONYXKEYS.COLLECTION.POLICY}${report.policyID}`, 'type'], '');
}

/**
* Returns true if there are any guides accounts (team.expensify.com) in emails
* @param {Array} emails
* @returns {Boolean}
*/
function hasExpensifyGuidesEmails(emails) {
return _.some(emails, email => Str.extractEmailDomain(email) === CONST.EMAIL.GUIDES_DOMAIN);
}

/**
* Given a collection of reports returns the most recently accessed one
*
Expand All @@ -216,7 +225,9 @@ function findLastAccessedReport(reports, ignoreDefaultRooms, policies) {
let sortedReports = sortReportsByLastVisited(reports);

if (ignoreDefaultRooms) {
sortedReports = _.filter(sortedReports, report => !isDefaultRoom(report) || getPolicyType(report, policies) === CONST.POLICY.TYPE.FREE);
sortedReports = _.filter(sortedReports, report => !isDefaultRoom(report)
|| getPolicyType(report, policies) === CONST.POLICY.TYPE.FREE
|| hasExpensifyGuidesEmails(lodashGet(report, ['participants'], [])));
}

return _.last(sortedReports);
Expand Down Expand Up @@ -672,6 +683,7 @@ export {
isArchivedRoom,
isConciergeChatReport,
hasExpensifyEmails,
hasExpensifyGuidesEmails,
canShowReportRecipientLocalTime,
formatReportLastMessageText,
chatIncludesConcierge,
Expand Down
3 changes: 2 additions & 1 deletion src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ function deletePolicy(policyID) {

Growl.show(Localize.translateLocal('workspace.common.growlMessageOnDelete'), CONST.GROWL.SUCCESS, 3000);

// Removing the workspace data from Onyx as well
// Removing the workspace data from Onyx and local array as well
delete allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${policyID}`];
return Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, null);
})
.then(() => Report.fetchAllReports(false))
Expand Down
8 changes: 4 additions & 4 deletions src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,10 @@ function updateChatPriorityMode(mode) {
}

/**
* @param {Boolean} shouldUseSecureStaging
* @param {Boolean} shouldUseStagingServer
*/
function setShouldUseSecureStaging(shouldUseSecureStaging) {
Onyx.merge(ONYXKEYS.USER, {shouldUseSecureStaging});
function setShouldUseStagingServer(shouldUseStagingServer) {
Onyx.merge(ONYXKEYS.USER, {shouldUseStagingServer});
}

function clearUserErrorMessage() {
Expand Down Expand Up @@ -484,7 +484,7 @@ export {
isBlockedFromConcierge,
subscribeToUserEvents,
updatePreferredSkinTone,
setShouldUseSecureStaging,
setShouldUseStagingServer,
clearUserErrorMessage,
subscribeToExpensifyCardUpdates,
updateFrequentlyUsedEmojis,
Expand Down
8 changes: 6 additions & 2 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,14 @@ class ReportScreen extends React.Component {
return null;
}

// We let Free Plan default rooms to be shown in the App - it's the one exception to the beta, otherwise do not show policy rooms in product
// We create policy rooms for all policies, however we don't show them unless
// - It's a free plan workspace
// - The report includes guides participants (@team.expensify.com) for 1:1 Assigned
if (!Permissions.canUseDefaultRooms(this.props.betas)
&& ReportUtils.isDefaultRoom(this.props.report)
&& ReportUtils.getPolicyType(this.props.report, this.props.policies) !== CONST.POLICY.TYPE.FREE) {
&& ReportUtils.getPolicyType(this.props.report, this.props.policies) !== CONST.POLICY.TYPE.FREE
&& !ReportUtils.hasExpensifyGuidesEmails(lodashGet(this.props.report, ['participants'], []))
) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/settings/PreferencesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const propTypes = {
user: PropTypes.shape({
/** Whether or not the user is subscribed to news updates */
isSubscribedToNewsletter: PropTypes.bool,
shouldUseSecureStaging: PropTypes.bool,
shouldUseStagingServer: PropTypes.bool,
}),

...withLocalizePropTypes,
Expand Down

0 comments on commit 81abe37

Please sign in to comment.