From 3ccc3b3484ab5513cb228a659c74d8c43c8b2662 Mon Sep 17 00:00:00 2001
From: Peter Velkov <kidroca@gmail.com>
Date: Wed, 24 Nov 2021 19:14:36 +0200
Subject: [PATCH 1/4] Add splash screen related logs

---
 src/Expensify.js | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/Expensify.js b/src/Expensify.js
index 66350a2ad2bb..2e0009c82de1 100644
--- a/src/Expensify.js
+++ b/src/Expensify.js
@@ -1,3 +1,4 @@
+import _ from 'underscore';
 import lodashGet from 'lodash/get';
 import PropTypes from 'prop-types';
 import React, {PureComponent} from 'react';
@@ -64,6 +65,8 @@ class Expensify extends PureComponent {
     constructor(props) {
         super(props);
 
+        setTimeout(() => this.reportBootSplashStatus(), 30 * 1000);
+
         // Initialize this client as being an active client
         ActiveClientManager.init();
         this.hideSplash = this.hideSplash.bind(this);
@@ -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) {
@@ -131,10 +134,28 @@ class Expensify extends PureComponent {
         ActiveClientManager.init();
     }
 
+    showSplash() {
+        Log.info('[BootSplash] showing splash screen', false);
+        BootSplash.show({fade: true});
+    }
+
     hideSplash() {
+        Log.info('[BootSplash] hiding splash screen', false);
         BootSplash.hide({fade: true});
     }
 
+    reportBootSplashStatus() {
+        BootSplash.getVisibilityStatus()
+            .then((status) => {
+                Log.info('[BootSplash] Splash screen status', false, {status});
+
+                if (status === 'visible') {
+                    const parameters = _.omit(this.props, 'children');
+                    Log.alert('[BootSplash] Still visible. Current <Expensify /> props', parameters, false);
+                }
+            });
+    }
+
     render() {
         // Display a blank page until the onyx migration completes
         if (!this.state.isOnyxMigrated) {

From 6cb0693e7e03d90fb193432a512212d741c21cec Mon Sep 17 00:00:00 2001
From: Peter Velkov <kidroca@gmail.com>
Date: Thu, 25 Nov 2021 21:08:58 +0200
Subject: [PATCH 2/4] Add splash screen log on `hide` failure

---
 src/Expensify.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/Expensify.js b/src/Expensify.js
index 2e0009c82de1..67a7e3e9c9fe 100644
--- a/src/Expensify.js
+++ b/src/Expensify.js
@@ -141,7 +141,8 @@ class Expensify extends PureComponent {
 
     hideSplash() {
         Log.info('[BootSplash] hiding splash screen', false);
-        BootSplash.hide({fade: true});
+        BootSplash.hide({fade: true})
+            .catch(error => Log.alert('[BootSplash] hiding failed', {message: error.message, error}, false));
     }
 
     reportBootSplashStatus() {

From 426bfe2f5e0ed25b3fabc346f5e1af73f0135a59 Mon Sep 17 00:00:00 2001
From: Peter Velkov <kidroca@gmail.com>
Date: Tue, 30 Nov 2021 18:03:07 +0200
Subject: [PATCH 3/4] Address requested changes

---
 src/Expensify.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/Expensify.js b/src/Expensify.js
index 67a7e3e9c9fe..fafb09ff3200 100644
--- a/src/Expensify.js
+++ b/src/Expensify.js
@@ -65,8 +65,6 @@ class Expensify extends PureComponent {
     constructor(props) {
         super(props);
 
-        setTimeout(() => this.reportBootSplashStatus(), 30 * 1000);
-
         // Initialize this client as being an active client
         ActiveClientManager.init();
         this.hideSplash = this.hideSplash.bind(this);
@@ -77,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();
@@ -151,8 +151,7 @@ class Expensify extends PureComponent {
                 Log.info('[BootSplash] Splash screen status', false, {status});
 
                 if (status === 'visible') {
-                    const parameters = _.omit(this.props, 'children');
-                    Log.alert('[BootSplash] Still visible. Current <Expensify /> props', parameters, false);
+                    Log.alert('[BootSplash] Still visible. Current <Expensify /> props', {props: _.omit(this.props, 'children')}, false);
                 }
             });
     }

From ae6568de024200732bad645780d161f5d0fba26b Mon Sep 17 00:00:00 2001
From: Peter Velkov <kidroca@gmail.com>
Date: Wed, 1 Dec 2021 19:04:49 +0200
Subject: [PATCH 4/4] Expensify.js: skip logging the full authToken and
 slightly better messages

---
 src/Expensify.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/Expensify.js b/src/Expensify.js
index fafb09ff3200..506fb2f16637 100644
--- a/src/Expensify.js
+++ b/src/Expensify.js
@@ -148,10 +148,12 @@ class Expensify extends PureComponent {
     reportBootSplashStatus() {
         BootSplash.getVisibilityStatus()
             .then((status) => {
-                Log.info('[BootSplash] Splash screen status', false, {status});
+                Log.info('[BootSplash] splash screen status', false, {status});
 
                 if (status === 'visible') {
-                    Log.alert('[BootSplash] Still visible. Current <Expensify /> props', {props: _.omit(this.props, 'children')}, false);
+                    const props = _.omit(this.props, ['children', 'session']);
+                    props.hasAuthToken = !_.isEmpty(this.getAuthToken());
+                    Log.alert('[BootSplash] splash screen is still visible', {props}, false);
                 }
             });
     }
