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

재생 목록 추가시 UI 즉시 반영 #327

Merged
merged 1 commit into from
Dec 12, 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 @@ -18,7 +18,7 @@ import dagger.hilt.android.AndroidEntryPoint
class PlaylistsFragment : BaseFragment<FragmentPlaylistsBinding>(R.layout.fragment_playlists),
NewPlaylistDialog.NewPlaylistDialogListener {

val viewModel: PlaylistViewModel by viewModels()
val viewModel: PlaylistsViewModel by viewModels()

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand Down Expand Up @@ -57,7 +57,6 @@ class PlaylistsFragment : BaseFragment<FragmentPlaylistsBinding>(R.layout.fragme
override fun onPositiveButtonClicked(dialog: DialogFragment, title: String) {
viewModel.createPlaylist(title)
}

}

private fun NavController.navigateToPlaylistDetail(playlistId: Int, title: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.ohdodok.catchytape.core.domain.model.CtErrorType
import com.ohdodok.catchytape.core.domain.model.CtException
import com.ohdodok.catchytape.core.domain.model.Playlist
import com.ohdodok.catchytape.core.domain.repository.PlaylistRepository
import com.ohdodok.catchytape.core.ui.model.PlaylistUiModel
import com.ohdodok.catchytape.core.domain.usecase.playlist.GetPlaylistsUseCase
import com.ohdodok.catchytape.core.ui.model.PlaylistUiModel
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.flow.MutableSharedFlow
Expand All @@ -27,7 +27,7 @@ data class PlaylistsUiState(
)

@HiltViewModel
class PlaylistViewModel @Inject constructor(
class PlaylistsViewModel @Inject constructor(
private val getPlaylistsUseCase: GetPlaylistsUseCase,
private val playlistRepository: PlaylistRepository
) : ViewModel() {
Expand Down Expand Up @@ -70,6 +70,7 @@ class PlaylistViewModel @Inject constructor(
fun createPlaylist(playlistTitle: String) {
viewModelScopeWithExceptionHandler.launch {
playlistRepository.postPlaylist(playlistTitle)
fetchPlaylists()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<variable
name="viewModel"
type="com.ohdodok.catchytape.feature.playlist.PlaylistViewModel" />
type="com.ohdodok.catchytape.feature.playlist.PlaylistsViewModel" />

</data>

Expand Down