Skip to content

Commit

Permalink
fix: fix non-user dialog not showing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
peng-u-0807 committed Dec 9, 2023
1 parent 1b0c8dc commit 518e6d1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ class UserUseCaseImpl @Inject constructor(
override val accessTokenState: StateFlow<String?>
get() = _accessTokenState

private val _userState: MutableStateFlow<User?> = MutableStateFlow(User(UserDto(EmojiHubApplication.preferences.currentUser ?: "")))
private val isCurrentUserEmpty = EmojiHubApplication.preferences.currentUser.isNullOrEmpty()

private val _userState: MutableStateFlow<User?> = MutableStateFlow(
if (isCurrentUserEmpty) {
null
} else {
User(UserDto(EmojiHubApplication.preferences.currentUser!!))
}
)

override val userState: StateFlow<User?>
get() = _userState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.paging.compose.collectAsLazyPagingItems
import com.goliath.emojihub.LocalBottomSheetController
import com.goliath.emojihub.LocalNavController
import com.goliath.emojihub.NavigationDestination
import com.goliath.emojihub.models.createDummyEmoji
import com.goliath.emojihub.navigateAsOrigin
import com.goliath.emojihub.ui.theme.Color
import com.goliath.emojihub.ui.theme.Color.EmojiHubDividerColor
Expand All @@ -48,7 +47,6 @@ fun FeedPage() {

val currentUser = userViewModel.userState.collectAsState().value

val emojiList = (1..10).map { createDummyEmoji() }
val postList = postViewModel.postList.collectAsLazyPagingItems()

var showNonUserDialog by remember { mutableStateOf(false) }
Expand Down

0 comments on commit 518e6d1

Please sign in to comment.