Commit 3468473f authored by Ricki Hirner's avatar Ricki Hirner

Improve sync error notifications

* refactor checking for cancelled sync
* notify on SSLHandshakeException (except when a certificate was rejected by cert4android)
* show exception cause in debug info
parent bc63559a
......@@ -52,7 +52,9 @@ class CalendarSyncManager(
val localCalendar: LocalCalendar
): SyncManager(context, settings, account, accountSettings, extras, authority, syncResult, "calendar/${localCalendar.id}") {
val MAX_MULTIGET = 20
companion object {
private val MAX_MULTIGET = 20
}
init {
localCollection = localCalendar
......@@ -123,9 +125,7 @@ class CalendarSyncManager(
// download new/updated iCalendars from server
for (bunch in ListUtils.partition(toDownload.toList(), MAX_MULTIGET)) {
if (Thread.interrupted())
return
abortIfCancelled()
Logger.log.info("Downloading ${bunch.joinToString(", ")}")
if (bunch.size == 1) {
......
......@@ -234,8 +234,7 @@ class ContactsSyncManager(
.setLocalOnly(true)
.setAutoCancel(true)
.build()
val nm = NotificationUtils.createChannels(context)
nm.notify("discarded_${account.name}", 0, notification)
notificationManager.notify("discarded_${account.name}", 0, notification)
}
override fun prepareUpload(resource: LocalResource): RequestBody {
......@@ -312,9 +311,7 @@ class ContactsSyncManager(
// download new/updated VCards from server
for (bunch in ListUtils.partition(toDownload.toList(), MAX_MULTIGET)) {
if (Thread.interrupted())
return
abortIfCancelled()
Logger.log.info("Downloading ${bunch.joinToString(", ")}")
if (bunch.size == 1) {
......
......@@ -108,9 +108,7 @@ class TasksSyncManager(
// download new/updated iCalendars from server
for (bunch in ListUtils.partition(toDownload.toList(), MAX_MULTIGET)) {
if (Thread.interrupted())
return
abortIfCancelled()
Logger.log.info("Downloading ${bunch.joinToString(", ")}")
if (bunch.size == 1) {
......
......@@ -23,6 +23,7 @@ import android.provider.ContactsContract
import android.support.v4.content.ContextCompat
import android.support.v4.content.FileProvider
import android.support.v7.app.AppCompatActivity
import android.util.Log
import android.view.Menu
import android.view.MenuItem
import at.bitfire.dav4android.exception.HttpException
......@@ -37,7 +38,6 @@ import at.bitfire.davdroid.settings.Settings
import at.bitfire.ical4android.TaskProvider
import at.bitfire.vcard4android.ContactsStorageException
import kotlinx.android.synthetic.main.activity_debug_info.*
import org.apache.commons.lang3.exception.ExceptionUtils
import java.io.File
import java.io.FileWriter
import java.io.IOException
......@@ -163,7 +163,7 @@ class DebugInfoActivity: AppCompatActivity(), LoaderManager.LoaderCallbacks<Stri
}
throwable?.let {
report.append("\nEXCEPTION:\n${ExceptionUtils.getStackTrace(throwable)}")
report.append("\nEXCEPTION:\n${Log.getStackTraceString(throwable)}")
}
// logs (for instance, from failed resource detection)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment