Skip to content

Commit

Permalink
Fix Guest mode
Browse files Browse the repository at this point in the history
  • Loading branch information
meiron03 committed Jan 5, 2024
1 parent 516ba2f commit 1d1af00
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -77,6 +79,7 @@ class HomepageViewModel : HomepageDataModel, ViewModel() {
latch.await()
} else {
val latch = CountDownLatch(2)
clearLoggedIn()
getCalendar(studentLife, latch)
getNews(studentLife, latch)
latch.await()
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1d1af00

Please sign in to comment.