-
Notifications
You must be signed in to change notification settings - Fork 206
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
♻️ Add a translate button to the session details screen. #981
Changes from 6 commits
241cbae
582d9fa
3555bbd
ca1e345
262e5b5
8582a70
31573cb
2e27075
a137fcc
09e293f
ce2aae3
b8ee2b4
e855387
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,8 +117,14 @@ fun SessionsAllResponse.Companion.fake(): SessionsAllResponse { | |
en = "DroidKaigi App Architecture day$day room${room.name.en} index$index", | ||
), | ||
speakers = listOf("1", "2"), | ||
description = "これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n" + | ||
"これはディスクリプションです。\nこれはディスクリプションです。\nこれはディスクリプションです。\n", | ||
description = "\"これはディスクリプションです。\\nこれはディスクリプションです。\\nこれはディスクリプションです。\\n\" +\n" + | ||
"\"これはディスクリプションです。\\nこれはディスクリプションです。\\nこれはディスクリプションです。\\n\",", | ||
i18nDesc = LocaledResponse( | ||
ja = "\"これはディスクリプションです。\\nこれはディスクリプションです。\\nこれはディスクリプションです。\\n\" +\n" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
"\"これはディスクリプションです。\\nこれはディスクリプションです。\\nこれはディスクリプションです。\\n\",", | ||
en = "\"This is a description\\nThis is a description\\nThis is a description\\n\" +\n" + | ||
"\"This is a description\\nThis is a description\\nThis is a description\\n\",", | ||
), | ||
startsAt = start.toString(), | ||
endsAt = end.toString(), | ||
language = "JAPANESE", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,11 @@ import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import io.github.droidkaigi.confsched2023.designsystem.strings.AppStrings | ||
import io.github.droidkaigi.confsched2023.model.Lang | ||
import io.github.droidkaigi.confsched2023.model.SessionsRepository | ||
import io.github.droidkaigi.confsched2023.model.TimetableItem | ||
import io.github.droidkaigi.confsched2023.model.TimetableItemId | ||
import io.github.droidkaigi.confsched2023.model.defaultLang | ||
import io.github.droidkaigi.confsched2023.sessions.section.TimetableItemDetailSectionUiState | ||
import io.github.droidkaigi.confsched2023.sessions.strings.TimetableItemDetailStrings | ||
import io.github.droidkaigi.confsched2023.ui.UserMessageResult | ||
|
@@ -52,9 +54,14 @@ class TimetableItemDetailViewModel @Inject constructor( | |
) | ||
private val viewBookmarkListRequestStateFlow = | ||
MutableStateFlow<ViewBookmarkListRequestState>(ViewBookmarkListRequestState.NotRequested) | ||
private val currentDescriptionLanguage = MutableStateFlow(defaultLang()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initially, I was hoping that the session would be displayed in its original default language. The reason is that it would reflect what the speaker actually wrote. 👀 |
||
|
||
val uiState: StateFlow<TimetableItemDetailScreenUiState> = | ||
buildUiState(timetableItemStateFlow, viewBookmarkListRequestStateFlow) { timetableItemAndBookmark, viewBookmarkListRequestState -> | ||
buildUiState( | ||
timetableItemStateFlow, | ||
viewBookmarkListRequestStateFlow, | ||
currentDescriptionLanguage, | ||
) { timetableItemAndBookmark, viewBookmarkListRequestState, currentLang -> | ||
if (timetableItemAndBookmark == null) { | ||
return@buildUiState TimetableItemDetailScreenUiState.Loading | ||
} | ||
|
@@ -64,6 +71,7 @@ class TimetableItemDetailViewModel @Inject constructor( | |
timetableItemDetailSectionUiState = TimetableItemDetailSectionUiState(timetableItem), | ||
isBookmarked = bookmarked, | ||
viewBookmarkListRequestState = viewBookmarkListRequestState, | ||
currentLang = currentLang, | ||
) | ||
} | ||
|
||
|
@@ -89,4 +97,10 @@ class TimetableItemDetailViewModel @Inject constructor( | |
viewBookmarkListRequestStateFlow.update { ViewBookmarkListRequestState.NotRequested } | ||
} | ||
} | ||
|
||
fun onSelectDescriptionLanguage( | ||
language: Lang, | ||
) { | ||
currentDescriptionLanguage.value = language | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.