UploadMediaDetail: replace discreet error toast with more-noticeable dialog (#4433)

This commit is contained in:
Brigham Byerly 2021-06-04 05:34:46 -04:00 committed by GitHub
parent ca18763e4f
commit 165c375bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 2 deletions

View file

@ -365,6 +365,14 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
//If the error message is null, we will probably not show anything //If the error message is null, we will probably not show anything
} }
@Override
public void showConnectionErrorPopup() {
DialogUtil.showAlertDialog(getActivity(),
getString(R.string.upload_connection_error_alert_title),
getString(R.string.upload_connection_error_alert_detail), getString(R.string.ok),
() -> {}, true);
}
@Override public void showMapWithImageCoordinates(boolean shouldShow) { @Override public void showMapWithImageCoordinates(boolean shouldShow) {
ibMap.setVisibility(shouldShow ? View.VISIBLE : View.GONE); ibMap.setVisibility(shouldShow ? View.VISIBLE : View.GONE);
} }

View file

@ -32,6 +32,8 @@ public interface UploadMediaDetailsContract {
void showBadImagePopup(Integer errorCode, UploadItem uploadItem); void showBadImagePopup(Integer errorCode, UploadItem uploadItem);
void showConnectionErrorPopup();
void showMapWithImageCoordinates(boolean shouldShow); void showMapWithImageCoordinates(boolean shouldShow);
void showExternalMap(UploadItem uploadItem); void showExternalMap(UploadItem uploadItem);

View file

@ -23,6 +23,7 @@ import io.reactivex.Scheduler;
import io.reactivex.disposables.CompositeDisposable; import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.inject.Inject; import javax.inject.Inject;
@ -138,8 +139,12 @@ public class UploadMediaPresenter implements UserActionListener, SimilarImageInt
}, },
throwable -> { throwable -> {
view.showProgress(false); view.showProgress(false);
view.showMessage("" + throwable.getLocalizedMessage(), if (throwable instanceof UnknownHostException) {
R.color.color_error); view.showConnectionErrorPopup();
} else {
view.showMessage("" + throwable.getLocalizedMessage(),
R.color.color_error);
}
Timber.e(throwable, "Error occurred while handling image"); Timber.e(throwable, "Error occurred while handling image");
}) })
); );

View file

@ -227,6 +227,9 @@
<string name="upload_problem_fbmd">Please only upload pictures that you have taken by yourself. Don\'t upload pictures that you have found on other people\'s Facebook accounts.</string> <string name="upload_problem_fbmd">Please only upload pictures that you have taken by yourself. Don\'t upload pictures that you have found on other people\'s Facebook accounts.</string>
<string name="upload_problem_do_you_continue">Do you still want to upload this picture?</string> <string name="upload_problem_do_you_continue">Do you still want to upload this picture?</string>
<string name="upload_connection_error_alert_title">Connection Error</string>
<string name="upload_connection_error_alert_detail">The upload process requires active internet
access. Please check your network connection.</string>
<string name="upload_problem_image">Problems found in image</string> <string name="upload_problem_image">Problems found in image</string>
<string name="internet_downloaded">Please only upload pictures that you have taken by yourself. Don\'t upload pictures that you have downloaded from the Internet.</string> <string name="internet_downloaded">Please only upload pictures that you have taken by yourself. Don\'t upload pictures that you have downloaded from the Internet.</string>