0

I am using Swift 4. I am deleting the users from Firebase console manually and want to know, how can I inform the users about the backend changes that I make like disabling, deleting a user. How will the user know?

Of course, the user will not be able to log in, but is there any better way around to inform the users?

Pooja Gupta
  • 739
  • 9
  • 21
Rob
  • 1,858
  • 17
  • 25

2 Answers2

1

This sounds like a XY problem though: what are you trying to accomplish by deleting their account?

There is no event that is triggered when you delete a user account. Deleting user accounts should be very rare, because it doesn't really accomplish anything. Next time someone signs in with the same credentials, it will just create a new account for them.

If you're trying to prevent the user from accessing specific backend resources, then you should probably add a flag (e.g. `disabled: true) to their profile, or keep a list of "banned UIDs" in your database. For an example of this, see:

Frank van Puffelen
  • 499,950
  • 69
  • 739
  • 734
0

You can add an observer to the userID in firebase , if at any point in time the dictionary data of it is nil , then it's deleted

    userContentsRef =   self.ref.child("users/\(userID)")

    userContentsRef .observe(FIRDataEventType.value, with: { (snapshot) in

        let value = snapshot.value as? NSDictionary

        if(value == nil)
        {
          print("user deleted")
        }

     })
Sh_Khan
  • 93,445
  • 7
  • 57
  • 76