|
44 | 44 | import fr.free.nrw.commons.BuildConfig;
|
45 | 45 | import fr.free.nrw.commons.Media;
|
46 | 46 | import fr.free.nrw.commons.PageTitle;
|
| 47 | +import fr.free.nrw.commons.R; |
47 | 48 | import fr.free.nrw.commons.achievements.FeedbackResponse;
|
48 | 49 | import fr.free.nrw.commons.auth.AccountUtil;
|
49 | 50 | import fr.free.nrw.commons.category.CategoryImageUtils;
|
|
52 | 53 | import fr.free.nrw.commons.notification.NotificationUtils;
|
53 | 54 | import fr.free.nrw.commons.utils.ContributionUtils;
|
54 | 55 | import fr.free.nrw.commons.utils.DateUtils;
|
| 56 | +import fr.free.nrw.commons.utils.ViewUtil; |
55 | 57 | import in.yuvi.http.fluent.Http;
|
56 | 58 | import io.reactivex.Observable;
|
57 | 59 | import io.reactivex.Single;
|
@@ -79,6 +81,8 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi {
|
79 | 81 | private Gson gson;
|
80 | 82 | private final OkHttpClient okHttpClient;
|
81 | 83 |
|
| 84 | + private final String ERROR_CODE_BAD_TOKEN = "badtoken"; |
| 85 | + |
82 | 86 | public ApacheHttpClientMediaWikiApi(Context context,
|
83 | 87 | String apiURL,
|
84 | 88 | String wikidatApiURL,
|
@@ -898,8 +902,11 @@ public UploadResult uploadFile(String filename,
|
898 | 902 |
|
899 | 903 | if (!resultStatus.equals("Success")) {
|
900 | 904 | String errorCode = result.getString("/api/error/@code");
|
901 |
| - Log.d("deneme","error code: "+errorCode); |
902 | 905 | Timber.e(errorCode);
|
| 906 | + |
| 907 | + if (errorCode.equals(ERROR_CODE_BAD_TOKEN)) { |
| 908 | + ViewUtil.showLongToast(context, R.string.bad_token_error_proposed_solution); |
| 909 | + } |
903 | 910 | return new UploadResult(resultStatus, errorCode);
|
904 | 911 | } else {
|
905 | 912 | // If success we have to remove file from temp directory
|
|
0 commit comments