mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Resolve crash when submitting feedback without internet access (#6018)
* fix: resolve crash when submitting feedback without internet access * feat:Added check for wheather internet connection was available for a network * feat:Added SnackBar for Retry and User Info * feat:Made the feedback dialog not leave screen in case of error * feat:Removed the network checking from the function * feat:Added try catch block for the Feedback * feat:Removed Unnecessary imports * feat:Used Snackbar and timber instead of log and Toast --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
		
							parent
							
								
									f51b607312
								
							
						
					
					
						commit
						b2810bcef1
					
				
					 2 changed files with 33 additions and 4 deletions
				
			
		|  | @ -35,6 +35,7 @@ import fr.free.nrw.commons.settings.SettingsActivity | |||
| import io.reactivex.Single | ||||
| import io.reactivex.android.schedulers.AndroidSchedulers | ||||
| import io.reactivex.schedulers.Schedulers | ||||
| import timber.log.Timber | ||||
| import javax.inject.Inject | ||||
| import javax.inject.Named | ||||
| 
 | ||||
|  | @ -182,14 +183,17 @@ class MoreBottomSheetFragment : BottomSheetDialogFragment() { | |||
|         Single.defer { single } | ||||
|             .subscribeOn(Schedulers.io()) | ||||
|             .observeOn(AndroidSchedulers.mainThread()) | ||||
|             .subscribe { success -> | ||||
|             .subscribe({ success -> | ||||
|                 val messageResId = if (success) { | ||||
|                     R.string.thanks_feedback | ||||
|                 } else { | ||||
|                     R.string.error_feedback | ||||
|                 } | ||||
|                 Toast.makeText(requireContext(), getString(messageResId), Toast.LENGTH_SHORT).show() | ||||
|             } | ||||
|             }, { error -> | ||||
|                 Timber.e(error) | ||||
|                 Toast.makeText(requireContext(), R.string.error_feedback, Toast.LENGTH_SHORT).show() | ||||
|             }) | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gautham Mohanraj
						Gautham Mohanraj