Woocommerce-ios: Launching the app in logged out state shows uninitialized tab bar UI first in iOS 14

Created on 6 Nov 2020  路  3Comments  路  Source: woocommerce/woocommerce-ios

Describe the bug

On iOS 14 sim/device, when launching the app in logged out state, an initialized tab bar UI is shown briefly before the authentication UI is shown.

To Reproduce

On an iOS 14 simulator or device:

  • Log out from the app
  • Close the app
  • Launch the app --> notice a split second of uninitialized tab bar UI before the login prologue is shown

Screenshots

Expected behavior

The authentication UI should be shown immediately after the launch screen.

Isolating the problem (mark completed items with an [x]):

  • [ ] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • [ ] This bug happens with a default WordPress theme active, or Storefront.
  • [x] I can reproduce this bug consistently using the steps above.

Mobile Environment
Please include:

  • Device: iPhone 11 sim / iPhone XR device
  • iOS version: iOS 14.0
  • WooCommerce iOS version: any
login bug

Most helpful comment

I came here to report and found this 馃榾.

Just noting that WPiOS also has a glitchy launch/splash animation https://github.com/wordpress-mobile/WordPress-iOS/issues/15399, so if the solution ends up being in a shared library, all the better.

For reference, WPiOS's issue is that the tab bar screen is visible for a split-second, which looks similar to what's happening here.

| Screenshot showing glitchy WordPress for iOS launch animation |
| - |

All 3 comments

I started looking into this issue, and it looks like presenting a view controller on launch always shows the presenting view controller (MainTabBarController in this case) briefly even without animation. This is somehow not noticeable/obvious before iOS 14 probably due to some internal app launch changes.

The SO discussions I've found suggest adding the launch screen to the presenting view controller as a subview, which feels quite hacky to me.

One interesting observation: if I replaced the login presentation with presenting a plain UIViewController from either the main app or WPAuthenticator, the flash somehow does not happen. There could be something in how the login UI is set up in WPAuthenticator that contributes to the delayed presentation like Storyboard, but it is certainly not an easy task to pull the view controllers from the Storyboard.

Instead of having MainTabBarController presenting the login view controller on launch, we can set the window's rootViewController to the login view controller so that there is no animation involved either. There are a few places that require changes:

  • WordPressAuthenticator's showLogin function currently performs the presentViewController, and we need to add another function to return the login view controller instead of "showing" it.
  • AppCoordinator now has to take in the app UIWindow from AppDelegate, and only replace the window's rootViewController when displaying the authenticator without animation. It also has to set the window's rootViewController back to MainTabBarController in logged in state.

I foresee extensive testing for this change, and I'll dig into implementation next week! With the app navigation encapsulated in AppCoordinator, it is a bit easier to make these changes with unit tests.

Instead of having MainTabBarController presenting the login view controller on launch, we can set the window's rootViewController to the login view controller so that there is no animation involved either. There are a few places that require changes:

I agree with this. If possible, I think it's much better if MainTabBarController does not exist in memory at all if the user is not logged in. Not sure what the repercussions are though. 馃槵

I came here to report and found this 馃榾.

Just noting that WPiOS also has a glitchy launch/splash animation https://github.com/wordpress-mobile/WordPress-iOS/issues/15399, so if the solution ends up being in a shared library, all the better.

For reference, WPiOS's issue is that the tab bar screen is visible for a split-second, which looks similar to what's happening here.

| Screenshot showing glitchy WordPress for iOS launch animation |
| - |

Was this page helpful?
0 / 5 - 0 ratings