-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Un)subscribe from AccountActivity's WebcalFragment
- Loading branch information
Showing
6 changed files
with
88 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/src/main/kotlin/at/bitfire/davdroid/db/WebcalSubscriptionDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package at.bitfire.davdroid.db | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Delete | ||
import androidx.room.Insert | ||
import androidx.room.OnConflictStrategy | ||
import androidx.room.Query | ||
import androidx.room.Transaction | ||
|
||
@Dao | ||
interface WebcalSubscriptionDao { | ||
|
||
@Query("SELECT * FROM webcal_subscription WHERE collectionId=:collectionId") | ||
fun getByCollectionId(collectionId: Long): WebcalSubscription? | ||
|
||
@Insert(onConflict = OnConflictStrategy.REPLACE) | ||
fun insert(subscription: WebcalSubscription): Long | ||
|
||
@Delete | ||
fun delete(subscription: WebcalSubscription) | ||
|
||
|
||
@Transaction | ||
fun insertAndUpdateCollection(collectionDao: CollectionDao, subscription: WebcalSubscription) { | ||
insert(subscription) | ||
subscription.collectionId?.let { collectionId -> | ||
collectionDao.updateSync(collectionId, true) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters