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 { ...@@ -7,7 +7,7 @@ public interface InputHostnameContract {
interface View extends BaseContract.View { interface View extends BaseContract.View {
void showLoader(); void showLoader();
void hideLoader(); void hideLoader(Boolean isValidServerUrl);
void showInvalidServerError(); void showInvalidServerError();
......
...@@ -96,9 +96,11 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost ...@@ -96,9 +96,11 @@ public class InputHostnameFragment extends AbstractFragment implements InputHost
} }
@Override @Override
public void hideLoader() { public void hideLoader(Boolean isValidServerUrl) {
waitingView.setVisibility(View.GONE); if(!isValidServerUrl) {
container.setVisibility(View.VISIBLE); waitingView.setVisibility(View.GONE);
container.setVisibility(View.VISIBLE);
}
} }
@Override @Override
......
...@@ -15,6 +15,7 @@ import io.reactivex.disposables.Disposable; ...@@ -15,6 +15,7 @@ import io.reactivex.disposables.Disposable;
public class InputHostnamePresenter extends BasePresenter<InputHostnameContract.View> implements InputHostnameContract.Presenter { public class InputHostnamePresenter extends BasePresenter<InputHostnameContract.View> implements InputHostnameContract.Presenter {
private final ConnectivityManagerApi connectivityManager; private final ConnectivityManagerApi connectivityManager;
private boolean isValidServerUrl;
public InputHostnamePresenter(ConnectivityManagerApi connectivityManager) { public InputHostnamePresenter(ConnectivityManagerApi connectivityManager) {
this.connectivityManager = connectivityManager; this.connectivityManager = connectivityManager;
...@@ -35,10 +36,11 @@ public class InputHostnamePresenter extends BasePresenter<InputHostnameContract. ...@@ -35,10 +36,11 @@ public class InputHostnamePresenter extends BasePresenter<InputHostnameContract.
final Disposable subscription = ServerPolicyHelper.isApiVersionValid(validationHelper) final Disposable subscription = ServerPolicyHelper.isApiVersionValid(validationHelper)
.subscribeOn(AndroidSchedulers.from(BackgroundLooper.get())) .subscribeOn(AndroidSchedulers.from(BackgroundLooper.get()))
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doOnTerminate(() -> view.hideLoader()) .doOnTerminate(() -> view.hideLoader(isValidServerUrl))
.subscribe( .subscribe(
serverValidation -> { serverValidation -> {
if (serverValidation.isValid()) { if (serverValidation.isValid()) {
isValidServerUrl=true;
onServerValid(hostname, serverValidation.usesSecureConnection()); onServerValid(hostname, serverValidation.usesSecureConnection());
} else { } else {
view.showInvalidServerError(); 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