Loading app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ android { defaultConfig { applicationId "at.bitfire.davdroid" versionCode 293 versionCode 295 buildConfigField "long", "buildTime", System.currentTimeMillis() + "L" buildConfigField "boolean", "customCerts", "true" Loading @@ -43,7 +43,7 @@ android { flavorDimensions "distribution" productFlavors { standard { versionName "2.5.2-ose" versionName "2.5.3-beta1-ose" } } Loading app/src/main/java/at/bitfire/davdroid/DavService.kt +18 −11 Original line number Diff line number Diff line Loading @@ -196,7 +196,7 @@ class DavService: android.app.Service() { for (href in homeSet.hrefs) dav.location.resolve(href)?.let { val foundUrl = UrlUtils.withTrailingSlash(it) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl, response[DisplayName::class.java]?.displayName) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl) } } Loading @@ -216,7 +216,7 @@ class DavService: android.app.Service() { for (href in homeSet.hrefs) dav.location.resolve(href)?.let { val foundUrl = UrlUtils.withTrailingSlash(it) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl, response[DisplayName::class.java]?.displayName) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl) } } Loading Loading @@ -283,17 +283,23 @@ class DavService: android.app.Service() { selectedCollections += url } // now refresh collections (taken from home sets) // now refresh homesets and their member collections val itHomeSets = homeSets.iterator() while (itHomeSets.hasNext()) { val homeSet = itHomeSets.next() Logger.log.fine("Listing home set ${homeSet.key}") try { DavResource(httpClient, homeSet.key).propfind(1, *DAV_COLLECTION_PROPERTIES) { response, _ -> DavResource(httpClient, homeSet.key).propfind(1, *DAV_COLLECTION_PROPERTIES) { response, relation -> if (!response.isSuccess()) return@propfind if (relation == Response.HrefRelation.SELF) { // this response is about the homeset itself homeSet.value.displayName = response[DisplayName::class.java]?.displayName homeSet.value.privBind = response[CurrentUserPrivilegeSet::class.java]?.mayBind ?: true } else { val info = Collection.fromDavResponse(response) ?: return@propfind info.serviceId = serviceId info.confirmed = true Loading @@ -303,6 +309,7 @@ class DavService: android.app.Service() { (service.type == Service.TYPE_CALDAV && arrayOf(Collection.TYPE_CALENDAR, Collection.TYPE_WEBCAL).contains(info.type))) collections[response.href] = info } } } catch(e: HttpException) { if (e.code in arrayOf(403, 404, 410)) // delete home set only if it was not accessible (40x) Loading app/src/main/java/at/bitfire/davdroid/model/AppDatabase.kt +1 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ abstract class AppDatabase: RoomDatabase() { object Migration6_7: Migration(6, 7) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL("ALTER TABLE homeset ADD COLUMN privBind INTEGER NOT NULL DEFAULT 1") db.execSQL("ALTER TABLE homeset ADD COLUMN displayName TEXT DEFAULT NULL") } } Loading app/src/main/java/at/bitfire/davdroid/model/HomeSet.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,5 +22,7 @@ data class HomeSet( var serviceId: Long, var url: HttpUrl, var privBind: Boolean = true, var displayName: String? = null ): IdEntity() No newline at end of file app/src/main/java/at/bitfire/davdroid/model/HomeSetDao.kt +7 −1 Original line number Diff line number Diff line package at.bitfire.davdroid.model import androidx.room.* import androidx.room.Dao import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query @Dao interface HomeSetDao: SyncableDao<HomeSet> { Loading @@ -8,6 +11,9 @@ interface HomeSetDao: SyncableDao<HomeSet> { @Query("SELECT * FROM homeset WHERE serviceId=:serviceId") fun getByService(serviceId: Long): List<HomeSet> @Query("SELECT * FROM homeset WHERE serviceId=:serviceId AND privBind") fun getBindableByService(serviceId: Long): List<HomeSet> @Insert(onConflict = OnConflictStrategy.REPLACE) fun insertOrReplace(homeSet: HomeSet): Long Loading Loading
app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ android { defaultConfig { applicationId "at.bitfire.davdroid" versionCode 293 versionCode 295 buildConfigField "long", "buildTime", System.currentTimeMillis() + "L" buildConfigField "boolean", "customCerts", "true" Loading @@ -43,7 +43,7 @@ android { flavorDimensions "distribution" productFlavors { standard { versionName "2.5.2-ose" versionName "2.5.3-beta1-ose" } } Loading
app/src/main/java/at/bitfire/davdroid/DavService.kt +18 −11 Original line number Diff line number Diff line Loading @@ -196,7 +196,7 @@ class DavService: android.app.Service() { for (href in homeSet.hrefs) dav.location.resolve(href)?.let { val foundUrl = UrlUtils.withTrailingSlash(it) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl, response[DisplayName::class.java]?.displayName) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl) } } Loading @@ -216,7 +216,7 @@ class DavService: android.app.Service() { for (href in homeSet.hrefs) dav.location.resolve(href)?.let { val foundUrl = UrlUtils.withTrailingSlash(it) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl, response[DisplayName::class.java]?.displayName) homeSets[foundUrl] = HomeSet(0, service.id, foundUrl) } } Loading Loading @@ -283,17 +283,23 @@ class DavService: android.app.Service() { selectedCollections += url } // now refresh collections (taken from home sets) // now refresh homesets and their member collections val itHomeSets = homeSets.iterator() while (itHomeSets.hasNext()) { val homeSet = itHomeSets.next() Logger.log.fine("Listing home set ${homeSet.key}") try { DavResource(httpClient, homeSet.key).propfind(1, *DAV_COLLECTION_PROPERTIES) { response, _ -> DavResource(httpClient, homeSet.key).propfind(1, *DAV_COLLECTION_PROPERTIES) { response, relation -> if (!response.isSuccess()) return@propfind if (relation == Response.HrefRelation.SELF) { // this response is about the homeset itself homeSet.value.displayName = response[DisplayName::class.java]?.displayName homeSet.value.privBind = response[CurrentUserPrivilegeSet::class.java]?.mayBind ?: true } else { val info = Collection.fromDavResponse(response) ?: return@propfind info.serviceId = serviceId info.confirmed = true Loading @@ -303,6 +309,7 @@ class DavService: android.app.Service() { (service.type == Service.TYPE_CALDAV && arrayOf(Collection.TYPE_CALENDAR, Collection.TYPE_WEBCAL).contains(info.type))) collections[response.href] = info } } } catch(e: HttpException) { if (e.code in arrayOf(403, 404, 410)) // delete home set only if it was not accessible (40x) Loading
app/src/main/java/at/bitfire/davdroid/model/AppDatabase.kt +1 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ abstract class AppDatabase: RoomDatabase() { object Migration6_7: Migration(6, 7) { override fun migrate(db: SupportSQLiteDatabase) { db.execSQL("ALTER TABLE homeset ADD COLUMN privBind INTEGER NOT NULL DEFAULT 1") db.execSQL("ALTER TABLE homeset ADD COLUMN displayName TEXT DEFAULT NULL") } } Loading
app/src/main/java/at/bitfire/davdroid/model/HomeSet.kt +2 −0 Original line number Diff line number Diff line Loading @@ -22,5 +22,7 @@ data class HomeSet( var serviceId: Long, var url: HttpUrl, var privBind: Boolean = true, var displayName: String? = null ): IdEntity() No newline at end of file
app/src/main/java/at/bitfire/davdroid/model/HomeSetDao.kt +7 −1 Original line number Diff line number Diff line package at.bitfire.davdroid.model import androidx.room.* import androidx.room.Dao import androidx.room.Insert import androidx.room.OnConflictStrategy import androidx.room.Query @Dao interface HomeSetDao: SyncableDao<HomeSet> { Loading @@ -8,6 +11,9 @@ interface HomeSetDao: SyncableDao<HomeSet> { @Query("SELECT * FROM homeset WHERE serviceId=:serviceId") fun getByService(serviceId: Long): List<HomeSet> @Query("SELECT * FROM homeset WHERE serviceId=:serviceId AND privBind") fun getBindableByService(serviceId: Long): List<HomeSet> @Insert(onConflict = OnConflictStrategy.REPLACE) fun insertOrReplace(homeSet: HomeSet): Long Loading