JLPluginCookies
A Jasonelle plugin that stores a cookie string in Android encrypted storage and restores it into the web view.
Overview
JLPluginCookies keeps a single cookie string (e.g. session=abc; Path=/) in EncryptedSharedPreferences (backed by the Android Keystore via MasterKey) so it survives app restarts. JavaScript saves the current web view cookies with persist(), stores an explicit string with save(value), and restores them with restore(), which also injects the value into the web view’s cookies after the DOM has loaded.
Structure
| File | Role |
|---|---|
|
Native side – saves and reads the cookie string from |
|
JavaScript side – registers the plugin on |
How it works
-
The plugin is injected into the web view on page load and registers itself on
window.jasonelle.plugins.cookies. -
persist()captures the current cookies withdocument.cookieand stores them in encrypted preferences. -
save(value)stores an explicit cookie string in encrypted preferences. -
restore()reads the string from encrypted preferences and sets it viadocument.cookieonce the DOM is loaded, then resolves with the value.
Reference
-
com.jasonelle.kernel.Plugin– the base class this plugin extends. -
Plugin.jsinsrc/main/assets/plugins/cookies/– the JavaScript client, byte-identical to the Xcode plugin.