Skip to content

Commit

Permalink
If receive 404 error when loading show settings page.
Browse files Browse the repository at this point in the history
Closes #9
  • Loading branch information
CDrummond committed Mar 16, 2023
1 parent 609ba0a commit 8e22981
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions fastlane/metadata/android/en-US/changelogs/401.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Improved
Fixed

• Catch exceptions when launching PDF viewer.
• If receive 404 error when loading show settings page.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
Expand Down Expand Up @@ -592,6 +593,18 @@ public void onPageStarted(WebView view, String u, Bitmap favicon) {
super.onPageStarted(view, u, favicon);
}

@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
Log.d(TAG, "onReceivedHttpError url:" + request.getUrl() + ", mf:" + request.isForMainFrame() + ", sc:" + errorResponse.getStatusCode());
if (request.isForMainFrame() && 404== errorResponse.getStatusCode() && request.getUrl().toString().equals(getConfiguredUrl())) {
pageError = true;
//discoverServer(false);
pageLoadHandler.removeCallbacks(pageLoadTimeout);
navigateToSettingsActivity();
}
super.onReceivedHttpError(view, request, errorResponse);
}

@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Expand Down

0 comments on commit 8e22981

Please sign in to comment.