Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Commit

Permalink
fix typo that caused app to crash
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Mar 1, 2022
1 parent e209f4b commit ed1de73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,13 @@ class AHScheduleService {
val req = Request.Builder()
.url(LOGIN_URL)
.header("Cookie", sessionCookie)
.post(FormBody.Builder()
.add("username", pnl!!)
.add("password", password!!)
.add("login-form-type", "pwd")
.build())
.post(
FormBody.Builder()
.add("username", pnl!!)
.add("password", password!!)
.add("login-form-type", "pwd")
.build()
)
.build()

return suspendCoroutine { continuation ->
Expand Down
14 changes: 4 additions & 10 deletions app/src/main/java/nl/kwyntes/roosterappie/ui/ScheduleScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Calculate
import androidx.compose.material.icons.filled.Settings
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
Expand All @@ -22,18 +21,13 @@ import androidx.navigation.NavController
import com.google.accompanist.pager.ExperimentalPagerApi
import com.google.accompanist.pager.HorizontalPager
import com.google.accompanist.pager.rememberPagerState
import kotlinx.coroutines.coroutineScope
import nl.kwyntes.roosterappie.PREF_LOGIN_COOKIE
import nl.kwyntes.roosterappie.PREF_PASSWORD
import nl.kwyntes.roosterappie.PREF_PNL
import nl.kwyntes.roosterappie.dataStore
import nl.kwyntes.roosterappie.lib.AHScheduleService
import nl.kwyntes.roosterappie.lib.AuthorisedStatus
import nl.kwyntes.roosterappie.lib.MonthYear
import nl.kwyntes.roosterappie.lib.Shift
import nl.kwyntes.roosterappie.lib.*
import nl.kwyntes.roosterappie.ui.theme.LightBlue
import nl.kwyntes.roosterappie.ui.theme.LightGreen
import org.apache.http.auth.InvalidCredentialsException
import java.time.LocalDate
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
Expand Down Expand Up @@ -69,7 +63,7 @@ fun ScheduleScreen(navController: NavController, ahScheduleService: AHScheduleSe
prevShifts = ahScheduleService.getSchedule(monthYear.previous())
currShifts = ahScheduleService.getSchedule(monthYear)
nextShifts = ahScheduleService.getSchedule(monthYear.next())
} catch (e: InvalidCredentialsException) {
} catch (e: IncorrectCredentialsException) {
logout()
}
}
Expand All @@ -86,7 +80,7 @@ fun ScheduleScreen(navController: NavController, ahScheduleService: AHScheduleSe
currShifts = prevShifts
try {
prevShifts = ahScheduleService.getSchedule(monthYear.previous())
} catch (e: InvalidCredentialsException) {
} catch (e: IncorrectCredentialsException) {
logout()
}
} else if (pagerState.currentPage == 2) {
Expand All @@ -100,7 +94,7 @@ fun ScheduleScreen(navController: NavController, ahScheduleService: AHScheduleSe
currShifts = nextShifts
try {
nextShifts = ahScheduleService.getSchedule(monthYear.next())
} catch (e: InvalidCredentialsException) {
} catch (e: IncorrectCredentialsException) {
logout()
}
}
Expand Down

0 comments on commit ed1de73

Please sign in to comment.