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
3 changes: 2 additions & 1 deletion src/IONKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export default {
NETWORK: 'network',
PERSONAL_DETAILS: 'personal_details',
REPORT: 'report',
REPORT_HISTORY: 'report_history',
REPORT_ACTION: 'reportAction',
REPORT_HISTORY: 'report_history',
FIRST_REPORT_ID: 'first_report_id',
SESSION: 'session',
};
1 change: 1 addition & 0 deletions src/lib/actions/ActionsReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function fetchAll() {
return _.isEmpty(report) ? null : _.values(report)[0];
})))
.then(() => Ion.get(IONKEYS.SESSION, 'accountID'))
.then(() => Ion.set(IONKEYS.FIRST_REPORT_ID, _.first(_.pluck(fetchedReports, 'reportID'))))
.then((accountID) => {
const ionPromises = _.map(fetchedReports, (report) => {
// Store only the absolute bare minimum of data in Ion because space is limited
Expand Down
4 changes: 1 addition & 3 deletions src/page/HomePage/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default class App extends React.Component {
super(props);

this.state = {
// TODO: Set back to windowSize.width > widthBreakPoint once
// https://github.com/AndrewGable/ReactNativeChat/pull/132 is merged
hamburgerShown: true,
hamburgerShown: windowSize.width > widthBreakPoint,
isHamburgerEnabled: windowSize.width <= widthBreakPoint,
animationTranslateX: new Animated.Value(0),
};
Expand Down
13 changes: 12 additions & 1 deletion src/page/HomePage/SidebarView.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {fetchAll} from '../../lib/actions/ActionsReport';
import SidebarLink from './SidebarLink';
import logo from '../../../assets/images/expensify-logo_reversed.png';
import PageTitleUpdater from '../../lib/PageTitleUpdater';
import Ion from '../../lib/Ion';
import Anchor from '../../components/Anchor';

const propTypes = {
Expand Down Expand Up @@ -123,7 +124,17 @@ export default WithIon({
key: `${IONKEYS.REPORT}_[0-9]+$`,
addAsCollection: true,
collectionID: 'reportID',
loader: fetchAll,
loader: () => fetchAll().then(() => {
Ion.multiGet([IONKEYS.CURRENT_URL, IONKEYS.FIRST_REPORT_ID]).then((values) => {
const currentURL = values[IONKEYS.CURRENT_URL] || '';
const firstReportID = values[IONKEYS.FIRST_REPORT_ID] || 0;

// If we're on the home page, then redirect to the first report ID
if (currentURL === '/' && firstReportID) {
Ion.set(IONKEYS.APP_REDIRECT_TO, `/${firstReportID}`);
}
});
}),
},
isOffline: {
key: IONKEYS.NETWORK,
Expand Down