From 3e38b305324e8539b0b73244949a25a3cf260815 Mon Sep 17 00:00:00 2001 From: benk10 Date: Fri, 24 Jul 2026 11:10:25 +0200 Subject: [PATCH 1/2] fix: allow terminal profile deletion --- .../ui/screens/profile/EditProfileViewModel.kt | 12 +----------- app/src/main/res/values/strings.xml | 2 +- .../profile/EditProfileViewModelTest.kt | 18 ++++++++++++------ changelog.d/next/970.fixed.md | 1 + 4 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 changelog.d/next/970.fixed.md diff --git a/app/src/main/java/to/bitkit/ui/screens/profile/EditProfileViewModel.kt b/app/src/main/java/to/bitkit/ui/screens/profile/EditProfileViewModel.kt index 5b4b6e185..fdd2ebb36 100644 --- a/app/src/main/java/to/bitkit/ui/screens/profile/EditProfileViewModel.kt +++ b/app/src/main/java/to/bitkit/ui/screens/profile/EditProfileViewModel.kt @@ -267,17 +267,7 @@ class EditProfileViewModel @Inject constructor( isSaving = true, ) } - val cleanupResult = privatePaykitRepo.removePublishedEndpointsForCleanup(TAG) - if (cleanupResult.isFailure) { - _uiState.update { - it.copy( - isSaving = false, - showDeleteFailureDialog = true, - ) - } - return - } - + privatePaykitRepo.removePublishedEndpointsForCleanup(TAG) val result = pubkyRepo.deleteProfileWithSessionRetry() if (result.isSuccess) { privatePaykitRepo.closeAndClear() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 98d83f888..17c003c37 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -586,7 +586,7 @@ Create Profile Restoring your existing profile… Profile created successfully - Are you sure you want to delete all of your profile information for your pubky? + Deleting your profile removes it from Pubky. Contacts may still retain profile and payment information previously shared with them. Delete Profile? We couldn\'t delete your profile data. Retry, or disconnect this pubky from Bitkit. Unable to Delete Profile diff --git a/app/src/test/java/to/bitkit/ui/screens/profile/EditProfileViewModelTest.kt b/app/src/test/java/to/bitkit/ui/screens/profile/EditProfileViewModelTest.kt index 47f3fb95a..f4ed9db70 100644 --- a/app/src/test/java/to/bitkit/ui/screens/profile/EditProfileViewModelTest.kt +++ b/app/src/test/java/to/bitkit/ui/screens/profile/EditProfileViewModelTest.kt @@ -159,20 +159,26 @@ class EditProfileViewModelTest : BaseUnitTest() { } @Test - fun `deleteProfile should stop when private cleanup fails`() = test { + fun `deleteProfile should continue when private cleanup fails`() = test { val sut = createSut() whenever { privatePaykitRepo.removePublishedEndpointsForCleanup(any()) } .thenReturn(Result.failure(TestAppError("cleanup failed"))) whenever(pubkyRepo.deleteProfileWithSessionRetry()).thenReturn(Result.success(Unit)) advanceUntilIdle() - sut.deleteProfile() - advanceUntilIdle() + sut.effects.test { + sut.deleteProfile() + advanceUntilIdle() - assertTrue(sut.uiState.value.showDeleteFailureDialog) + assertEquals(EditProfileEffect.DeleteSuccess, awaitItem()) + } + assertFalse(sut.uiState.value.showDeleteFailureDialog) assertFalse(sut.uiState.value.isSaving) - verify(pubkyRepo, never()).deleteProfileWithSessionRetry() - verify(privatePaykitRepo, never()).closeAndClear() + inOrder(privatePaykitRepo, pubkyRepo).apply { + verify(privatePaykitRepo).removePublishedEndpointsForCleanup(any()) + verify(pubkyRepo).deleteProfileWithSessionRetry() + verify(privatePaykitRepo).closeAndClear() + } } @Test diff --git a/changelog.d/next/970.fixed.md b/changelog.d/next/970.fixed.md new file mode 100644 index 000000000..13b1beb5d --- /dev/null +++ b/changelog.d/next/970.fixed.md @@ -0,0 +1 @@ +Fixed profile deletion being blocked when private Paykit contact cleanup could not complete. From d613bed73b1a74984708ca5fe7bc6e99c194c9cb Mon Sep 17 00:00:00 2001 From: benk10 Date: Fri, 24 Jul 2026 11:16:28 +0200 Subject: [PATCH 2/2] chore: rename changelog fragment --- changelog.d/next/{970.fixed.md => 1108.fixed.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/next/{970.fixed.md => 1108.fixed.md} (100%) diff --git a/changelog.d/next/970.fixed.md b/changelog.d/next/1108.fixed.md similarity index 100% rename from changelog.d/next/970.fixed.md rename to changelog.d/next/1108.fixed.md