Make baseUrl and topic unique
This commit is contained in:
parent
fb755d486a
commit
8b2dc16861
2 changed files with 2 additions and 2 deletions
|
@ -4,7 +4,7 @@ import android.content.Context
|
|||
import androidx.room.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Entity
|
||||
@Entity(indices = [Index(value = ["baseUrl", "topic"], unique = true)])
|
||||
data class Subscription(
|
||||
@PrimaryKey val id: Long, // Internal ID, only used in Repository and activities
|
||||
@ColumnInfo(name = "baseUrl") val baseUrl: String,
|
||||
|
|
|
@ -102,7 +102,7 @@ class MainActivity : AppCompatActivity(), AddFragment.AddSubscriptionListener {
|
|||
}
|
||||
|
||||
override fun onSubscribe(topic: String, baseUrl: String) {
|
||||
val subscription = Subscription(Random.nextLong(), topic, baseUrl, messages = 0)
|
||||
val subscription = Subscription(id = Random.nextLong(), baseUrl = baseUrl, topic = topic, messages = 0)
|
||||
subscriptionsViewModel.add(subscription)
|
||||
FirebaseMessaging.getInstance().subscribeToTopic(topic) // FIXME ignores baseUrl
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue