mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-31 23:03:54 +01:00
feat:Added try catch block for the Feedback
This commit is contained in:
parent
ad48802da0
commit
b99f3006bf
1 changed files with 18 additions and 4 deletions
|
|
@ -23,6 +23,8 @@ import fr.free.nrw.commons.utils.DeviceInfoUtil.getConnectionType
|
|||
import fr.free.nrw.commons.utils.DeviceInfoUtil.getDevice
|
||||
import fr.free.nrw.commons.utils.DeviceInfoUtil.getDeviceManufacturer
|
||||
import fr.free.nrw.commons.utils.DeviceInfoUtil.getDeviceModel
|
||||
import java.net.ConnectException
|
||||
import java.net.UnknownHostException
|
||||
|
||||
class FeedbackDialog(
|
||||
context: Context,
|
||||
|
|
@ -47,12 +49,24 @@ class FeedbackDialog(
|
|||
@Suppress("DEPRECATION")
|
||||
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
||||
binding.btnSubmitFeedback.setOnClickListener {
|
||||
if (isInternetConnectionAvailable(context) ) {
|
||||
try {
|
||||
submitFeedback()
|
||||
} catch (e: Exception) {
|
||||
when (e) {
|
||||
is UnknownHostException -> {
|
||||
Toast.makeText(context, R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
else {
|
||||
Toast.makeText(context,R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
|
||||
is ConnectException -> {
|
||||
Toast.makeText(context, R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
else -> {
|
||||
Toast.makeText(context, R.string.error_feedback, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue