Our in-app web view doesn't set our URLSession authentication cookies, resulting in the user seeing a logged out state when pushing to an in-app web view. This could cause a poor experience for any links to pages that we don't support natively, like non-main namespaces.
We should sync our URLSession authentication cookies with our in-app web views (i.e. the web view in SinglePageWebViewController):
override func viewDidLoad() { let cookies = Session.sharedCookieStorage.cookies ?? [] for (cookie) in cookies { webView.configuration.websiteDataStore.httpCookieStore .setCookie(cookie) } ...
Testing Notes
- Log in via app settings.
- Go to an in-app web view. One example is article history > diff > tap username button > user page.
- In mobile web view, tap the "Desktop" button at the bottom. Confirm you see logged in username in the top right corner of the desktop view.
- Log out via app settings.
- Repeat steps 2-3. This time confirm user is NOT logged in in Desktop web view.