remove mmkv cookie storage, use native cookie storage (cloudflare)#888
remove mmkv cookie storage, use native cookie storage (cloudflare)#888nguyd1 wants to merge 3 commits intolnreader:mainfrom
Conversation
|
It's not true, you still have to provide headers to make network request. |
|
Plus, If Android couldstore the cookies it self and cookies are persisted (as the link), users just need to open source web in Chrome or any browser, then back to the app and they should have cookies stored in device, no need to open webview in app. |
i think this is possible if we use sharedCookiesEnabled on the webview component but ill have to test it out update: researched this and i think the native cookie storage is per each app and not centralized which makes sense for privacy, also even if they were centralized then the user agents would not match between browser and lnreader which is required for the cloudflare cf_clearance cookie to work |
|
this is the commit that adds a persistent cookie storage and shares cookies between the webview and the react app |
|
Confirmed. React Native helps us to add Cookie if not provided in headers. |
|
We are also sending the cookie from MMKV in FastImage's headers. We should also remove them if they're working as expected. Also thanks for you recent contributions. 🎉 |
|
#896 new pr i accidentally closed this and cant reopen it |
fetch on react native is made by the native networking stack so the cookie is stored in the device itself, no need for mmkv storage: https://stackoverflow.com/questions/41132167/react-native-fetch-cookie-persist
android syncs the cookies every 5 min, if the app is killed during that time, the cookies will be lost and cloudflare will trigger again, we can fix this by using CookieManager.flush() to force cookie sync when the nav state changes on webview (occurs when cloudflare passes and navigates to website)
the old implementation in useEffect was not storing any cookies because it is called right when webview opens and tries to obtain cookies before cloudflare ran, we needed to wait 5-10 seconds for the cloudflare pass to obtain the cf_clearance cookie and write to mmkv source storage