Direction-aware default for deletion behaviour (don't wipe backups)
Build & Release APK / build (push) Successful in 12m54s
Build & Release APK / build (push) Successful in 12m54s
The Add-Pair screen defaulted deleteBehavior to MIRROR for every direction, so an Upload-only backup would delete cloud files when you deleted them on the phone. Now the default follows the direction: - Upload-only / Download-only -> KEEP (deleting locally leaves the cloud copy) - Two-way -> MIRROR All three options remain selectable; once the user explicitly picks one, changing direction no longer overrides it, and editing a saved pair keeps its stored choice. Adds RecommendedDeleteBehaviorTest.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package com.syncflow.ui.addpair
|
||||
|
||||
import com.syncflow.domain.model.DeleteBehavior
|
||||
import com.syncflow.domain.model.SyncDirection
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* The Add-Pair screen's default deletion behaviour must never wipe a backup. One-way directions
|
||||
* default to KEEP so deleting a file on the phone leaves the cloud copy intact; two-way defaults
|
||||
* to MIRROR. (The user can still override to any of the three options.)
|
||||
*/
|
||||
class RecommendedDeleteBehaviorTest {
|
||||
|
||||
@Test fun `upload-only defaults to KEEP so backups are never deleted`() =
|
||||
assertEquals(DeleteBehavior.KEEP, recommendedDeleteBehavior(SyncDirection.UPLOAD_ONLY))
|
||||
|
||||
@Test fun `download-only defaults to KEEP`() =
|
||||
assertEquals(DeleteBehavior.KEEP, recommendedDeleteBehavior(SyncDirection.DOWNLOAD_ONLY))
|
||||
|
||||
@Test fun `two-way defaults to MIRROR`() =
|
||||
assertEquals(DeleteBehavior.MIRROR, recommendedDeleteBehavior(SyncDirection.TWO_WAY))
|
||||
}
|
||||
Reference in New Issue
Block a user