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
  • 785
  • 10
  • 22
Rob
  • 2,086
  • 18
  • 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
  • 565,676
  • 79
  • 828
  • 807
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")
        }

     })
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87