Skip to content

Commit

Permalink
Merge pull request #184 from learningequality/persist_cookies
Browse files Browse the repository at this point in the history
Persist cookies
  • Loading branch information
rtibbles authored Jan 3, 2024
2 parents b95191c + f1735e6 commit 8243c72
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {

@Override
public void onPageFinished(WebView view, String url) {
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().acceptCookie();
CookieManager.getInstance().flush();

}
});
mLayout = new AbsoluteLayout(PythonActivity.mActivity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void onDestroy() {
@Override
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);
//sticky servcie runtime/restart is managed by the OS. leave it running when app is closed
//sticky service runtime/restart is managed by the OS. leave it running when app is closed
if (startType() != START_STICKY) {
stopSelf();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
Expand Down Expand Up @@ -30,7 +31,18 @@ public static void configureWebview(PythonActivity activity) {
// Configure the WebView to allow fullscreen based on:
// https://stackoverflow.com/questions/15768837/playing-html5-video-on-fullscreen-in-android-webview/56186877#56186877
public void configure() {
mWebView.setWebViewClient(new WebViewClient());
mWebView.setWebViewClient(new WebViewClient() {

@Override
public void onPageFinished(WebView view, String url) {
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().acceptCookie();
CookieManager.getInstance().flush();

}


});
mWebView.setWebChromeClient(mChrome);
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
Expand Down

0 comments on commit 8243c72

Please sign in to comment.