mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 13:27:47 +01:00
Caches the User object to avoid being deleted by the soft reference on Local Cache
This commit is contained in:
@@ -40,13 +40,14 @@ class UserMetadataState(
|
|||||||
val scope: CoroutineScope,
|
val scope: CoroutineScope,
|
||||||
val settings: AccountSettings,
|
val settings: AccountSettings,
|
||||||
) {
|
) {
|
||||||
|
// Creates a long-term reference for this note so that the GC doesn't collect the note it self
|
||||||
|
val user = cache.getOrCreateUser(signer.pubKey)
|
||||||
|
|
||||||
// fun getEphemeralChatListAddress() = cache.getOrCreateUser(signer.pubKey)
|
// fun getEphemeralChatListAddress() = cache.getOrCreateUser(signer.pubKey)
|
||||||
|
|
||||||
fun getUserMetadataUser(): User = cache.getOrCreateUser(signer.pubKey)
|
fun getUserMetadataFlow(): StateFlow<UserState> = user.flow().metadata.stateFlow
|
||||||
|
|
||||||
fun getUserMetadataFlow(): StateFlow<UserState> = getUserMetadataUser().flow().metadata.stateFlow
|
fun getUserMetadataEvent(): MetadataEvent? = user.latestMetadata
|
||||||
|
|
||||||
fun getUserMetadataEvent(): MetadataEvent? = getUserMetadataUser().latestMetadata
|
|
||||||
|
|
||||||
suspend fun sendNewUserMetadata(
|
suspend fun sendNewUserMetadata(
|
||||||
name: String? = null,
|
name: String? = null,
|
||||||
|
|||||||
Reference in New Issue
Block a user