mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-21 12:35:30 +03:00
add const val for error code
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
6c4685dce5
commit
a39ca256de
2 changed files with 15 additions and 6 deletions
|
@ -661,9 +661,17 @@ class ConversationInfoActivity :
|
|||
WorkInfo.State.FAILED -> {
|
||||
val errorType = workInfo.outputData.getString("error_type")
|
||||
if (errorType == LeaveConversationWorker.ERROR_NO_OTHER_MODERATORS_OR_OWNERS_LEFT) {
|
||||
Snackbar.make( binding.root, R.string.nc_last_moderator_leaving_room_warning, Snackbar.LENGTH_LONG ).show()
|
||||
Snackbar.make(
|
||||
binding.root,
|
||||
R.string.nc_last_moderator_leaving_room_warning,
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Snackbar.make( binding.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG ).show()
|
||||
Snackbar.make(
|
||||
binding.root,
|
||||
R.string.nc_common_error_sorry,
|
||||
Snackbar.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
|
|
|
@ -70,15 +70,15 @@ class LeaveConversationWorker(context: Context, workerParams: WorkerParameters)
|
|||
override fun onError(e: Throwable) {
|
||||
Log.e(TAG, "Failed to remove self from room", e)
|
||||
val httpException = e as? HttpException
|
||||
val errorData = if (httpException?.code() == 400) {
|
||||
val errorData = if (httpException?.code() == HTTP_ERROR_CODE_400) {
|
||||
Data.Builder()
|
||||
.putString("error_type", ERROR_NO_OTHER_MODERATORS_OR_OWNERS_LEFT)
|
||||
.build()
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Data.Builder()
|
||||
.putString("error_type", ERROR_OTHER)
|
||||
.build() }
|
||||
.build()
|
||||
}
|
||||
result.set(Result.failure(errorData))
|
||||
}
|
||||
|
||||
|
@ -97,5 +97,6 @@ class LeaveConversationWorker(context: Context, workerParams: WorkerParameters)
|
|||
private const val TAG = "LeaveConversationWorker"
|
||||
const val ERROR_NO_OTHER_MODERATORS_OR_OWNERS_LEFT = "NO_OTHER_MODERATORS_OR_OWNERS_LEFT"
|
||||
const val ERROR_OTHER = "ERROR_OTHER"
|
||||
const val HTTP_ERROR_CODE_400 = 400
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue