diff --git a/changelog.d/819.feature b/changelog.d/819.feature new file mode 100644 index 0000000000..181469d5a0 --- /dev/null +++ b/changelog.d/819.feature @@ -0,0 +1 @@ +Permettre les captures d'écran en mode développement #819 diff --git a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt index dbf469e346..304474c00c 100644 --- a/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/app/core/platform/VectorBaseActivity.kt @@ -233,7 +233,9 @@ abstract class VectorBaseActivity : 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) } diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt index 47152dc577..4f89097f91 100755 --- a/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorPreferences.kt @@ -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 @@ -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)