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

Add splash screen related logs #6476

Merged
merged 4 commits into from
Dec 2, 2021
Merged
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
27 changes: 25 additions & 2 deletions src/Expensify.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'underscore';
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React, {PureComponent} from 'react';
Expand Down Expand Up @@ -74,6 +75,8 @@ class Expensify extends PureComponent {
}

componentDidMount() {
setTimeout(() => this.reportBootSplashStatus(), 30 * 1000);

// This timer is set in the native layer when launching the app and we stop it here so we can measure how long
// it took for the main app itself to load.
StartupTimer.stop();
Expand Down Expand Up @@ -107,7 +110,7 @@ class Expensify extends PureComponent {
// that we can remove it again once the content is ready
const previousAuthToken = lodashGet(prevProps, 'session.authToken', null);
if (this.getAuthToken() && !previousAuthToken) {
BootSplash.show({fade: true});
this.showSplash();
}

if (this.getAuthToken() && this.props.initialReportDataLoaded && this.props.isSidebarLoaded) {
Expand All @@ -131,8 +134,28 @@ class Expensify extends PureComponent {
ActiveClientManager.init();
}

showSplash() {
Log.info('[BootSplash] showing splash screen', false);
BootSplash.show({fade: true});
}

hideSplash() {
BootSplash.hide({fade: true});
Log.info('[BootSplash] hiding splash screen', false);
BootSplash.hide({fade: true})
.catch(error => Log.alert('[BootSplash] hiding failed', {message: error.message, error}, false));
}

reportBootSplashStatus() {
BootSplash.getVisibilityStatus()
.then((status) => {
Log.info('[BootSplash] splash screen status', false, {status});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: Extra line

if (status === 'visible') {
const props = _.omit(this.props, ['children', 'session']);
props.hasAuthToken = !_.isEmpty(this.getAuthToken());
Log.alert('[BootSplash] splash screen is still visible', {props}, false);
}
});
}

render() {
Expand Down