Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27e077d0 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

chore: try to use syncResult.stats.numAuthException

parent 9547e02d
Loading
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -846,7 +846,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L

    private fun notifyException(e: Throwable, local: ResourceType?, remote: HttpUrl?) {
        val message: String

        var title: String = localCollection.title
        when (e) {
            is IOException,
            is InterruptedIOException -> {
@@ -855,11 +855,13 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
                syncResult.stats.numIoExceptions++
            }
            is UnauthorizedException -> {
                message = context.getString(R.string.sync_error_authentication_failed)
                message = context.getString(R.string.account_notification_invalid_login)
                syncResult.stats.numAuthExceptions++
                title = "Account Manager"
                Log.d("vincent", "numAuthException ? ${syncResult.stats.numAuthExceptions}")

                // persistent session cookie is present. Probably the session is outDated. no need to show the notification
                if (accountSettings.containsPersistentCookie()) {
                if (accountSettings.containsPersistentCookie() && syncResult.stats.numAuthExceptions <= 1) {
                    Logger.log.log(Level.FINE, "Authorization error. Session outDated")
                    Log.d("vincent", "containts persistent cookie so returnbefore notif")
                    return
@@ -930,7 +932,7 @@ abstract class SyncManager<ResourceType: LocalResource<*>, out CollectionType: L
        Log.d("vincent", "about to build the notification if possible")
        val builder = NotificationUtils.newBuilder(context, channel)
        builder .setSmallIcon(R.drawable.ic_sync_problem_notify)
                .setContentTitle(localCollection.title)
                .setContentTitle(title)
                .setContentText(message)
                .setStyle(NotificationCompat.BigTextStyle(builder).bigText(message))
                .setSubText(mainAccount.name)