aslanyanhaik / Quick-Chat

Real time chat app written in Swift 5 using Firebase
MIT License
1.84k stars 360 forks source link

Update Users Profile Icon and name #75

Open andrewga opened 5 years ago

andrewga commented 5 years ago

Is it possible to update the users profile Icon and username?

aslanyanhaik commented 5 years ago

@andrewga I'm planning to add that feature in near future

StellarKuldeep commented 5 years ago

@andrewga & @aslanyanhaik , I have tried below code to update user profile icon & username and it works.

UPDATE

func updateUserDetail(strUpdateName: String, strProfileURL: String) {
        let ref = Firestore.firestore().collection("Users")
        ref.document(UserManager().currentUserID() ?? "").updateData(["name": strUpdateName, "profilePicLink": strProfileURL]) { (err) in
            if let err = err {
                print("Error updating document: \(err)")
            } else {
                print("Document successfully updated")
            }
        }
    }