diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/classes/HomepageViewModel.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/classes/HomepageViewModel.kt index e6472daa..50f0c7b9 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/classes/HomepageViewModel.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/classes/HomepageViewModel.kt @@ -55,6 +55,8 @@ class HomepageViewModel : HomepageDataModel, ViewModel() { for (i in 0 until NUM_CELLS) { if (prevList[i] != homepageCells[i]) { update(i) + } else { + Log.i("CellUpdates", "saved an update") } } callback.invoke() @@ -77,6 +79,7 @@ class HomepageViewModel : HomepageDataModel, ViewModel() { latch.await() } else { val latch = CountDownLatch(2) + clearLoggedIn() getCalendar(studentLife, latch) getNews(studentLife, latch) latch.await() @@ -90,6 +93,15 @@ class HomepageViewModel : HomepageDataModel, ViewModel() { } } + private fun clearLoggedIn() { + addCell(HomeCell2(), POLL_POS) + addCell(HomeCell2(), LAUNDRY_POS) + addCell(HomeCell2(), POST_POS) + addCell(HomeCell2(), DINING_POS) + + setPostBlurView(true) + } + private fun getPolls(studentLife: StudentLife, bearerToken: String, deviceID: String, latch: CountDownLatch) { val idHash = getSha256Hash(deviceID) @@ -227,11 +239,13 @@ class HomepageViewModel : HomepageDataModel, ViewModel() { postBlurViewLoaded = status } } + private fun setNewsBlurView(status: Boolean) = runBlocking { newsBlurMutex.withLock { newsBlurViewLoaded = status } } + private fun updateBlurViewStatus() = runBlocking { postBlurMutex.lock() newsBlurMutex.lock()