Deleting the user¶
For your app's "delete my account" (GDPR's right to erasure, App Store guideline 5.1.1(v)), deleteRecipient erases the current user's recipient on the service: every device of theirs (this one and the others), the notifications sent to them and every event about them. It can't be undone.
Swift
switch await PlingBuddy.deleteRecipient() {
case .deleted: showAccountDeleted()
case .pending: showDeletionPending()
case .refused: showDeletionFailed()
}
- It answers how the first attempt ended:
.deleted: the device then forgets the user and their data, and is anonymous..pending: it couldn't be sent yet, for example offline. The SDK keeps trying, also after a relaunch..refused: the service won't delete it, or the device couldn't save the request. The user and their data stay as they were, the calls made meanwhile are applied, and the error reported to the error listener says why.
.pendingdoesn't promise the deletion will go through: a later attempt can still be refused, for example withidentity_verification_required, and that's reported to the error listener. Show the user that the deletion is pending, not that it's done.- Before the device's first unlock after a restart, the SDK can't read its state yet: the call then answers
.pendingand waits in memory until the unlock, so a restart before it loses the request. - A signed-in user can only be deleted when the application verifies identities (identity verification), since otherwise anyone who knows the external id could erase that user. Without it, the answer is
.refusedwithidentity_verification_required, and your backend has to erase the user another way. An anonymous user can always be deleted. - Calls made while the deletion is pending wait for it in memory and are applied after it. They aren't saved, so a relaunch before the deletion ends loses them; pass your user and data to
initializeat every launch, as usual. - The user's other devices aren't told: they register again with their next update, still signed in if your app keeps them so. Sign the user out there yourself.
- Erasing the user in your own backend is up to you; the SDK only erases what PlingBuddy holds.