Skip to content

Commit

Permalink
oops ignored important stuff :(
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Aug 1, 2024
1 parent 172a5d5 commit 9c52cf1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
/shared
/shared/.gradle
buildSrc/build
buildSrc/.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.rebble.cobble.shared.database.dao

import androidx.room.*
import io.rebble.cobble.shared.database.entity.NotificationChannel

@Dao
interface NotificationChannelDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(notification: NotificationChannel)

@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insertAllIfNotExists(notifications: List<NotificationChannel>)

@Update
suspend fun update(notification: NotificationChannel)

@Delete
suspend fun delete(notification: NotificationChannel)

@Query("SELECT * FROM NotificationChannel WHERE packageId = :packageId AND channelId = :channelId")
suspend fun get(packageId: String, channelId: String): NotificationChannel?

@Query("UPDATE NotificationChannel SET shouldNotify = :shouldNotify WHERE packageId = :packageId AND channelId = :channelId")
suspend fun setShouldNotify(packageId: String, channelId: String, shouldNotify: Boolean)

@Query("SELECT conversationId FROM NotificationChannel WHERE packageId = :packageId AND channelId = :channelId")
suspend fun getConversationId(packageId: String, channelId: String): String?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package io.rebble.cobble.shared.database.entity

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(primaryKeys = ["packageId", "channelId"])
data class NotificationChannel(
val packageId: String,
val channelId: String,
val name: String?,
val description: String?,
val conversationId: String?,
val shouldNotify: Boolean,
)

0 comments on commit 9c52cf1

Please sign in to comment.