From 190b7fe8197c896af66089c34827c084da9bfcdb Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 7 Sep 2023 12:53:19 -0400 Subject: [PATCH] Using the correct observer for picture profile in the Top bar. --- .../com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt index 406eeca5c..a9793d2d4 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt @@ -451,8 +451,6 @@ fun GenericMainTopBar( nav: (String) -> Unit, content: @Composable (AccountViewModel) -> Unit ) { - val coroutineScope = rememberCoroutineScope() - Column(modifier = BottomTopHeight) { MyTopAppBar( elevation = 0.dp, @@ -476,6 +474,7 @@ fun GenericMainTopBar( } }, navigationIcon = { + val coroutineScope = rememberCoroutineScope() LoggedInUserPictureDrawer(accountViewModel) { coroutineScope.launch { scaffoldState.drawerState.open() @@ -506,10 +505,9 @@ private fun LoggedInUserPictureDrawer( accountViewModel: AccountViewModel, onClick: () -> Unit ) { - val accountUserState by accountViewModel.account.userProfile().live().metadata.observeAsState() + val profilePicture by accountViewModel.account.userProfile().live().profilePictureChanges.observeAsState() - val pubkeyHex = remember { accountUserState?.user?.pubkeyHex ?: "" } - val profilePicture = remember(accountUserState) { accountUserState?.user?.profilePicture() } + val pubkeyHex = remember { accountViewModel.userProfile().pubkeyHex } IconButton( onClick = onClick