Created
March 30, 2021 12:01
-
-
Save derysudrajat/930a1c63282b35ba45179e322f281c32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun forgetPassword(email: String, isSuccess: (Boolean, message: String) -> Unit) { | |
Firebase.auth.sendPasswordResetEmail(email) | |
.addOnCompleteListener { | |
if (it.isSuccessful) isSuccess(true, "Berhasil Dikirim") | |
else isSuccess(false, DataHelpers.errorLoginMessage[it.exception?.message] ?: "") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getGroupingChat(uid: String, onResult: (List<GroupChat>) -> Unit) { | |
Firestore.instance.collection(COLLECTION.CHAT_GROUP) | |
.whereEqualTo("to", uid) | |
.orderBy("time", Query.Direction.DESCENDING) | |
.addSnapshotListener { value, error -> | |
if (error != null) Log.d(TAG, "getGroupingChat:error = ${error.message}") | |
if (value != null && !value.isEmpty) { | |
onResult(value.toObjects(GroupChat::class.java)) | |
} else { | |
onResult(listOf()) | |
Log.d(TAG, "getGroupingChat:failed = ${error?.message}") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment