Skip to content

Commit

Permalink
Try to fix error in new tab - web page - library backing loop
Browse files Browse the repository at this point in the history
  • Loading branch information
haanhvu committed Nov 30, 2024
1 parent 7050cf5 commit 0bab028
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,8 @@ private void showPanel(Windows.ContentType contentType, boolean switchSurface) {
}
};
}
} else if (mView == mLibrary) {
mLibrary.selectPanel(contentType);
}
}

Expand Down Expand Up @@ -582,14 +584,15 @@ private void hidePanel(boolean switchSurface) {
if (mView != null && mLibrary != null) {
unsetView(mLibrary, switchSurface);
mLibrary.onHide();
mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT);
}
if (switchSurface && mRestoreFirstPaint != null) {
mRestoreFirstPaint.run();
mRestoreFirstPaint = null;
}
if (mViewModel.getBackToNewTabEnabled().getValue().get()) {
showNewTab();
} else {
mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT);
}
}

Expand Down Expand Up @@ -2049,23 +2052,24 @@ WResult<WAllowOrDeny> onLoadRequest(WSession aSession, @NonNull LoadRequest aReq
Uri uri = Uri.parse(aRequest.uri);
if (UrlUtils.isAboutPage(uri.toString())) {
if(UrlUtils.isBookmarksUrl(uri.toString())) {
hideNewTab(true);
hideNewTab();
showPanel(Windows.ContentType.BOOKMARKS);

} else if (UrlUtils.isHistoryUrl(uri.toString())) {
hideNewTab(true);
hideNewTab();
showPanel(Windows.ContentType.HISTORY);

} else if (UrlUtils.isDownloadsUrl(uri.toString())) {
hideNewTab(true);
hideNewTab();
showPanel(Windows.ContentType.DOWNLOADS);

} else if (UrlUtils.isAddonsUrl(uri.toString())) {
hideNewTab(true);
hideNewTab();
showPanel(Windows.ContentType.ADDONS);

} else if (UrlUtils.isNewTabUrl(uri.toString())) {
showNewTab();
hideLibraryPanel();
showNewTab();

} else {
hideNewTab();
Expand All @@ -2075,6 +2079,8 @@ WResult<WAllowOrDeny> onLoadRequest(WSession aSession, @NonNull LoadRequest aReq
} else {
hideNewTab();
hideLibraryPanel();
mViewModel.setCurrentContentType(Windows.ContentType.WEB_CONTENT);
mViewModel.setUrl(uri.toString());
}

if ("file".equalsIgnoreCase(uri.getScheme())) {
Expand Down

0 comments on commit 0bab028

Please sign in to comment.