Unverified Commit bc33aad4 authored by Leonardo Aramaki's avatar Leonardo Aramaki Committed by GitHub

Merge pull request #637 from aniketsingh03/patch-2

[FIX] Dismiss server url view on entering correct url
parents a2603630 34c69c82
......@@ -7,7 +7,7 @@ public interface InputHostnameContract {
interface View extends BaseContract.View {
void showLoader();
void hideLoader();
void hideLoader(Boolean isValidServerUrl);
void showInvalidServerError();
......
......@@ -96,9 +96,11 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost
}
@Override
public void hideLoader() {
waitingView.setVisibility(View.GONE);
container.setVisibility(View.VISIBLE);
public void hideLoader(Boolean isValidServerUrl) {
if(!isValidServerUrl) {
waitingView.setVisibility(View.GONE);
container.setVisibility(View.VISIBLE);
}
}
@Override
......
......@@ -15,6 +15,7 @@ import io.reactivex.disposables.Disposable;
public class InputHostnamePresenter extends BasePresenter<InputHostnameContract.View> implements InputHostnameContract.Presenter {
private final ConnectivityManagerApi connectivityManager;
private boolean isValidServerUrl;
public InputHostnamePresenter(ConnectivityManagerApi connectivityManager) {
this.connectivityManager = connectivityManager;
......@@ -35,10 +36,11 @@ public class InputHostnamePresenter extends BasePresenter<InputHostnameContract.
final Disposable subscription = ServerPolicyHelper.isApiVersionValid(validationHelper)
.subscribeOn(AndroidSchedulers.from(BackgroundLooper.get()))
.observeOn(AndroidSchedulers.mainThread())
.doOnTerminate(() -> view.hideLoader())
.doOnTerminate(() -> view.hideLoader(isValidServerUrl))
.subscribe(
serverValidation -> {
if (serverValidation.isValid()) {
isValidServerUrl=true;
onServerValid(hostname, serverValidation.usesSecureConnection());
} else {
view.showInvalidServerError();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment