Skip to content

Commit

Permalink
Merge pull request #99 from geteduroam/feature/GETEDUROAM-54
Browse files Browse the repository at this point in the history
GETEDUROAM-54: Status screen fixes
  • Loading branch information
dzolnai authored Jul 31, 2024
2 parents e3af2d6 + 1a4aa72 commit 4f9ab4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down Expand Up @@ -62,12 +63,18 @@ fun StatusScreen(

val lifecycle = LocalLifecycleOwner.current.lifecycle
val organizationId by viewModel.organizationId
.collectAsStateWithLifecycle(initialValue = null, lifecycle = lifecycle)
.collectAsStateWithLifecycle(initialValue = "", lifecycle = lifecycle)
val organizationName by viewModel.organizationName.collectAsStateWithLifecycle(initialValue = null, lifecycle = lifecycle)
val configSource by viewModel.configSource.collectAsStateWithLifecycle(initialValue = null, lifecycle = lifecycle)
val lastConfig by viewModel.lastConfig.collectAsStateWithLifecycle(initialValue = null, lifecycle = lifecycle)
val expiryTimestampMs by viewModel.expiryTimestampMs.collectAsStateWithLifecycle(initialValue = null, lifecycle = lifecycle)

LaunchedEffect(organizationId) {
if (organizationId == null) {
goToInstitutionSelection()
}
}

Column(
modifier = Modifier
.fillMaxSize(),
Expand Down Expand Up @@ -244,6 +251,7 @@ fun StatusScreenContent(
})
}
Spacer(modifier = Modifier.weight(1f))
/** TODO implement debug options
if (!debugOptionsEnabled) {
TextButton(
onClick = {
Expand All @@ -258,6 +266,7 @@ fun StatusScreenContent(
} else {
// TODO show username, suggestion / app intent, SSID
}
**/
Spacer(modifier = Modifier.size(12.dp))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class StatusScreenViewModel @Inject constructor(
) : ViewModel() {

val organizationId = repository.configuredOrganizationId
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), null)
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), "")
val organizationName = repository.configuredOrganizationName
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000), null)
val configSource = repository.configuredProfileSource
Expand Down

0 comments on commit 4f9ab4b

Please sign in to comment.