mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 06:47:20 +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 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 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? = getUserMetadataUser().latestMetadata
|
||||
fun getUserMetadataEvent(): MetadataEvent? = user.latestMetadata
|
||||
|
||||
suspend fun sendNewUserMetadata(
|
||||
name: String? = null,
|
||||
|
||||
Reference in New Issue
Block a user