Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
<string name="profile__create_nav_title">Create Profile</string>
<string name="profile__create_restoring">Restoring your existing profile…</string>
<string name="profile__create_success">Profile created successfully</string>
<string name="profile__delete_confirm_description">Are you sure you want to delete all of your profile information for your pubky?</string>
<string name="profile__delete_confirm_description">Deleting your profile removes it from Pubky. Contacts may still retain profile and payment information previously shared with them.</string>
<string name="profile__delete_confirm_title">Delete Profile?</string>
<string name="profile__delete_error_description">We couldn\'t delete your profile data. Retry, or disconnect this pubky from Bitkit.</string>
<string name="profile__delete_error_title">Unable to Delete Profile</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changelog.d/next/1108.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed profile deletion being blocked when private Paykit contact cleanup could not complete.
Loading