Skip to content

Update splash screen logic#6478

Merged
roryabraham merged 5 commits intoExpensify:mainfrom
zoontek:update-splash-screen-logic
Dec 14, 2021
Merged

Update splash screen logic#6478
roryabraham merged 5 commits intoExpensify:mainfrom
zoontek:update-splash-screen-logic

Conversation

@zoontek
Copy link
Contributor

@zoontek zoontek commented Nov 25, 2021

Following #5620

Details

There are several issue with the current splash integrations:

Fixed Issues

#5620

Tests

QA Steps

  • Starts the app on Android >= 5, check if the splash screen is visible
  • Starts the app on iOS >= 10, check if the splash screen is visible
  • Try popping an alert / a native modal once the screen is loaded
  • Open the app using a push notification tap (on both iOS and Android)

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Screenshot 2021-12-01 at 10 30 00

Desktop

iOS

Android

@zoontek zoontek requested a review from a team as a code owner November 25, 2021 16:32
@MelvinBot MelvinBot requested review from NikkiWines and removed request for a team November 25, 2021 16:32
@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@zoontek
Copy link
Contributor Author

zoontek commented Nov 25, 2021

I have read the CLA Document and I hereby sign the CLA

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix status bar being a different color than the splash screen background.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

android:windowLightStatusBar and android:windowLightNavigationBar are not available on Android 21 (the min version), tools:ignore silents the Android studio linter.

src/Expensify.js Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We wait for react-navigation to be ready. So there's no need to hide the splash screen here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed because it's not only used for logging anymore.
Naming taken from https://github.com/bvaughn/react-error-boundary

@zoontek
Copy link
Contributor Author

zoontek commented Nov 26, 2021

Even if it wasn't implemented in this PR, I strongly recommend adding a default error screen (even without a CTA, just asking the user to restart the app) on error boundary catched error. Previously, if it happen during init (Onyx, etc) user might be stuck on the splash screen without any explanation.

Now the splash screen will always disappear (at least, if it's not a complete native thread crash, just a JS error), having something else than a blank screen as error boundary fallback could be nicer for the user 🙂

@zoontek
Copy link
Contributor Author

zoontek commented Nov 28, 2021

Added screenshots for web / desktop where the splash screen module is a noop.

@roryabraham
Copy link
Contributor

@zoontek You've got a merge conflict

@zoontek zoontek changed the title Update splash screen logic + Android 12 support Update splash screen logic Nov 30, 2021
@zoontek
Copy link
Contributor Author

zoontek commented Nov 30, 2021

@roryabraham Fixed after @NikkiWines's feedback

@roryabraham
Copy link
Contributor

I think we need to tag in @Expensify/design for a review here since you changed the appBG color.

@shawnborton
Copy link
Contributor

It looks like the app background is now gray instead of white. The background of the right chat area should be white.

@roryabraham
Copy link
Contributor

roryabraham commented Nov 30, 2021

Even if it wasn't implemented in this PR, I strongly recommend adding a default error screen (even without a CTA, just asking the user to restart the app) on error boundary catched error.

Good suggestion @zoontek, I've created an issue to implement this suggestion.

@zoontek
Copy link
Contributor Author

zoontek commented Nov 30, 2021

It looks like the app background is now gray instead of white. The background of the right chat area should be white.

Does the sign in process should also have a white background then? (It was grey, I reused this color for all screens)

I can also switch back to appBG: white for all screens or just keep the color change (currently it would be sign in in grey -> loading view in white -> authenticated app in white), but as the colors are too close, it felt a bit weird 😕

@shawnborton
Copy link
Contributor

Let's keep all of the colors as they were before this PR was created. Thanks!

@zoontek
Copy link
Contributor Author

zoontek commented Nov 30, 2021

Let's keep all of the colors as they were before this PR was created. Thanks!

No problem, I will made the change tomorrow.

@zoontek
Copy link
Contributor Author

zoontek commented Dec 1, 2021

@shawnborton @roryabraham Colors are rolled back, I fixed the Podfile.lock conflict, updated the screenshots

@shawnborton
Copy link
Contributor

Thank you!

shawnborton
shawnborton previously approved these changes Dec 1, 2021
@mallenexpensify
Copy link
Contributor

@zoontek I think you should be compensated for reporting this above so I added a comment to this issue.. Payment will be issues via Upwork once the the issue is fixed internally or by a contributor

@roryabraham
Copy link
Contributor

@zoontek You've got a merge conflict here

src/App.js Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As an error could happen on context provider initialization, ErrorBoundary should wrap them to hide the splash screen is something goes wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

If there's something that might cause an Error in these components can you point it out?

The parameters used in these components are static, so if an error is to happen it would happen all the time. Meaning if someone introduces and error they'll see it right away

If this change is accepted we should at least add a reminder doc in ErrorBoundary that certain context based functionality is not available inside

Though I would prefer to keep the error boundary access the full context (e.g. withNetwork, withPersonalDetails and others), and only relinquish it if there's a proven possibility that certain context can cause an error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

react-native-onyx might have a bug, no software is perfect. To display an error fallback, it's not worth it to try (imho)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the code in ErrorBoundary might cause an error as well, we're obviously not adding another ErrorBoundary to guard from that

In the future more context components will be created it would be easier if those are kept on the same place and on the same level

  • people won't wonder where to put them
  • people would not mistakenly put them to the incorrect place

In the feature more components will be created and some of these component would rely on context,
Adding such a component (Like a network status indicator) in the error boundary would not work for seemingly no reason

If there's a bug in the initialization of some Context it fail with a bang any way and never make it to production. Wrapping the error boundary around the context is not necessary at least the currently defined contexts


To sum it up Moving the ErrorBoundary up would work, but introduces restrictions, while it's uncertain that it will help
Not changing the Error boundary position would work as well, and it's not necessary to move it to fix the splash screen bug

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @kidroca here, this change is accounting for an error that we haven't even encountered yet and it has larger implications than just catching potential initialization errors.

Copy link
Contributor

@kidroca kidroca left a comment

Choose a reason for hiding this comment

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

Some items that I've noticed

I think addressing them would further reduce the changes in this PR

src/App.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

If there's something that might cause an Error in these components can you point it out?

The parameters used in these components are static, so if an error is to happen it would happen all the time. Meaning if someone introduces and error they'll see it right away

If this change is accepted we should at least add a reminder doc in ErrorBoundary that certain context based functionality is not available inside

Though I would prefer to keep the error boundary access the full context (e.g. withNetwork, withPersonalDetails and others), and only relinquish it if there's a proven possibility that certain context can cause an error

Comment on lines 10 to 12
Copy link
Contributor

@kidroca kidroca Dec 7, 2021

Choose a reason for hiding this comment

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

If we're no longer using show, and won't be able to use it in the next major version we might as well remove it

This would leave only a single Log call here, so we might leave it in the original place where Log is imported anyway

Also this export configuration does not match the style guide. I think it's specified somewhere, but we first define functions and then export them

src/Expensify.js Outdated
Comment on lines 122 to 125
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same as

setNavigationReady() {
  this.setState({ isNavigationReady: true });
}

When the state is already true it would just do nothing

But do we expect multiple onReady calls to be triggered anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't see that it was a PureComponent, so it performs shallow compare on states comparaison anyway indeed. And lie you say, it shouldn't be called more than once.

@zoontek
Copy link
Contributor Author

zoontek commented Dec 7, 2021

@kidroca I've taken a few feedbacks, wrote some comments for the rest.

Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

Some small comments but overall looking pretty good

src/App.js Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @kidroca here, this change is accounting for an error that we haven't even encountered yet and it has larger implications than just catching potential initialization errors.

@zoontek
Copy link
Contributor Author

zoontek commented Dec 8, 2021

@NikkiWines I've taken your feedbacks 🙂

roryabraham
roryabraham previously approved these changes Dec 8, 2021
NikkiWines
NikkiWines previously approved these changes Dec 9, 2021
Copy link
Contributor

@NikkiWines NikkiWines left a comment

Choose a reason for hiding this comment

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

👍 Looks good

roryabraham
roryabraham previously approved these changes Dec 10, 2021
@NikkiWines
Copy link
Contributor

@zoontek this PR looks good but, unfortunately, the commits aren't signed so we're unable to merge this. Would you mind re-implementing the same changes in a new PR with signed commits? Sorry about that.

@roryabraham
Copy link
Contributor

@zoontek I think it might also be possible to retroactively sign your commits via rebase: https://webdevstudios.com/2020/05/26/retroactively-sign-git-commits/

@zoontek zoontek dismissed stale reviews from roryabraham and NikkiWines via 714e332 December 11, 2021 09:43
@zoontek
Copy link
Contributor Author

zoontek commented Dec 11, 2021

@NikkiWines @roryabraham Thanks for the article! I signed every commit. The reviews has been dismissed, it will need your approval again (sorry about that)

@NikkiWines
Copy link
Contributor

@zoontek looks like those commits are unverified

@zoontek
Copy link
Contributor Author

zoontek commented Dec 13, 2021

@zoontek looks like those commits are unverified

This is weird, they were two days ago 🤔. Maybe because I pushed unverified commits on another repos since. I will re-perform the operation tomorrow.

@kidroca
Copy link
Contributor

kidroca commented Dec 13, 2021

Maybe you changed your key or perhaps enabled some strict settings that makes it expire (or created a key that would expire?)
image

@zoontek
Copy link
Contributor Author

zoontek commented Dec 13, 2021

Maybe you changed your key or perhaps enabled some strict settings that makes it expire (or created a key that would expire?)
image

Ah yes, I disabled it after, I didn't know it will do that.

@zoontek
Copy link
Contributor Author

zoontek commented Dec 14, 2021

@NikkiWines @kidroca It's all good now, sorry about the inconvenience. It was my first time using GPG with git.

@roryabraham roryabraham merged commit 30e66c2 into Expensify:main Dec 14, 2021
@OSBotify
Copy link
Contributor

@zoontek, Great job getting your first Expensify/App pull request over the finish line! 🎉

I know there's a lot of information in our contributing guidelines, so here are some points to take note of 📝:

  1. Now that your first PR has been merged, you can be hired for another issue. Once you've completed a few issues, you may be eligible to work on more than one job at a time.
  2. Once your PR is deployed to our staging servers, it will undergo quality assurance (QA) testing. If we find that it doesn't work as expected or causes a regression, you'll be responsible for fixing it. Typically, we would revert this PR and give you another chance to create a similar PR without causing a regression.
  3. Once your PR is deployed to production, we start a 7-day timer ⏰. After it has been on production for 7 days without causing any regressions, then we pay out the Upwork job. 💰

So it might take a while before you're paid for your work, but we typically post multiple new jobs every day, so there's plenty of opportunity. I hope you've had a positive experience contributing to this repo! 😊

@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @roryabraham in version: 1.1.20-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Julesssss in version: 1.1.21-1 🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants