Refresh community servers upon failure
This commit is contained in:
@@ -110,6 +110,10 @@ public class JoinDialog extends BaseDialog{
|
|||||||
keyDown(KeyCode.f5, this::refreshAll);
|
keyDown(KeyCode.f5, this::refreshAll);
|
||||||
|
|
||||||
shown(() -> {
|
shown(() -> {
|
||||||
|
if(defaultServers.isEmpty()){
|
||||||
|
fetchServers();
|
||||||
|
}
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
refreshAll();
|
refreshAll();
|
||||||
|
|
||||||
@@ -119,8 +123,6 @@ public class JoinDialog extends BaseDialog{
|
|||||||
});
|
});
|
||||||
|
|
||||||
onResize(() -> {
|
onResize(() -> {
|
||||||
|
|
||||||
|
|
||||||
//only refresh on resize when the minimum dimension is smaller than the maximum preferred width
|
//only refresh on resize when the minimum dimension is smaller than the maximum preferred width
|
||||||
//this means that refreshes on resize will only happen for small phones that need the list to fit in portrait mode
|
//this means that refreshes on resize will only happen for small phones that need the list to fit in portrait mode
|
||||||
//also resize if number of cols changes
|
//also resize if number of cols changes
|
||||||
@@ -392,6 +394,10 @@ public class JoinDialog extends BaseDialog{
|
|||||||
global.clear();
|
global.clear();
|
||||||
global.background(null);
|
global.background(null);
|
||||||
|
|
||||||
|
if(defaultServers.isEmpty()){
|
||||||
|
fetchServers();
|
||||||
|
}
|
||||||
|
|
||||||
global.table(t -> {
|
global.table(t -> {
|
||||||
t.add("@search").padRight(10);
|
t.add("@search").padRight(10);
|
||||||
t.field(serverSearch, text ->
|
t.field(serverSearch, text ->
|
||||||
@@ -412,7 +418,7 @@ public class JoinDialog extends BaseDialog{
|
|||||||
boolean favorite = group.favorite();
|
boolean favorite = group.favorite();
|
||||||
if(group.prioritized){
|
if(group.prioritized){
|
||||||
addHeader(groupTable, group, hidden, favorite, false);
|
addHeader(groupTable, group, hidden, favorite, false);
|
||||||
}else if (favorite){
|
}else if(favorite){
|
||||||
addHeader(groupTable, group, hidden, true, true);//weird behaviour if false?
|
addHeader(groupTable, group, hidden, true, true);//weird behaviour if false?
|
||||||
}
|
}
|
||||||
//table containing all groups
|
//table containing all groups
|
||||||
@@ -662,7 +668,6 @@ public class JoinDialog extends BaseDialog{
|
|||||||
private static void fetchServers(String[] urls, int index){
|
private static void fetchServers(String[] urls, int index){
|
||||||
if(index >= urls.length) return;
|
if(index >= urls.length) return;
|
||||||
|
|
||||||
//get servers
|
|
||||||
Http.get(urls[index])
|
Http.get(urls[index])
|
||||||
.error(t -> {
|
.error(t -> {
|
||||||
if(index < urls.length - 1){
|
if(index < urls.length - 1){
|
||||||
|
|||||||
Reference in New Issue
Block a user