Skip to content

Commit

Permalink
Disable reading mode when incognito
Browse files Browse the repository at this point in the history
Also disable share, print, and add to home as security feature.
Close #369.
  • Loading branch information
Slion committed Sep 30, 2023
1 parent f33616f commit 920864d
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions app/src/main/java/acr/browser/lightning/browser/MenuWebPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class MenuWebPage : PopupWindow {
val abpUserRules: AbpUserRules

var iBinding: MenuWebPageBinding
var iIsIncognito = false

constructor(layoutInflater: LayoutInflater, aBinding: MenuWebPageBinding = MenuWebPage.inflate(layoutInflater))
: super(aBinding.root, WRAP_CONTENT, WRAP_CONTENT, true) {
Expand All @@ -73,17 +72,6 @@ class MenuWebPage : PopupWindow {
// See: https://stackoverflow.com/questions/46872634/close-popupwindow-upon-tapping-outside-or-back-button
setBackgroundDrawable(ColorDrawable())

// Hide incognito menu item if we are already incognito
/*
iIsIncognito = (aBinding.root.context as BrowserActivity).isIncognito()
if (iIsIncognito) {
aBinding.menuItemIncognito.isVisible = false
// No sessions in incognito mode
aBinding.menuItemSessions.isVisible = false
}
*/

//val radius: Float = getResources().getDimension(R.dimen.default_corner_radius) //32dp

//iBinding.layoutMenuItems.layoutTransition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING)
Expand Down Expand Up @@ -176,6 +164,17 @@ class MenuWebPage : PopupWindow {
}
}

if ((iBinding.root.context as? BrowserActivity)?.isIncognito() == true) {
// Incognito only works for that activity
// So no reader mode as it starts another activity
// TODO: We could try get reading mode working in incognito by creating another activity which starts in the same process I guess
iBinding.menuItemReaderMode.isVisible = false
// Also hide share and print as security feature when in incognito mode
iBinding.menuItemShare.isVisible = false
iBinding.menuItemPrint.isVisible = false
iBinding.menuItemAddToHome.isVisible = false
}

scrollToStart()
}

Expand Down

0 comments on commit 920864d

Please sign in to comment.