Daniel
12/13/2022, 9:55 PMsuspend fun doLogout(token: String) {
val userId = appService.currentUser!!.id
realm.write {
var user = query<UserInfo>("_id = $0", userId).first().find()
if (user != null) {
user = findLatest(user)!!.also {
it.FCMToken.remove(token)
}
copyToRealm(user)
}
}
withContext(Dispatchers.Default) {
appService.currentUser?.logOut()
}
}
the way that I call on the swiftUI:
func doLogout(){
repo.doLogout(token: myFCMToken){error in
}
}
Evegenii Khokhlov
12/14/2022, 6:30 AM