mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Display possible solution for badtoken error
This commit is contained in:
		
							parent
							
								
									5b25229a5c
								
							
						
					
					
						commit
						ce4a0c1194
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		|  | @ -44,6 +44,7 @@ import java.util.concurrent.Callable; | |||
| import fr.free.nrw.commons.BuildConfig; | ||||
| import fr.free.nrw.commons.Media; | ||||
| import fr.free.nrw.commons.PageTitle; | ||||
| import fr.free.nrw.commons.R; | ||||
| import fr.free.nrw.commons.achievements.FeedbackResponse; | ||||
| import fr.free.nrw.commons.auth.AccountUtil; | ||||
| import fr.free.nrw.commons.category.CategoryImageUtils; | ||||
|  | @ -52,6 +53,7 @@ import fr.free.nrw.commons.notification.Notification; | |||
| import fr.free.nrw.commons.notification.NotificationUtils; | ||||
| import fr.free.nrw.commons.utils.ContributionUtils; | ||||
| import fr.free.nrw.commons.utils.DateUtils; | ||||
| import fr.free.nrw.commons.utils.ViewUtil; | ||||
| import in.yuvi.http.fluent.Http; | ||||
| import io.reactivex.Observable; | ||||
| import io.reactivex.Single; | ||||
|  | @ -79,6 +81,8 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { | |||
|     private Gson gson; | ||||
|     private final OkHttpClient okHttpClient; | ||||
| 
 | ||||
|     private final String ERROR_CODE_BAD_TOKEN = "badtoken"; | ||||
| 
 | ||||
|     public ApacheHttpClientMediaWikiApi(Context context, | ||||
|                                         String apiURL, | ||||
|                                         String wikidatApiURL, | ||||
|  | @ -898,8 +902,11 @@ public class ApacheHttpClientMediaWikiApi implements MediaWikiApi { | |||
| 
 | ||||
|         if (!resultStatus.equals("Success")) { | ||||
|             String errorCode = result.getString("/api/error/@code"); | ||||
|             Log.d("deneme","error code: "+errorCode); | ||||
|             Timber.e(errorCode); | ||||
| 
 | ||||
|             if (errorCode.equals(ERROR_CODE_BAD_TOKEN)) { | ||||
|                 ViewUtil.showLongToast(context, R.string.bad_token_error_proposed_solution); | ||||
|             } | ||||
|             return new UploadResult(resultStatus, errorCode); | ||||
|         } else { | ||||
|             // If success we have to remove file from temp directory | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan