Skip to content

Commit

Permalink
Fixes #412 - Not able to add secure internet servers
Browse files Browse the repository at this point in the history
  • Loading branch information
dzolnai committed Feb 5, 2024
1 parent f237ea7 commit 665dcd5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/nl/eduvpn/app/service/HistoryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import nl.eduvpn.app.entity.CertExpiryTimes;
import nl.eduvpn.app.entity.CurrentServer;
import nl.eduvpn.app.entity.Instance;
import nl.eduvpn.app.entity.Organization;
import nl.eduvpn.app.entity.OrganizationList;
import nl.eduvpn.app.entity.exception.CommonException;
import nl.eduvpn.app.utils.Listener;
Expand Down Expand Up @@ -104,6 +105,10 @@ public CurrentServer getCurrentServer() {
return _memoryCachedOrganizationList;
}

public boolean hasSecureInternetServer() {
return _addedServers.getSecureInternetServer() != null;
}

public void setOrganizationList(@Nullable OrganizationList organizationList) {
_memoryCachedOrganizationList = organizationList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ class OrganizationSelectionViewModel @Inject constructor(
// We want to be able to handle async failures, so use supervisorScope
// https://kotlinlang.org/docs/reference/coroutines/exception-handling.html#supervision
supervisorScope {
val organizationListDeferred = if (historyService.organizationList == null) {
val organizationListDeferred = if (!historyService.hasSecureInternetServer()) {
connectionState.postValue(ConnectionState.FetchingOrganizations)
async {
val organizationList = organizationService.fetchOrganizations()
historyService.organizationList = organizationList
organizationList
}
} else {
// We can't show any organization servers, user needs to reset to switch.
// We can't show any organization servers (secure internet), user needs to reset to switch.
connectionState.postValue(ConnectionState.FetchingServerList)
CompletableDeferred(OrganizationList(-1L, emptyList()))
}
Expand Down

0 comments on commit 665dcd5

Please sign in to comment.