Add screen capture protection (#292)

Co-authored-by: Rahul Sharma <rahul.shwork@gmail.com>
This commit is contained in:
Aryan 2026-05-10 10:18:48 +05:30 committed by GitHub
parent 8366d76dcd
commit 6897496423
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 77 additions and 2 deletions

View file

@ -319,6 +319,25 @@ class MainViewModelTest {
verify { mockEditor.putString("external_file_behavior", "KEEP") }
}
@Test
fun `screen capture protection persists and updates state`() = runTest {
backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) {
viewModel.uiState.collect {}
}
viewModel.setScreenCaptureProtectionEnabled(true)
val enabledState = viewModel.uiState.first { it.isScreenCaptureProtectionEnabled }
assertTrue(enabledState.isScreenCaptureProtectionEnabled)
verify { mockEditor.putBoolean("screen_capture_protection_enabled", true) }
viewModel.setScreenCaptureProtectionEnabled(false)
val disabledState = viewModel.uiState.first { !it.isScreenCaptureProtectionEnabled }
assertFalse(disabledState.isScreenCaptureProtectionEnabled)
verify { mockEditor.putBoolean("screen_capture_protection_enabled", false) }
}
@Test
fun `setSortOrder persists preference and reorders visible home and library lists`() = runTest {
backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) {