Skip to content

Commit

Permalink
Update secure flag (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle authored Oct 19, 2023
1 parent afd0528 commit 5aa86fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
}

// Set flag FLAG_SECURE
// Tchap: handle differently screenshot authorization not relying on Preferences flag SETTINGS_SECURITY_USE_FLAG_SECURE
// if (vectorPreferences.useFlagSecure()) {
if (!vectorPreferences.tchapAllowedScreenshot()) {
if (vectorPreferences.useFlagSecure()) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,27 +993,8 @@ class VectorPreferences @Inject constructor(
* The user does not allow screenshots of the application.
*/
fun useFlagSecure(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_SECURITY_USE_FLAG_SECURE, true)
}

// Tchap
/**
* Screenshot is not allowed for Tchap F-droid version.
* It is allowed for Tchap GPlay version only for DEV and Pre-Prod versions.
* It is not allowed for Tchap GPlay Tchap (Production) version.
*/
fun tchapAllowedScreenshot(): Boolean {
return when (BuildConfig.FLAVOR_store.lowercase()) {
"fdroid" -> false
"gplay" -> {
when (BuildConfig.FLAVOR_target.lowercase()) {
"devtchap" -> true
"btchap" -> true
else -> false
}
}
else -> false
}
// Tchap: Screenshot is allowed for Gplay Pre-prod and Dev versions only.
return BuildConfig.FLAVOR_store != "gplay" || BuildConfig.FLAVOR_target == "tchap"
}

/** Whether the keyboard should disable personalized learning. */
Expand Down

0 comments on commit 5aa86fe

Please sign in to comment.