Skip to content
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 1001008105
versionName "1.0.81-5"
versionCode 1001008106
versionName "1.0.81-6"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0.81.5</string>
<string>1.0.81.6</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ExpensifyCashTests/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.81.5</string>
<string>1.0.81.6</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": "expensify.cash",
"version": "1.0.81-5",
"version": "1.0.81-6",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "Expensify.cash 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/CONST.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export default {
getWorkspaceInviteRoute: policyID => `workspace/${policyID}/invite`,
WORKSPACE_INVITE: 'workspace/:policyID/invite',
REQUEST_CALL: 'request-call',
VALIDATE_CODE_URL: (accountID, validateCode, exitTo = '') => {
const exitToURL = exitTo ? `?exitTo=${exitTo}` : '';
return `v/${accountID}/${validateCode}${exitToURL}`;
},

/**
* @param {String} route
Expand Down
10 changes: 10 additions & 0 deletions src/libs/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,15 @@ function GetAccountStatus(parameters) {
return Network.post(commandName, parameters);
}

/**
* Returns a validate code for this account
* @returns {Promise}
*/
function GetAccountValidateCode() {
const commandName = 'GetAccountValidateCode';
return Network.post(commandName);
}

/**
* @param {Object} parameters
* @param {String} parameters.debtorEmail
Expand Down Expand Up @@ -1072,6 +1081,7 @@ export {
DeleteLogin,
Get,
GetAccountStatus,
GetAccountValidateCode,
GetIOUReport,
GetPolicyList,
GetPolicySummaryList,
Expand Down
29 changes: 27 additions & 2 deletions src/libs/actions/App.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import Onyx from 'react-native-onyx';
import {Linking} from 'react-native';
import lodashGet from 'lodash/get';
import ONYXKEYS from '../../ONYXKEYS';
import * as API from '../API';
import Firebase from '../Firebase';
import CONST from '../../CONST';
import CONFIG from '../../CONFIG';
import Firebase from '../Firebase';
import ROUTES from '../../ROUTES';

let isSidebarLoaded;
let currentUserAccountID;
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (val) => {
currentUserAccountID = lodashGet(val, 'accountID', '');
},
});

let isSidebarLoaded;
Onyx.connect({
key: ONYXKEYS.IS_SIDEBAR_LOADED,
callback: val => isSidebarLoaded = val,
Expand All @@ -27,6 +38,19 @@ function setLocale(locale) {
Onyx.merge(ONYXKEYS.NVP_PREFERRED_LOCALE, locale);
}

/**
* This links to a page in e.com ensuring the user is logged in.
* It does so by getting a validate code and redirecting to the validate URL with exitTo set to the URL
* we want to visit
* @param {string} url relative URL starting with `/` to open in expensify.com
*/
function openSignedInLink(url) {
API.GetAccountValidateCode().then((response) => {
Linking.openURL(CONFIG.EXPENSIFY.URL_EXPENSIFY_COM
+ ROUTES.VALIDATE_CODE_URL(currentUserAccountID, response.validateCode, url));
});
}

function setSidebarLoaded() {
if (isSidebarLoaded) {
return;
Expand All @@ -39,5 +63,6 @@ function setSidebarLoaded() {
export {
setCurrentURL,
setLocale,
openSignedInLink,
setSidebarLoaded,
};
11 changes: 4 additions & 7 deletions src/pages/workspace/WorkspaceCardPage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {
View, ScrollView, Linking, StyleSheet,
View, ScrollView, StyleSheet,
} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
Expand All @@ -18,11 +18,11 @@ import Button from '../../components/Button';
import variables from '../../styles/variables';
import themeDefault from '../../styles/themes/default';
import ROUTES from '../../ROUTES';
import CONFIG from '../../CONFIG';
import CONST from '../../CONST';
import Permissions from '../../libs/Permissions';
import HeroCardWebImage from '../../../assets/images/cascading-cards-web.svg';
import HeroCardMobileImage from '../../../assets/images/cascading-cards-mobile.svg';
import {openSignedInLink} from '../../libs/actions/App';

const propTypes = {
/* Onyx Props */
Expand Down Expand Up @@ -65,9 +65,6 @@ const defaultProps = {
},
};

const publicLink = CONFIG.EXPENSIFY.URL_EXPENSIFY_COM + CONST.ADD_SECONDARY_LOGIN_URL;
const manageCardLink = CONFIG.EXPENSIFY.URL_EXPENSIFY_COM + CONST.MANAGE_CARDS_URL;

const WorkspaceCardPage = ({
betas,
user,
Expand All @@ -89,9 +86,9 @@ const WorkspaceCardPage = ({

const onPress = () => {
if (user.isFromPublicDomain) {
Linking.openURL(publicLink);
openSignedInLink(CONST.ADD_SECONDARY_LOGIN_URL);
} else if (user.isUsingExpensifyCard) {
Linking.openURL(manageCardLink);
openSignedInLink(CONST.MANAGE_CARDS_URL);
} else {
Navigation.navigate(ROUTES.getBankAccountRoute());
}
Expand Down