Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-user dialog not showing issue #127

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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