Open weibel opened 1 month ago
@YuriyVelichkoPI In this comment, I mentioned persisting the user agent string keyed by the OS version. This PR is my take on an implementation. It will save the time of initializing a WKWebView and running the JavaScript on most app starts.
Motivation
The creation of a WKWebView and subsequent execution of javascript to get a proper user agent string on app startup counts negatively against the app startup time. Depending on iOS version and device it can be in the hundreds of milliseconds. Since the user agent string only changes on iOS updates it's a good candidate for persistence between app starts
Summary
This pull request introduces the UserAgentDefaults class to manage the persistence of user agent strings within the application. The UserAgentService has been updated to utilize this new class, ensuring that user agents are efficiently stored and retrieved from UserDefaults.
Key Changes
UserAgentDefaults Class
UserAgentService Updates