Create model classes for Firestore documents to eliminate getting resources from raw string references. This enables us to be more flexible when handling data transactions.
Current code:
val pathSnapshotListener = firestore
.collection(PathsCollectionPath)
.whereEqualTo("ownerUUID", authInteractor.userUUID)
.addSnapshotListener { pathSnapshot, pathError ->
if (pathError != null) {
Timber.e(pathError, "Error while deleting user data: ${pathError.message}")
} else if (!arePathsDeleted.value) {
Timber.d("Delete ${pathSnapshot!!.documents.size} path data for user ${authInteractor.userUUID?.take(4)}")
pathSnapshot.documents.forEach {
it.reference.delete()
}
arePathsDeleted.value = true
}
}
New code should try to eliminate using raw strings, like "ownerUUID" and PathsCollectionPath.
Create model classes for
Firestore
documents to eliminate getting resources from raw string references. This enables us to be more flexible when handling data transactions.Current code:
New code should try to eliminate using raw strings, like
"ownerUUID"
andPathsCollectionPath
.