imperiumlabs / GeoFirestore-Android

GeoFirestore for Android - Realtime location queries with Firestore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in setLocation README documentation

betegon opened this issue · comments

This is the setLocation function (copypaste) from GeoFirestore.kt

fun setLocation(documentID: String?, location: GeoPoint, completionCallback: CompletionCallback?) {
    if (documentID == null) {
        completionCallback?.onComplete(NullPointerException("Document ID is null"))
        return
    }
    //Get the DocumentReference for this documentID
    val docRef = this.getRefForDocumentID(documentID)
    val geoHash = GeoHash(GeoLocation(location.latitude, location.longitude))
    //Create a Map with the fields to add
    val updates = HashMap<String, Any>()
    updates["g"] = geoHash.geoHashString
    updates["l"] = location
    //Update the DocumentReference with the location data
    docRef.set(updates, SetOptions.merge())
        .addOnSuccessListener { completionCallback?.onComplete(null) }
        .addOnFailureListener { completionCallback?.onComplete(it) }
} 

As you can see on the last lines:

.addOnSuccessListener { completionCallback?.onComplete(null) }
.addOnFailureListener { completionCallback?.onComplete(it) }

This should return null if the function is completed successfully, therefore, in the README appears the following (screenshot below):

image

This is wrong, as if it was successfully, exception will be null. It should be the other way around.

Do you accept Pull requests?

Closing issue as it is fixed by my pull request #44 (already merged).