Skip to content

Commit

Permalink
Merge pull request #933 from tchapgouv/819-capture-d-ecran-sur-android
Browse files Browse the repository at this point in the history
Permettre les captures d'écran en mode développement
  • Loading branch information
NicolasBuquet committed Jun 22, 2023
2 parents 70e4c3c + dab8e70 commit b346e75
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/819.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Permettre les captures d'écran en mode développement #819
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.provider.MediaStore
import androidx.annotation.BoolRes
import androidx.core.content.edit
import com.squareup.seismic.ShakeDetector
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.config.Config
import im.vector.app.core.di.DefaultPreferences
Expand Down Expand Up @@ -996,6 +997,26 @@ class VectorPreferences @Inject constructor(
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
}
}

/** Whether the keyboard should disable personalized learning. */
fun useIncognitoKeyboard(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_SECURITY_INCOGNITO_KEYBOARD_PREFERENCE_KEY, false)
Expand Down

0 comments on commit b346e75

Please sign in to comment.