diff --git a/app/build.gradle b/app/build.gradle index 6dbc9a7f..dc12620c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -56,7 +56,7 @@ android { composeOptions { // Keep this in sync with Kotlin version: // https://developer.android.com/jetpack/androidx/releases/compose-kotlin - kotlinCompilerExtensionVersion = "1.5.7" + kotlinCompilerExtensionVersion = "1.5.8" } // Java namespace for our classes (not to be confused with Android package ID) @@ -148,8 +148,8 @@ dependencies { implementation 'androidx.hilt:hilt-work:1.1.0' kapt 'androidx.hilt:hilt-compiler:1.1.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2' + implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0' implementation 'androidx.paging:paging-runtime-ktx:3.2.1' implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.security:security-crypto:1.1.0-alpha06' diff --git a/app/src/androidTest/kotlin/at/bitfire/davdroid/db/CollectionTest.kt b/app/src/androidTest/kotlin/at/bitfire/davdroid/db/CollectionTest.kt index 589f3582..ecc042de 100644 --- a/app/src/androidTest/kotlin/at/bitfire/davdroid/db/CollectionTest.kt +++ b/app/src/androidTest/kotlin/at/bitfire/davdroid/db/CollectionTest.kt @@ -8,7 +8,7 @@ import android.security.NetworkSecurityPolicy import androidx.test.filters.SmallTest import androidx.test.platform.app.InstrumentationRegistry import at.bitfire.dav4jvm.DavResource -import at.bitfire.dav4jvm.property.ResourceType +import at.bitfire.dav4jvm.property.webdav.ResourceType import at.bitfire.davdroid.network.HttpClient import at.bitfire.davdroid.settings.SettingsManager import dagger.hilt.android.testing.HiltAndroidRule @@ -17,7 +17,10 @@ import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.junit.After -import org.junit.Assert.* +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue import org.junit.Assume import org.junit.Before import org.junit.Rule diff --git a/app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinderTest.kt b/app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinderTest.kt index 1224abe0..f37b7466 100644 --- a/app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinderTest.kt +++ b/app/src/androidTest/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinderTest.kt @@ -8,8 +8,8 @@ import android.security.NetworkSecurityPolicy import androidx.test.filters.SmallTest import androidx.test.platform.app.InstrumentationRegistry import at.bitfire.dav4jvm.DavResource -import at.bitfire.dav4jvm.property.AddressbookHomeSet -import at.bitfire.dav4jvm.property.ResourceType +import at.bitfire.dav4jvm.property.carddav.AddressbookHomeSet +import at.bitfire.dav4jvm.property.webdav.ResourceType import at.bitfire.davdroid.db.Credentials import at.bitfire.davdroid.log.Logger import at.bitfire.davdroid.network.HttpClient diff --git a/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/SyncManagerTest.kt b/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/SyncManagerTest.kt index 5848c1e0..36f1c4d7 100644 --- a/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/SyncManagerTest.kt +++ b/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/SyncManagerTest.kt @@ -17,7 +17,7 @@ import androidx.work.testing.WorkManagerTestInitHelper import at.bitfire.dav4jvm.PropStat import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.Response.HrefRelation -import at.bitfire.dav4jvm.property.GetETag +import at.bitfire.dav4jvm.property.webdav.GetETag import at.bitfire.davdroid.R import at.bitfire.davdroid.TestUtils.assertWithin import at.bitfire.davdroid.db.Credentials diff --git a/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/TestSyncManager.kt b/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/TestSyncManager.kt index 905e4274..16fe27fd 100644 --- a/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/TestSyncManager.kt +++ b/app/src/androidTestOse/kotlin/at/bitfire/davdroid/syncadapter/TestSyncManager.kt @@ -10,9 +10,9 @@ import android.content.SyncResult import at.bitfire.dav4jvm.DavCollection import at.bitfire.dav4jvm.MultiResponseCallback import at.bitfire.dav4jvm.Response -import at.bitfire.dav4jvm.property.GetCTag -import at.bitfire.davdroid.network.HttpClient +import at.bitfire.dav4jvm.property.caldav.GetCTag import at.bitfire.davdroid.db.SyncState +import at.bitfire.davdroid.network.HttpClient import at.bitfire.davdroid.resource.LocalResource import at.bitfire.davdroid.settings.AccountSettings import at.bitfire.davdroid.util.DavUtils diff --git a/app/src/main/kotlin/at/bitfire/davdroid/db/Collection.kt b/app/src/main/kotlin/at/bitfire/davdroid/db/Collection.kt index 5818fe9f..e7b20bd0 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/db/Collection.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/db/Collection.kt @@ -4,10 +4,21 @@ package at.bitfire.davdroid.db -import androidx.room.* +import androidx.room.Entity +import androidx.room.ForeignKey +import androidx.room.Index +import androidx.room.PrimaryKey import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.UrlUtils -import at.bitfire.dav4jvm.property.* +import at.bitfire.dav4jvm.property.caldav.CalendarColor +import at.bitfire.dav4jvm.property.caldav.CalendarDescription +import at.bitfire.dav4jvm.property.caldav.CalendarTimezone +import at.bitfire.dav4jvm.property.caldav.Source +import at.bitfire.dav4jvm.property.caldav.SupportedCalendarComponentSet +import at.bitfire.dav4jvm.property.carddav.AddressbookDescription +import at.bitfire.dav4jvm.property.webdav.CurrentUserPrivilegeSet +import at.bitfire.dav4jvm.property.webdav.DisplayName +import at.bitfire.dav4jvm.property.webdav.ResourceType import at.bitfire.davdroid.util.DavUtils import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrlOrNull diff --git a/app/src/main/kotlin/at/bitfire/davdroid/db/Principal.kt b/app/src/main/kotlin/at/bitfire/davdroid/db/Principal.kt index ad79b1b8..a142a96d 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/db/Principal.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/db/Principal.kt @@ -10,8 +10,8 @@ import androidx.room.Index import androidx.room.PrimaryKey import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.UrlUtils -import at.bitfire.dav4jvm.property.DisplayName -import at.bitfire.dav4jvm.property.ResourceType +import at.bitfire.dav4jvm.property.webdav.DisplayName +import at.bitfire.dav4jvm.property.webdav.ResourceType import okhttp3.HttpUrl import org.apache.commons.lang3.StringUtils diff --git a/app/src/main/kotlin/at/bitfire/davdroid/db/SyncState.kt b/app/src/main/kotlin/at/bitfire/davdroid/db/SyncState.kt index 9c89ef7a..2a088978 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/db/SyncState.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/db/SyncState.kt @@ -4,7 +4,7 @@ package at.bitfire.davdroid.db -import at.bitfire.dav4jvm.property.SyncToken +import at.bitfire.dav4jvm.property.webdav.SyncToken import org.json.JSONException import org.json.JSONObject diff --git a/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinder.kt b/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinder.kt index f8cf1262..e32a7f55 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinder.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/DavResourceFinder.kt @@ -12,6 +12,19 @@ import at.bitfire.dav4jvm.exception.DavException import at.bitfire.dav4jvm.exception.HttpException import at.bitfire.dav4jvm.exception.UnauthorizedException import at.bitfire.dav4jvm.property.* +import at.bitfire.dav4jvm.property.caldav.CalendarColor +import at.bitfire.dav4jvm.property.caldav.CalendarDescription +import at.bitfire.dav4jvm.property.caldav.CalendarHomeSet +import at.bitfire.dav4jvm.property.caldav.CalendarTimezone +import at.bitfire.dav4jvm.property.caldav.CalendarUserAddressSet +import at.bitfire.dav4jvm.property.caldav.SupportedCalendarComponentSet +import at.bitfire.dav4jvm.property.carddav.AddressbookDescription +import at.bitfire.dav4jvm.property.carddav.AddressbookHomeSet +import at.bitfire.dav4jvm.property.webdav.CurrentUserPrincipal +import at.bitfire.dav4jvm.property.webdav.CurrentUserPrivilegeSet +import at.bitfire.dav4jvm.property.webdav.DisplayName +import at.bitfire.dav4jvm.property.webdav.HrefListProperty +import at.bitfire.dav4jvm.property.webdav.ResourceType import at.bitfire.davdroid.db.Collection import at.bitfire.davdroid.db.Credentials import at.bitfire.davdroid.log.StringHandler diff --git a/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/RefreshCollectionsWorker.kt b/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/RefreshCollectionsWorker.kt index 242d66b4..2077cc06 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/RefreshCollectionsWorker.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/servicedetection/RefreshCollectionsWorker.kt @@ -29,22 +29,22 @@ import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.UrlUtils import at.bitfire.dav4jvm.exception.HttpException import at.bitfire.dav4jvm.exception.UnauthorizedException -import at.bitfire.dav4jvm.property.AddressbookDescription -import at.bitfire.dav4jvm.property.AddressbookHomeSet -import at.bitfire.dav4jvm.property.CalendarColor -import at.bitfire.dav4jvm.property.CalendarDescription -import at.bitfire.dav4jvm.property.CalendarHomeSet -import at.bitfire.dav4jvm.property.CalendarProxyReadFor -import at.bitfire.dav4jvm.property.CalendarProxyWriteFor -import at.bitfire.dav4jvm.property.CurrentUserPrivilegeSet -import at.bitfire.dav4jvm.property.DisplayName -import at.bitfire.dav4jvm.property.GroupMembership -import at.bitfire.dav4jvm.property.HrefListProperty -import at.bitfire.dav4jvm.property.Owner -import at.bitfire.dav4jvm.property.ResourceType -import at.bitfire.dav4jvm.property.Source -import at.bitfire.dav4jvm.property.SupportedAddressData -import at.bitfire.dav4jvm.property.SupportedCalendarComponentSet +import at.bitfire.dav4jvm.property.caldav.CalendarColor +import at.bitfire.dav4jvm.property.caldav.CalendarDescription +import at.bitfire.dav4jvm.property.caldav.CalendarHomeSet +import at.bitfire.dav4jvm.property.caldav.CalendarProxyReadFor +import at.bitfire.dav4jvm.property.caldav.CalendarProxyWriteFor +import at.bitfire.dav4jvm.property.caldav.Source +import at.bitfire.dav4jvm.property.caldav.SupportedCalendarComponentSet +import at.bitfire.dav4jvm.property.carddav.AddressbookDescription +import at.bitfire.dav4jvm.property.carddav.AddressbookHomeSet +import at.bitfire.dav4jvm.property.carddav.SupportedAddressData +import at.bitfire.dav4jvm.property.webdav.CurrentUserPrivilegeSet +import at.bitfire.dav4jvm.property.webdav.DisplayName +import at.bitfire.dav4jvm.property.webdav.GroupMembership +import at.bitfire.dav4jvm.property.webdav.HrefListProperty +import at.bitfire.dav4jvm.property.webdav.Owner +import at.bitfire.dav4jvm.property.webdav.ResourceType import at.bitfire.davdroid.InvalidAccountException import at.bitfire.davdroid.R import at.bitfire.davdroid.db.AppDatabase diff --git a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/CalendarSyncManager.kt b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/CalendarSyncManager.kt index 5f02beac..1647491d 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/CalendarSyncManager.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/CalendarSyncManager.kt @@ -11,16 +11,22 @@ import at.bitfire.dav4jvm.DavCalendar import at.bitfire.dav4jvm.MultiResponseCallback import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.exception.DavException -import at.bitfire.dav4jvm.property.* -import at.bitfire.davdroid.util.DavUtils -import at.bitfire.davdroid.network.HttpClient +import at.bitfire.dav4jvm.property.caldav.CalendarData +import at.bitfire.dav4jvm.property.caldav.GetCTag +import at.bitfire.dav4jvm.property.caldav.MaxResourceSize +import at.bitfire.dav4jvm.property.caldav.ScheduleTag +import at.bitfire.dav4jvm.property.webdav.GetETag +import at.bitfire.dav4jvm.property.webdav.SupportedReportSet +import at.bitfire.dav4jvm.property.webdav.SyncToken import at.bitfire.davdroid.R import at.bitfire.davdroid.db.SyncState import at.bitfire.davdroid.log.Logger +import at.bitfire.davdroid.network.HttpClient import at.bitfire.davdroid.resource.LocalCalendar import at.bitfire.davdroid.resource.LocalEvent import at.bitfire.davdroid.resource.LocalResource import at.bitfire.davdroid.settings.AccountSettings +import at.bitfire.davdroid.util.DavUtils import at.bitfire.ical4android.Event import at.bitfire.ical4android.InvalidCalendarException import at.bitfire.ical4android.util.DateUtils @@ -69,9 +75,9 @@ class CalendarSyncManager( override fun queryCapabilities(): SyncState? = remoteExceptionContext { var syncState: SyncState? = null - it.propfind(0, MaxICalendarSize.NAME, SupportedReportSet.NAME, GetCTag.NAME, SyncToken.NAME) { response, relation -> + it.propfind(0, MaxResourceSize.NAME, SupportedReportSet.NAME, GetCTag.NAME, SyncToken.NAME) { response, relation -> if (relation == Response.HrefRelation.SELF) { - response[MaxICalendarSize::class.java]?.maxSize?.let { maxSize -> + response[MaxResourceSize::class.java]?.maxSize?.let { maxSize -> Logger.log.info("Calendar accepts events up to ${FileUtils.byteCountToDisplaySize(maxSize)}") } diff --git a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt index 3172d21c..fe7c05c4 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/ContactsSyncManager.kt @@ -14,17 +14,29 @@ import at.bitfire.dav4jvm.DavAddressBook import at.bitfire.dav4jvm.MultiResponseCallback import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.exception.DavException -import at.bitfire.dav4jvm.property.* -import at.bitfire.davdroid.util.DavUtils -import at.bitfire.davdroid.util.DavUtils.sameTypeAs -import at.bitfire.davdroid.network.HttpClient +import at.bitfire.dav4jvm.property.caldav.GetCTag +import at.bitfire.dav4jvm.property.carddav.AddressData +import at.bitfire.dav4jvm.property.carddav.MaxResourceSize +import at.bitfire.dav4jvm.property.carddav.SupportedAddressData +import at.bitfire.dav4jvm.property.webdav.GetContentType +import at.bitfire.dav4jvm.property.webdav.GetETag +import at.bitfire.dav4jvm.property.webdav.ResourceType +import at.bitfire.dav4jvm.property.webdav.SupportedReportSet +import at.bitfire.dav4jvm.property.webdav.SyncToken import at.bitfire.davdroid.R import at.bitfire.davdroid.db.SyncState import at.bitfire.davdroid.log.Logger -import at.bitfire.davdroid.resource.* +import at.bitfire.davdroid.network.HttpClient +import at.bitfire.davdroid.resource.LocalAddress +import at.bitfire.davdroid.resource.LocalAddressBook +import at.bitfire.davdroid.resource.LocalContact +import at.bitfire.davdroid.resource.LocalGroup +import at.bitfire.davdroid.resource.LocalResource import at.bitfire.davdroid.settings.AccountSettings import at.bitfire.davdroid.syncadapter.groups.CategoriesStrategy import at.bitfire.davdroid.syncadapter.groups.VCard4Strategy +import at.bitfire.davdroid.util.DavUtils +import at.bitfire.davdroid.util.DavUtils.sameTypeAs import at.bitfire.vcard4android.Contact import at.bitfire.vcard4android.GroupMethod import ezvcard.VCardVersion @@ -131,9 +143,9 @@ class ContactsSyncManager( override fun queryCapabilities(): SyncState? { return remoteExceptionContext { var syncState: SyncState? = null - it.propfind(0, MaxVCardSize.NAME, SupportedAddressData.NAME, SupportedReportSet.NAME, GetCTag.NAME, SyncToken.NAME) { response, relation -> + it.propfind(0, MaxResourceSize.NAME, SupportedAddressData.NAME, SupportedReportSet.NAME, GetCTag.NAME, SyncToken.NAME) { response, relation -> if (relation == Response.HrefRelation.SELF) { - response[MaxVCardSize::class.java]?.maxSize?.let { maxSize -> + response[MaxResourceSize::class.java]?.maxSize?.let { maxSize -> Logger.log.info("Address book accepts vCards up to ${FileUtils.byteCountToDisplaySize(maxSize)}") } diff --git a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/JtxSyncManager.kt b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/JtxSyncManager.kt index fdd28ce6..d40dd7af 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/JtxSyncManager.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/JtxSyncManager.kt @@ -11,16 +11,20 @@ import at.bitfire.dav4jvm.DavCalendar import at.bitfire.dav4jvm.MultiResponseCallback import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.exception.DavException -import at.bitfire.dav4jvm.property.* -import at.bitfire.davdroid.util.DavUtils -import at.bitfire.davdroid.network.HttpClient +import at.bitfire.dav4jvm.property.caldav.CalendarData +import at.bitfire.dav4jvm.property.caldav.GetCTag +import at.bitfire.dav4jvm.property.caldav.MaxResourceSize +import at.bitfire.dav4jvm.property.webdav.GetETag +import at.bitfire.dav4jvm.property.webdav.SyncToken import at.bitfire.davdroid.R import at.bitfire.davdroid.db.SyncState import at.bitfire.davdroid.log.Logger +import at.bitfire.davdroid.network.HttpClient import at.bitfire.davdroid.resource.LocalJtxCollection import at.bitfire.davdroid.resource.LocalJtxICalObject import at.bitfire.davdroid.resource.LocalResource import at.bitfire.davdroid.settings.AccountSettings +import at.bitfire.davdroid.util.DavUtils import at.bitfire.ical4android.InvalidCalendarException import at.bitfire.ical4android.JtxICalObject import okhttp3.HttpUrl @@ -54,9 +58,9 @@ class JtxSyncManager( override fun queryCapabilities() = remoteExceptionContext { var syncState: SyncState? = null - it.propfind(0, GetCTag.NAME, MaxICalendarSize.NAME, SyncToken.NAME) { response, relation -> + it.propfind(0, GetCTag.NAME, MaxResourceSize.NAME, SyncToken.NAME) { response, relation -> if (relation == Response.HrefRelation.SELF) { - response[MaxICalendarSize::class.java]?.maxSize?.let { maxSize -> + response[MaxResourceSize::class.java]?.maxSize?.let { maxSize -> Logger.log.info("Collection accepts resources up to ${FileUtils.byteCountToDisplaySize(maxSize)}") } diff --git a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/SyncManager.kt b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/SyncManager.kt index 972fa892..b37074c6 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/SyncManager.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/SyncManager.kt @@ -16,19 +16,38 @@ import android.provider.CalendarContract import android.provider.ContactsContract import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat -import at.bitfire.dav4jvm.* -import at.bitfire.dav4jvm.exception.* -import at.bitfire.dav4jvm.property.GetCTag -import at.bitfire.dav4jvm.property.GetETag -import at.bitfire.dav4jvm.property.ScheduleTag -import at.bitfire.dav4jvm.property.SyncToken -import at.bitfire.davdroid.* +import at.bitfire.dav4jvm.DavCollection +import at.bitfire.dav4jvm.DavResource +import at.bitfire.dav4jvm.Error +import at.bitfire.dav4jvm.MultiResponseCallback +import at.bitfire.dav4jvm.Response +import at.bitfire.dav4jvm.exception.ConflictException +import at.bitfire.dav4jvm.exception.DavException +import at.bitfire.dav4jvm.exception.ForbiddenException +import at.bitfire.dav4jvm.exception.GoneException +import at.bitfire.dav4jvm.exception.HttpException +import at.bitfire.dav4jvm.exception.NotFoundException +import at.bitfire.dav4jvm.exception.PreconditionFailedException +import at.bitfire.dav4jvm.exception.ServiceUnavailableException +import at.bitfire.dav4jvm.exception.UnauthorizedException +import at.bitfire.dav4jvm.property.caldav.GetCTag +import at.bitfire.dav4jvm.property.caldav.ScheduleTag +import at.bitfire.dav4jvm.property.webdav.GetETag +import at.bitfire.dav4jvm.property.webdav.SyncToken +import at.bitfire.davdroid.Constants +import at.bitfire.davdroid.InvalidAccountException +import at.bitfire.davdroid.R import at.bitfire.davdroid.db.AppDatabase import at.bitfire.davdroid.db.SyncState import at.bitfire.davdroid.db.SyncStats import at.bitfire.davdroid.log.Logger import at.bitfire.davdroid.network.HttpClient -import at.bitfire.davdroid.resource.* +import at.bitfire.davdroid.resource.LocalAddressBook +import at.bitfire.davdroid.resource.LocalCollection +import at.bitfire.davdroid.resource.LocalContact +import at.bitfire.davdroid.resource.LocalEvent +import at.bitfire.davdroid.resource.LocalResource +import at.bitfire.davdroid.resource.LocalTask import at.bitfire.davdroid.settings.AccountSettings import at.bitfire.davdroid.ui.DebugInfoActivity import at.bitfire.davdroid.ui.NotificationUtils @@ -43,7 +62,9 @@ import dagger.hilt.EntryPoint import dagger.hilt.InstallIn import dagger.hilt.android.EntryPointAccessors import dagger.hilt.components.SingletonComponent -import kotlinx.coroutines.* +import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking import okhttp3.HttpUrl import okhttp3.RequestBody import org.apache.commons.io.FileUtils @@ -54,7 +75,7 @@ import java.io.InterruptedIOException import java.net.HttpURLConnection import java.security.cert.CertificateException import java.time.Instant -import java.util.* +import java.util.LinkedList import java.util.concurrent.LinkedBlockingQueue import java.util.concurrent.atomic.AtomicInteger import java.util.logging.Level @@ -559,7 +580,7 @@ abstract class SyncManager, out CollectionType: L return@listRemote // ignore collections - if (response[at.bitfire.dav4jvm.property.ResourceType::class.java]?.types?.contains(at.bitfire.dav4jvm.property.ResourceType.COLLECTION) == true) + if (response[at.bitfire.dav4jvm.property.webdav.ResourceType::class.java]?.types?.contains(at.bitfire.dav4jvm.property.webdav.ResourceType.COLLECTION) == true) return@listRemote val name = response.hrefName() diff --git a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/TasksSyncManager.kt b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/TasksSyncManager.kt index d35afeaa..f2951b85 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/TasksSyncManager.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/syncadapter/TasksSyncManager.kt @@ -11,16 +11,20 @@ import at.bitfire.dav4jvm.DavCalendar import at.bitfire.dav4jvm.MultiResponseCallback import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.exception.DavException -import at.bitfire.dav4jvm.property.* -import at.bitfire.davdroid.util.DavUtils -import at.bitfire.davdroid.network.HttpClient +import at.bitfire.dav4jvm.property.caldav.CalendarData +import at.bitfire.dav4jvm.property.caldav.GetCTag +import at.bitfire.dav4jvm.property.caldav.MaxResourceSize +import at.bitfire.dav4jvm.property.webdav.GetETag +import at.bitfire.dav4jvm.property.webdav.SyncToken import at.bitfire.davdroid.R import at.bitfire.davdroid.db.SyncState import at.bitfire.davdroid.log.Logger +import at.bitfire.davdroid.network.HttpClient import at.bitfire.davdroid.resource.LocalResource import at.bitfire.davdroid.resource.LocalTask import at.bitfire.davdroid.resource.LocalTaskList import at.bitfire.davdroid.settings.AccountSettings +import at.bitfire.davdroid.util.DavUtils import at.bitfire.ical4android.InvalidCalendarException import at.bitfire.ical4android.Task import okhttp3.HttpUrl @@ -57,9 +61,9 @@ class TasksSyncManager( override fun queryCapabilities() = remoteExceptionContext { var syncState: SyncState? = null - it.propfind(0, MaxICalendarSize.NAME, GetCTag.NAME, SyncToken.NAME) { response, relation -> + it.propfind(0, MaxResourceSize.NAME, GetCTag.NAME, SyncToken.NAME) { response, relation -> if (relation == Response.HrefRelation.SELF) { - response[MaxICalendarSize::class.java]?.maxSize?.let { maxSize -> + response[MaxResourceSize::class.java]?.maxSize?.let { maxSize -> Logger.log.info("Calendar accepts tasks up to ${FileUtils.byteCountToDisplaySize(maxSize)}") } diff --git a/app/src/main/kotlin/at/bitfire/davdroid/ui/account/CreateCollectionFragment.kt b/app/src/main/kotlin/at/bitfire/davdroid/ui/account/CreateCollectionFragment.kt index e6fc1966..275a3a07 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/ui/account/CreateCollectionFragment.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/ui/account/CreateCollectionFragment.kt @@ -12,9 +12,19 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.DialogFragment import androidx.fragment.app.viewModels -import androidx.lifecycle.* +import androidx.lifecycle.AndroidViewModel +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.Observer +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import androidx.lifecycle.viewModelScope import at.bitfire.dav4jvm.DavResource import at.bitfire.dav4jvm.XmlUtils +import at.bitfire.dav4jvm.property.caldav.NS_APPLE_ICAL +import at.bitfire.dav4jvm.property.caldav.NS_CALDAV +import at.bitfire.dav4jvm.property.carddav.NS_CARDDAV +import at.bitfire.dav4jvm.property.webdav.NS_WEBDAV import at.bitfire.davdroid.R import at.bitfire.davdroid.db.AppDatabase import at.bitfire.davdroid.db.Collection @@ -168,84 +178,84 @@ class CreateCollectionFragment: DialogFragment() { with(serializer) { setOutput(writer) startDocument("UTF-8", null) - setPrefix("", XmlUtils.NS_WEBDAV) - setPrefix("CAL", XmlUtils.NS_CALDAV) - setPrefix("CARD", XmlUtils.NS_CARDDAV) + setPrefix("", NS_WEBDAV) + setPrefix("CAL", NS_CALDAV) + setPrefix("CARD", NS_CARDDAV) - startTag(XmlUtils.NS_WEBDAV, "mkcol") - startTag(XmlUtils.NS_WEBDAV, "set") - startTag(XmlUtils.NS_WEBDAV, "prop") - startTag(XmlUtils.NS_WEBDAV, "resourcetype") - startTag(XmlUtils.NS_WEBDAV, "collection") - endTag(XmlUtils.NS_WEBDAV, "collection") + startTag(NS_WEBDAV, "mkcol") + startTag(NS_WEBDAV, "set") + startTag(NS_WEBDAV, "prop") + startTag(NS_WEBDAV, "resourcetype") + startTag(NS_WEBDAV, "collection") + endTag(NS_WEBDAV, "collection") if (collection.type == Collection.TYPE_ADDRESSBOOK) { - startTag(XmlUtils.NS_CARDDAV, "addressbook") - endTag(XmlUtils.NS_CARDDAV, "addressbook") + startTag(NS_CARDDAV, "addressbook") + endTag(NS_CARDDAV, "addressbook") } else if (collection.type == Collection.TYPE_CALENDAR) { - startTag(XmlUtils.NS_CALDAV, "calendar") - endTag(XmlUtils.NS_CALDAV, "calendar") + startTag(NS_CALDAV, "calendar") + endTag(NS_CALDAV, "calendar") } - endTag(XmlUtils.NS_WEBDAV, "resourcetype") + endTag(NS_WEBDAV, "resourcetype") collection.displayName?.let { - startTag(XmlUtils.NS_WEBDAV, "displayname") + startTag(NS_WEBDAV, "displayname") text(it) - endTag(XmlUtils.NS_WEBDAV, "displayname") + endTag(NS_WEBDAV, "displayname") } // addressbook-specific properties if (collection.type == Collection.TYPE_ADDRESSBOOK) { collection.description?.let { - startTag(XmlUtils.NS_CARDDAV, "addressbook-description") + startTag(NS_CARDDAV, "addressbook-description") text(it) - endTag(XmlUtils.NS_CARDDAV, "addressbook-description") + endTag(NS_CARDDAV, "addressbook-description") } } // calendar-specific properties if (collection.type == Collection.TYPE_CALENDAR) { collection.description?.let { - startTag(XmlUtils.NS_CALDAV, "calendar-description") + startTag(NS_CALDAV, "calendar-description") text(it) - endTag(XmlUtils.NS_CALDAV, "calendar-description") + endTag(NS_CALDAV, "calendar-description") } collection.color?.let { - startTag(XmlUtils.NS_APPLE_ICAL, "calendar-color") + startTag(NS_APPLE_ICAL, "calendar-color") text(DavUtils.ARGBtoCalDAVColor(it)) - endTag(XmlUtils.NS_APPLE_ICAL, "calendar-color") + endTag(NS_APPLE_ICAL, "calendar-color") } collection.timezone?.let { - startTag(XmlUtils.NS_CALDAV, "calendar-timezone") + startTag(NS_CALDAV, "calendar-timezone") cdsect(it) - endTag(XmlUtils.NS_CALDAV, "calendar-timezone") + endTag(NS_CALDAV, "calendar-timezone") } if (collection.supportsVEVENT != null || collection.supportsVTODO != null || collection.supportsVJOURNAL != null) { // only if there's at least one explicitly supported calendar component set, otherwise don't include the property - startTag(XmlUtils.NS_CALDAV, "supported-calendar-component-set") + startTag(NS_CALDAV, "supported-calendar-component-set") if (collection.supportsVEVENT != false) { - startTag(XmlUtils.NS_CALDAV, "comp") + startTag(NS_CALDAV, "comp") attribute(null, "name", "VEVENT") - endTag(XmlUtils.NS_CALDAV, "comp") + endTag(NS_CALDAV, "comp") } if (collection.supportsVTODO != false) { - startTag(XmlUtils.NS_CALDAV, "comp") + startTag(NS_CALDAV, "comp") attribute(null, "name", "VTODO") - endTag(XmlUtils.NS_CALDAV, "comp") + endTag(NS_CALDAV, "comp") } if (collection.supportsVJOURNAL != false) { - startTag(XmlUtils.NS_CALDAV, "comp") + startTag(NS_CALDAV, "comp") attribute(null, "name", "VJOURNAL") - endTag(XmlUtils.NS_CALDAV, "comp") + endTag(NS_CALDAV, "comp") } - endTag(XmlUtils.NS_CALDAV, "supported-calendar-component-set") + endTag(NS_CALDAV, "supported-calendar-component-set") } } - endTag(XmlUtils.NS_WEBDAV, "prop") - endTag(XmlUtils.NS_WEBDAV, "set") - endTag(XmlUtils.NS_WEBDAV, "mkcol") + endTag(NS_WEBDAV, "prop") + endTag(NS_WEBDAV, "set") + endTag(NS_WEBDAV, "mkcol") endDocument() } } catch(e: IOException) { diff --git a/app/src/main/kotlin/at/bitfire/davdroid/webdav/DavDocumentsProvider.kt b/app/src/main/kotlin/at/bitfire/davdroid/webdav/DavDocumentsProvider.kt index e30fc502..c56ca273 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/webdav/DavDocumentsProvider.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/webdav/DavDocumentsProvider.kt @@ -30,6 +30,15 @@ import at.bitfire.dav4jvm.DavResource import at.bitfire.dav4jvm.Response import at.bitfire.dav4jvm.exception.HttpException import at.bitfire.dav4jvm.property.* +import at.bitfire.dav4jvm.property.webdav.CurrentUserPrivilegeSet +import at.bitfire.dav4jvm.property.webdav.DisplayName +import at.bitfire.dav4jvm.property.webdav.GetContentLength +import at.bitfire.dav4jvm.property.webdav.GetContentType +import at.bitfire.dav4jvm.property.webdav.GetETag +import at.bitfire.dav4jvm.property.webdav.GetLastModified +import at.bitfire.dav4jvm.property.webdav.QuotaAvailableBytes +import at.bitfire.dav4jvm.property.webdav.QuotaUsedBytes +import at.bitfire.dav4jvm.property.webdav.ResourceType import at.bitfire.davdroid.R import at.bitfire.davdroid.db.AppDatabase import at.bitfire.davdroid.db.WebDavDocument diff --git a/app/src/main/kotlin/at/bitfire/davdroid/webdav/HeadResponse.kt b/app/src/main/kotlin/at/bitfire/davdroid/webdav/HeadResponse.kt index a687a716..c6365d55 100644 --- a/app/src/main/kotlin/at/bitfire/davdroid/webdav/HeadResponse.kt +++ b/app/src/main/kotlin/at/bitfire/davdroid/webdav/HeadResponse.kt @@ -6,7 +6,7 @@ package at.bitfire.davdroid.webdav import at.bitfire.dav4jvm.DavResource import at.bitfire.dav4jvm.HttpUtils -import at.bitfire.dav4jvm.property.GetETag +import at.bitfire.dav4jvm.property.webdav.GetETag import at.bitfire.davdroid.network.HttpClient import okhttp3.HttpUrl import java.time.Instant diff --git a/build.gradle b/build.gradle index 8c84234c..61d67517 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { appIntro: '7.0.0-beta02', composeBom: '2023.10.01', hilt: '2.50', - kotlin: '1.9.21', // keep in sync with * app/build.gradle composeOptions.kotlinCompilerExtensionVersion + kotlin: '1.9.22', // keep in sync with * app/build.gradle composeOptions.kotlinCompilerExtensionVersion // * com.google.devtools.ksp at the end of this file okhttp: '4.12.0', room: '2.6.1', @@ -20,7 +20,7 @@ buildscript { commonsText: '1.11.0', // own libraries cert4android: '2bb3898', - dav4jvm: '8d22ff2', + dav4jvm: '93dddcd', ical4android: '8972b85', vcard4android: 'a7a1f42' ] @@ -43,7 +43,7 @@ buildscript { plugins { // see https://github.com/google/ksp/releases for version numbers - id 'com.google.devtools.ksp' version '1.9.21-1.0.15' apply false + id 'com.google.devtools.ksp' version '1.9.22-1.0.17' apply false } allprojects {