From 7c42f2fbd1361fa4b6c02b3e34943f2041931321 Mon Sep 17 00:00:00 2001 From: Lukas Barragan Torres Date: Tue, 18 Apr 2023 16:03:22 +0200 Subject: [PATCH] added firebase collection routes to object --- .../domain/implementation/FireBaseSessionDAO.kt | 9 ++------- .../domain/implementation/FirebaseCollectionRoutes.kt | 8 ++++++++ .../studeez/domain/implementation/FirebaseTimerDAO.kt | 10 ++-------- .../be/ugent/sel/studeez/screens/home/HomeViewModel.kt | 2 -- 4 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseCollectionRoutes.kt diff --git a/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FireBaseSessionDAO.kt b/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FireBaseSessionDAO.kt index 1fbe2cb..07afdda 100644 --- a/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FireBaseSessionDAO.kt +++ b/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FireBaseSessionDAO.kt @@ -31,13 +31,8 @@ class FireBaseSessionDAO @Inject constructor( } private fun currentUserSessionsCollection(): CollectionReference = - firestore.collection(USER_COLLECTION) + firestore.collection(FirebaseCollectionRoutes.USER_COLLECTION) .document(auth.currentUserId) - .collection(SESSION_COLLECTION) - - companion object { - private const val SESSION_COLLECTION = "sessions" - private const val USER_COLLECTION = "users" - } + .collection(FirebaseCollectionRoutes.SESSION_COLLECTION) } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseCollectionRoutes.kt b/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseCollectionRoutes.kt new file mode 100644 index 0000000..2471301 --- /dev/null +++ b/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseCollectionRoutes.kt @@ -0,0 +1,8 @@ +package be.ugent.sel.studeez.domain.implementation + +object FirebaseCollectionRoutes { + const val SESSION_COLLECTION = "sessions" + const val USER_COLLECTION = "users" + const val TIMER_COLLECTION = "timers" + +} \ No newline at end of file diff --git a/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseTimerDAO.kt b/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseTimerDAO.kt index a25c37c..901f9d6 100644 --- a/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseTimerDAO.kt +++ b/app/src/main/java/be/ugent/sel/studeez/domain/implementation/FirebaseTimerDAO.kt @@ -50,14 +50,8 @@ class FirebaseTimerDAO @Inject constructor( } private fun currentUserTimersCollection(): CollectionReference = - firestore.collection(USER_COLLECTION) + firestore.collection(FirebaseCollectionRoutes.USER_COLLECTION) .document(auth.currentUserId) - .collection(TIMER_COLLECTION) - - - companion object { - private const val TIMER_COLLECTION = "timers" - private const val USER_COLLECTION = "users" - } + .collection(FirebaseCollectionRoutes.TIMER_COLLECTION) } \ No newline at end of file diff --git a/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeViewModel.kt b/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeViewModel.kt index 7db6f8d..b27f995 100644 --- a/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeViewModel.kt +++ b/app/src/main/java/be/ugent/sel/studeez/screens/home/HomeViewModel.kt @@ -3,8 +3,6 @@ package be.ugent.sel.studeez.screens.home import be.ugent.sel.studeez.domain.AccountDAO import be.ugent.sel.studeez.domain.LogService import be.ugent.sel.studeez.navigation.StudeezDestinations -import be.ugent.sel.studeez.navigation.StudeezDestinations.HOME_SCREEN -import be.ugent.sel.studeez.navigation.StudeezDestinations.LOGIN_SCREEN import be.ugent.sel.studeez.screens.StudeezViewModel import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject