geekdroid-firebase: deprecate a few classes, remove old deprecated
authorDa Risk <da_risk@geekorum.com>
Sun, 07 May 2023 01:49:30 -0400
changeset 49 7dfdcb053a3e
parent 48 dbc8db072d7f
child 50 2ca8d2420590
geekdroid-firebase: deprecate a few classes, remove old deprecated
geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/Tasks.kt
geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/firestore/Firestore.kt
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/Tasks.kt	Sun May 07 01:46:40 2023 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Geekdroid is a utility library for development on the Android
- * Platform.
- *
- * Copyright (C) 2017-2023 by Frederic-Charles Barthelery.
- *
- * This file is part of Geekdroid.
- *
- * Geekdroid is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Geekdroid is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Geekdroid.  If not, see <http://www.gnu.org/licenses/>.
- */
-package com.geekorum.geekdroid.firebase
-
-import kotlinx.coroutines.tasks.await
-import com.google.android.gms.tasks.Task
-
-/**
- * Await for the result of a [Task]
- */
-@Deprecated("Moved to gms package", ReplaceWith("await()", "com.geekorum.geekdroid.gms.await"))
-suspend fun <T> Task<T>.await(): T = await()
--- a/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/firestore/Firestore.kt	Sun May 07 01:46:40 2023 -0400
+++ b/geekdroid-firebase/src/main/java/com/geekorum/geekdroid/firebase/firestore/Firestore.kt	Sun May 07 01:49:30 2023 -0400
@@ -33,7 +33,7 @@
 import kotlinx.coroutines.tasks.await
 import timber.log.Timber
 
-
+@Deprecated("Use coroutine flows")
 class FirestoreQueryLiveData<T> constructor(
     private val query: Query,
     private val clazz: Class<T>
@@ -59,13 +59,16 @@
     }
 }
 
+@Deprecated("Use coroutine flows")
 inline fun <reified T> Query.toLiveData() : LiveData<List<T>> =
     FirestoreQueryLiveData(this)
 
+@Deprecated("Use coroutine flows")
 inline fun <reified T> FirestoreQueryLiveData(query: Query): FirestoreQueryLiveData<T> {
     return FirestoreQueryLiveData(query, T::class.java)
 }
 
+@Deprecated("Use coroutine flows")
 class FirestoreDocumentLiveData<T>(
     private val document: DocumentReference,
     private val clazz: Class<T>
@@ -90,19 +93,15 @@
     }
 }
 
+@Deprecated("Use coroutine flows")
 inline fun <reified T> DocumentReference.toLiveData(): LiveData<T?> =
     FirestoreDocumentLiveData(this)
 
+@Deprecated("Use coroutine flows")
 inline fun <reified T> FirestoreDocumentLiveData(document: DocumentReference): FirestoreDocumentLiveData<T> {
     return FirestoreDocumentLiveData(document, T::class.java)
 }
 
-@Deprecated("Use firebase-firestore-ktx", ReplaceWith("toObject()", imports = ["com.google.firebase.firestore.ktx.toObject"]))
-inline fun <reified T> DocumentSnapshot.toObject(): T? = toObject()
-
-@Deprecated("Use firebase-firestore-ktx", ReplaceWith("toObjects()", imports = ["com.google.firebase.firestore.ktx.toObjects"]))
-inline fun <reified T: Any> QuerySnapshot.toObjects(): List<T> = toObjects()
-
 /* suspend version of get(), set(), update(), delete() */
 suspend fun DocumentReference.aSet(pojo: Any): Void = set(pojo).await()
 suspend fun DocumentReference.aUpdate(data: Map<String, Any>): Void = update(data).await()