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/onapp-take-photo #70

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -49,6 +49,8 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ImageBitmap
Expand Down Expand Up @@ -82,6 +84,8 @@ fun SymbolCreationScreen(
) {
val context = LocalContext.current

val showToast = remember { mutableStateOf(false) }

89645321 marked this conversation as resolved.
Show resolved Hide resolved
val uiState by viewModel.uiState.collectAsState()
val categories by viewModel.categories.observeAsState(emptyList())

Expand Down Expand Up @@ -111,14 +115,19 @@ fun SymbolCreationScreen(
if (isGranted) {
cameraLauncher.launch(null)
} else {
Toast.makeText(
context,
"Camera permission is required to take photos",
Toast.LENGTH_SHORT
).show()
showToast.value = true
}
}

if (showToast.value) {
Toast.makeText(
context,
stringResource(id = R.string.camera_permission_description),
Toast.LENGTH_LONG
).show()
showToast.value = false
}

if (creationResultMessage != null) {
LaunchedEffect(key1 = creationResultMessage) {
val toastMessage = context.resources.getString(creationResultMessage!!)
Expand Down Expand Up @@ -262,7 +271,8 @@ private fun DropdownUi(
)
} else {
label?.invoke() ?: Text(
"Select an option", color = MaterialTheme.colorScheme.onSurface
text = stringResource(id = R.string.choose_a_category),
color = MaterialTheme.colorScheme.onSurface
)
}
Icon(
Expand Down
2 changes: 2 additions & 0 deletions frontend/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
<string name="choose_photo_option">사진을 어떻게 추가하실 건가요?</string>
<string name="choose_from_gallery">사진 보관함에서 사진 선택하기</string>
<string name="take_photo">사진 촬영하기</string>
<string name="camera_permission_description">카메라 접근이 허용되지 않았습니다\n기기설정에서 카메라 권한을 허용해주세요</string>
<string name="choose_a_category">대분류를 선택하십시오</string>

<!-- Settings -->
<string name="settings">설정</string>
Expand Down