2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00
* For https://github.com/mozilla-mobile/fenix/issues/9987: Add extension to secures dialog if parent activity is secured

* For https://github.com/mozilla-mobile/fenix/issues/9987: Set FLAG_SECURE to dialog when flag set in activity
This commit is contained in:
Mihai Adrian 2020-04-17 06:33:57 +03:00 committed by GitHub
parent a384ea16d0
commit b510210dce
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.ext
import android.app.Activity
import android.app.Dialog
import android.view.WindowManager
/**
* Checks if activity's window has a FLAG_SECURE set and sets it to dialog
*/
fun Dialog.secure(activity: Activity?) {
this.window.apply {
val flags = activity?.window?.attributes?.flags
if (flags != null && flags and WindowManager.LayoutParams.FLAG_SECURE != 0) {
this?.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
)
}
}
}

View File

@ -42,6 +42,7 @@ import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.secure
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar import org.mozilla.fenix.ext.showToolbar
@ -240,7 +241,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
startActivity(intent) startActivity(intent)
} }
create() create()
}.show() }.show().secure(activity)
it.settings().incrementShowLoginsSecureWarningSyncCount() it.settings().incrementShowLoginsSecureWarningSyncCount()
} }
} }