1
0
mirror of https://github.com/etesync/android synced 2025-04-24 02:59:07 +00:00

EditCollection: only show error if we are still attached to context.

This commit is contained in:
Tom Hacohen 2020-10-27 08:49:41 +02:00
parent 841a1f0fd9
commit b5aafc11c5

View File

@ -15,6 +15,7 @@ import com.etebase.client.exceptions.EtebaseException
import com.etesync.syncadapter.CachedCollection
import com.etesync.syncadapter.Constants
import com.etesync.syncadapter.R
import com.etesync.syncadapter.log.Logger
import com.etesync.syncadapter.resource.LocalCalendar
import com.etesync.syncadapter.syncadapter.requestSync
import com.etesync.syncadapter.ui.BaseActivity
@ -167,11 +168,14 @@ class EditCollectionFragment(private val cachedCollection: CachedCollection, pri
activity?.finish()
} catch (e: EtebaseException) {
uiThread {
AlertDialog.Builder(requireContext())
.setIcon(R.drawable.ic_info_dark)
.setTitle(R.string.exception)
.setMessage(e.localizedMessage)
.setPositiveButton(android.R.string.yes) { _, _ -> }.show()
Logger.log.warning(e.localizedMessage)
context?.let { context ->
AlertDialog.Builder(context)
.setIcon(R.drawable.ic_info_dark)
.setTitle(R.string.exception)
.setMessage(e.localizedMessage)
.setPositiveButton(android.R.string.yes) { _, _ -> }.show()
}
}
} finally {
uiThread {