diff --git a/app/src/main/java/at/bitfire/icsdroid/db/dao/SubscriptionsDao.kt b/app/src/main/java/at/bitfire/icsdroid/db/dao/SubscriptionsDao.kt index a8b5487a..66c67dd5 100644 --- a/app/src/main/java/at/bitfire/icsdroid/db/dao/SubscriptionsDao.kt +++ b/app/src/main/java/at/bitfire/icsdroid/db/dao/SubscriptionsDao.kt @@ -17,10 +17,10 @@ import kotlinx.coroutines.flow.Flow interface SubscriptionsDao { @Insert - fun add(subscription: Subscription): Long + suspend fun add(subscription: Subscription): Long @Delete - fun delete(vararg subscriptions: Subscription) + suspend fun delete(vararg subscriptions: Subscription) @Deprecated( message = "Replace LiveData by Flows", @@ -33,16 +33,16 @@ interface SubscriptionsDao { fun getAllFlow(): Flow> @Query("SELECT * FROM subscriptions") - fun getAll(): List + suspend fun getAll(): List @Query("SELECT * FROM subscriptions WHERE id=:id") - fun getById(id: Long): Subscription? + suspend fun getById(id: Long): Subscription? @Query("SELECT * FROM subscriptions WHERE calendarId=:calendarId") - fun getByCalendarId(calendarId: Long?): Subscription? + suspend fun getByCalendarId(calendarId: Long?): Subscription? @Query("SELECT * FROM subscriptions WHERE url=:url") - fun getByUrl(url: String): Subscription? + suspend fun getByUrl(url: String): Subscription? @Deprecated( message = "Replace LiveData by Flows", @@ -65,22 +65,22 @@ interface SubscriptionsDao { fun getErrorMessageFlow(id: Long): Flow @Update - fun update(subscription: Subscription) + suspend fun update(subscription: Subscription) @Query("UPDATE subscriptions SET calendarId=:calendarId WHERE id=:id") - fun updateCalendarId(id: Long, calendarId: Long?) + suspend fun updateCalendarId(id: Long, calendarId: Long?) @Query("UPDATE subscriptions SET lastSync=:lastSync, errorMessage=null WHERE id=:id") - fun updateStatusNotModified(id: Long, lastSync: Long = System.currentTimeMillis()) + suspend fun updateStatusNotModified(id: Long, lastSync: Long = System.currentTimeMillis()) @Query("UPDATE subscriptions SET eTag=:eTag, lastModified=:lastModified, lastSync=:lastSync, errorMessage=null WHERE id=:id") - fun updateStatusSuccess(id: Long, eTag: String?, lastModified: Long?, lastSync: Long = System.currentTimeMillis()) + suspend fun updateStatusSuccess(id: Long, eTag: String?, lastModified: Long?, lastSync: Long = System.currentTimeMillis()) @Query("UPDATE subscriptions SET errorMessage=:message WHERE id=:id") - fun updateStatusError(id: Long, message: String?) + suspend fun updateStatusError(id: Long, message: String?) @Query("UPDATE subscriptions SET url=:url WHERE id=:id") - fun updateUrl(id: Long, url: Uri) + suspend fun updateUrl(id: Long, url: Uri) data class SubscriptionWithCredential(