diff --git a/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyButton.kt b/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyButton.kt index 832b03a4..b82eb48c 100644 --- a/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyButton.kt +++ b/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyButton.kt @@ -42,9 +42,9 @@ fun RecordyButton( text = text, shape = shape, onClick = onClick, - backgroundColor = if (enabled) backgroundColor else RecordyTheme.colors.gray08, + backgroundColor = if (enabled) backgroundColor else RecordyTheme.colors.gray11, rippleColor = rippleColor, - textColor = if (enabled) textColor else RecordyTheme.colors.gray06, + textColor = if (enabled) textColor else RecordyTheme.colors.gray08, clickable = clickable, padding = PaddingValues(15.dp), textStyle = textStyle, diff --git a/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyImgButton.kt b/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyImgButton.kt new file mode 100644 index 00000000..a6a1b6a3 --- /dev/null +++ b/core/designsystem/src/main/java/com/record/designsystem/component/button/RecordyImgButton.kt @@ -0,0 +1,79 @@ +package com.record.designsystem.component.button + +import androidx.annotation.DrawableRes +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.record.designsystem.R +import com.record.designsystem.theme.Black +import com.record.designsystem.theme.RecordyTheme +import com.record.ui.extension.customClickable +import timber.log.Timber + +@Composable +fun RecordyImgButton( + modifier: Modifier = Modifier, + text: String, + textStyle: TextStyle = RecordyTheme.typography.body2M, + shape: Shape = RoundedCornerShape(8.dp), + onClick: () -> Unit = {}, + backgroundColor: Color = RecordyTheme.colors.gray10, + textColor: Color = RecordyTheme.colors.gray06, + @DrawableRes icon: Int, +) { + Box( + modifier = modifier + .fillMaxWidth() + .clip(shape) + .background(color = backgroundColor) + .border(width = 1.dp, color = backgroundColor, shape = shape) + .padding(vertical = 14.dp, horizontal = 18.dp) + .customClickable(rippleEnabled = false, onClick = { onClick() }), + ) { + Image(modifier = Modifier.align(Alignment.CenterEnd).padding(end = 4.dp), painter = painterResource(id = icon), contentDescription = null) + Text( + text = text, + style = textStyle, + color = textColor, + modifier = Modifier.align(Alignment.CenterStart), + ) + } +} + +@Preview(showBackground = true, backgroundColor = 0xFFFFFF) +@Composable +fun RecordyImgButtonPreview() { + RecordyTheme { + RecordyTheme { + Column( + modifier = Modifier + .background(Black) + .padding(vertical = 10.dp, horizontal = 10.dp), + verticalArrangement = Arrangement.spacedBy(10.dp), + ) { + RecordyImgButton( + icon = R.drawable.ic_move_18, + text = "키워드", + onClick = { Timber.d("basic key word") }, + ) + } + } + } +} diff --git a/core/designsystem/src/main/java/com/record/designsystem/component/dialog/RecordyDialog.kt b/core/designsystem/src/main/java/com/record/designsystem/component/dialog/RecordyDialog.kt index 44f41a3c..a650082e 100644 --- a/core/designsystem/src/main/java/com/record/designsystem/component/dialog/RecordyDialog.kt +++ b/core/designsystem/src/main/java/com/record/designsystem/component/dialog/RecordyDialog.kt @@ -38,7 +38,7 @@ fun RecordyDialog( Column( modifier = Modifier .fillMaxWidth() - .background(color = RecordyTheme.colors.gray08, shape = shape) + .background(color = RecordyTheme.colors.gray10, shape = shape) .padding(horizontal = 16.dp) .padding(bottom = 24.dp, top = 28.dp), horizontalAlignment = Alignment.CenterHorizontally, diff --git a/core/designsystem/src/main/java/com/record/designsystem/component/navbar/TopNavigationBar.kt b/core/designsystem/src/main/java/com/record/designsystem/component/navbar/TopNavigationBar.kt index 935a2abf..ba442bc9 100644 --- a/core/designsystem/src/main/java/com/record/designsystem/component/navbar/TopNavigationBar.kt +++ b/core/designsystem/src/main/java/com/record/designsystem/component/navbar/TopNavigationBar.kt @@ -24,16 +24,11 @@ fun TopNavigationBar( title: String = "", enableGradation: Boolean = false, ) { - val gradient = Brush.verticalGradient( - colors = listOf( - if (enableGradation) Background.copy(alpha = 0f) else Background, - Background, - ), - ) + val gradient = Brush.verticalGradient(listOf(Color(0x339babfb), Color(0x00000000))) Box( modifier = if (enableGradation) { modifier - .background(brush = Brush.verticalGradient(listOf(Color(0x339babfb), Color(0x00000000)))) + .background(RecordyTheme.colors.background) .fillMaxWidth() .padding( top = 45.dp, @@ -41,7 +36,7 @@ fun TopNavigationBar( ) } else { modifier - .background(Background) + .background(RecordyTheme.colors.background) .fillMaxWidth() .padding( top = 45.dp, diff --git a/core/designsystem/src/main/java/com/record/designsystem/component/textfield/RecordyBasicTextField.kt b/core/designsystem/src/main/java/com/record/designsystem/component/textfield/RecordyBasicTextField.kt index 8062efdf..b67cedb1 100644 --- a/core/designsystem/src/main/java/com/record/designsystem/component/textfield/RecordyBasicTextField.kt +++ b/core/designsystem/src/main/java/com/record/designsystem/component/textfield/RecordyBasicTextField.kt @@ -34,10 +34,10 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.record.designsystem.theme.Alert01 import com.record.designsystem.theme.Black -import com.record.designsystem.theme.Gray01 import com.record.designsystem.theme.Gray03 +import com.record.designsystem.theme.Gray05 import com.record.designsystem.theme.Gray06 -import com.record.designsystem.theme.Gray08 +import com.record.designsystem.theme.Gray10 import com.record.designsystem.theme.RecordyTheme import com.record.designsystem.theme.ViskitYellow500 @@ -84,7 +84,7 @@ fun RecordyBasicTextField( if (newValue.replace(" ", "").length <= maxLength) onValueChange(newValue) }, singleLine = maxLines == 1, - textStyle = textStyle.copy(Gray01), + textStyle = textStyle.copy(Gray05), maxLines = if (minLines > maxLines) minLines else maxLines, minLines = minLines, interactionSource = interactionSource, @@ -103,7 +103,7 @@ fun RecordyBasicTextField( .heightIn(minHeight) .fillMaxWidth() .clip(shape = shape) - .background(color = Gray08) + .background(color = Gray10) .border( width = 1.dp, color = borderLineColor, diff --git a/core/designsystem/src/main/res/drawable/ic_alert_warning_80.xml b/core/designsystem/src/main/res/drawable/ic_alert_warning_80.xml new file mode 100644 index 00000000..55807105 --- /dev/null +++ b/core/designsystem/src/main/res/drawable/ic_alert_warning_80.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + diff --git a/core/designsystem/src/main/res/drawable/ic_move_18.xml b/core/designsystem/src/main/res/drawable/ic_move_18.xml new file mode 100644 index 00000000..232cd4ac --- /dev/null +++ b/core/designsystem/src/main/res/drawable/ic_move_18.xml @@ -0,0 +1,9 @@ + + + diff --git a/core/model/src/main/java/com/record/model/AlertInfo.kt b/core/model/src/main/java/com/record/model/AlertInfo.kt new file mode 100644 index 00000000..689a96d7 --- /dev/null +++ b/core/model/src/main/java/com/record/model/AlertInfo.kt @@ -0,0 +1,9 @@ +package com.record.model + +data class AlertInfo( + val showDialog: Boolean = false, + val title: String = "", + val subTitle: String = "", + val negativeButtonLabel: String = "", + val positiveButtonLabel: String = "", +) diff --git a/core/model/src/main/java/com/record/model/CoreData.kt b/core/model/src/main/java/com/record/model/CoreData.kt deleted file mode 100644 index 03440ecc..00000000 --- a/core/model/src/main/java/com/record/model/CoreData.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.record.model - -data class CoreData( - val a: Int, - val b: String, -) diff --git a/core/workmanager/src/main/java/com/record/workmanager/upload/UploadEnqueuer.kt b/core/workmanager/src/main/java/com/record/workmanager/upload/UploadEnqueuer.kt index acc79ef6..0202451d 100644 --- a/core/workmanager/src/main/java/com/record/workmanager/upload/UploadEnqueuer.kt +++ b/core/workmanager/src/main/java/com/record/workmanager/upload/UploadEnqueuer.kt @@ -1,5 +1,5 @@ package com.record.workmanager.upload interface UploadEnqueuer { - fun enqueueUploadWork(videoPath: String, location: String, keywords: String, content: String) + fun enqueueUploadWork(videoPath: String, content: String, placeId: Long) } diff --git a/core/workmanager/src/main/java/com/record/workmanager/upload/UploadTask.kt b/core/workmanager/src/main/java/com/record/workmanager/upload/UploadTask.kt index d0536113..d3135bf8 100644 --- a/core/workmanager/src/main/java/com/record/workmanager/upload/UploadTask.kt +++ b/core/workmanager/src/main/java/com/record/workmanager/upload/UploadTask.kt @@ -1,5 +1,5 @@ package com.record.workmanager.upload interface UploadTask { - suspend fun upload(videoPath: String, location: String, content: String, keywords: String): Result + suspend fun upload(videoPath: String, content: String, placeId: Long): Result } diff --git a/core/workmanager/src/main/java/com/record/workmanager/upload/UploadWorker.kt b/core/workmanager/src/main/java/com/record/workmanager/upload/UploadWorker.kt index 39b16e2f..679b122a 100644 --- a/core/workmanager/src/main/java/com/record/workmanager/upload/UploadWorker.kt +++ b/core/workmanager/src/main/java/com/record/workmanager/upload/UploadWorker.kt @@ -15,10 +15,9 @@ class UploadWorker @AssistedInject constructor( ) : CoroutineWorker(context, params) { override suspend fun doWork(): Result { val videoPath = inputData.getString(KEY_VIDEO_PATH) ?: return Result.failure() - val location = inputData.getString(KEY_LOCATION) ?: return Result.failure() - val keywords = inputData.getString(KEY_KEYWORDS) ?: return Result.failure() + val placeId = inputData.getString(KEY_PLACE) ?: return Result.failure() val content = inputData.getString(KEY_CONTENT) ?: return Result.failure() - val result = uploadTask.upload(videoPath, location, content, keywords) + val result = uploadTask.upload(videoPath, content, placeId = placeId.toLong()) return result.fold( onSuccess = { @@ -32,8 +31,7 @@ class UploadWorker @AssistedInject constructor( companion object { const val KEY_VIDEO_PATH = "videoPath" - const val KEY_LOCATION = "location" - const val KEY_KEYWORDS = "keywords" + const val KEY_PLACE = "placeId" const val KEY_CONTENT = "content" const val UNIQUE_UPLOAD_WORK = "upload-work" } diff --git a/core/workmanager/src/main/java/com/record/workmanager/upload/impl/UploadEnqueuerImpl.kt b/core/workmanager/src/main/java/com/record/workmanager/upload/impl/UploadEnqueuerImpl.kt index 9900b3d6..0aa77552 100644 --- a/core/workmanager/src/main/java/com/record/workmanager/upload/impl/UploadEnqueuerImpl.kt +++ b/core/workmanager/src/main/java/com/record/workmanager/upload/impl/UploadEnqueuerImpl.kt @@ -11,11 +11,10 @@ import javax.inject.Inject class UploadEnqueuerImpl @Inject constructor( private val workManager: WorkManager, ) : UploadEnqueuer { - override fun enqueueUploadWork(videoPath: String, location: String, keywords: String, content: String) { + override fun enqueueUploadWork(videoPath: String, content: String, placeId: Long) { val data = Data.Builder() .putString(UploadWorker.KEY_VIDEO_PATH, videoPath) - .putString(UploadWorker.KEY_LOCATION, location) - .putString(UploadWorker.KEY_KEYWORDS, keywords) + .putString(UploadWorker.KEY_PLACE, placeId.toString()) .putString(UploadWorker.KEY_CONTENT, content) .build() val request = OneTimeWorkRequestBuilder() diff --git a/data/video/src/main/java/com/record/video/model/remote/request/RequestPostVideoDto.kt b/data/video/src/main/java/com/record/video/model/remote/request/RequestPostVideoDto.kt index 101c00be..c2960e72 100644 --- a/data/video/src/main/java/com/record/video/model/remote/request/RequestPostVideoDto.kt +++ b/data/video/src/main/java/com/record/video/model/remote/request/RequestPostVideoDto.kt @@ -11,10 +11,8 @@ data class RequestPostVideoDto( val content: String, @SerialName("fileUrl") val fileUrl: FileUrl, - @SerialName("keywords") - val keywords: String, - @SerialName("location") - val location: String, + @SerialName("placeId") + val placeId: Long, ) fun VideoInfo.toData() = RequestPostVideoDto( @@ -23,6 +21,5 @@ fun VideoInfo.toData() = RequestPostVideoDto( videoUrl = videoUrl, thumbnailUrl = previewUrl, ), - keywords = keywords, - location = location, + placeId = placeId, ) diff --git a/data/video/src/main/java/com/record/video/repository/UploadRepositoryImpl.kt b/data/video/src/main/java/com/record/video/repository/UploadRepositoryImpl.kt index ba5ad28d..d943e719 100644 --- a/data/video/src/main/java/com/record/video/repository/UploadRepositoryImpl.kt +++ b/data/video/src/main/java/com/record/video/repository/UploadRepositoryImpl.kt @@ -15,7 +15,7 @@ class UploadRepositoryImpl @Inject constructor( private val localVideoDataSource: LocalVideoDataSource, ) : UploadRepository { override suspend fun upload(recordInfo: RecordInfo) { - uploadEnqueuer.enqueueUploadWork(recordInfo.videoPath, recordInfo.location, recordInfo.keywords, recordInfo.content) + uploadEnqueuer.enqueueUploadWork(recordInfo.videoPath, recordInfo.content, recordInfo.placeId) } override suspend fun getVideosFromGallery(page: Int, loadSize: Int, currentLocation: String?): Result> = runCatching { diff --git a/data/video/src/main/java/com/record/video/repository/UploadTaskImpl.kt b/data/video/src/main/java/com/record/video/repository/UploadTaskImpl.kt index 95f2af3f..c4215889 100644 --- a/data/video/src/main/java/com/record/video/repository/UploadTaskImpl.kt +++ b/data/video/src/main/java/com/record/video/repository/UploadTaskImpl.kt @@ -13,7 +13,7 @@ class UploadTaskImpl @Inject constructor( private val remoteUploadDataSource: RemoteUploadDataSource, private val uploadBroadCaster: UploadBroadCaster, ) : UploadTask { - override suspend fun upload(videoPath: String, location: String, content: String, keywords: String): Result { + override suspend fun upload(videoPath: String, content: String, placeId: Long): Result { val result = runCatching { uploadBroadCaster.sendUploadStart() val urls = remoteUploadDataSource.getUploadUrl() @@ -31,11 +31,10 @@ class UploadTaskImpl @Inject constructor( remoteUploadDataSource.uploadThumbnailToS3Bucket(previewUrl, File(videoPath)).let { previewUri -> remoteUploadDataSource.uploadRecord( VideoInfo( - location = location, content = content, - keywords = keywords, videoUrl = videoUri, previewUrl = previewUri, + placeId = placeId, ).toData(), ) } diff --git a/domain/upload/src/main/java/com/record/upload/model/RecordInfo.kt b/domain/upload/src/main/java/com/record/upload/model/RecordInfo.kt index d1194943..4afc0a33 100644 --- a/domain/upload/src/main/java/com/record/upload/model/RecordInfo.kt +++ b/domain/upload/src/main/java/com/record/upload/model/RecordInfo.kt @@ -2,7 +2,6 @@ package com.record.upload.model data class RecordInfo( val videoPath: String, - val location: String, val content: String, - val keywords: String, + val placeId: Long, ) diff --git a/domain/upload/src/main/java/com/record/upload/model/VideoInfo.kt b/domain/upload/src/main/java/com/record/upload/model/VideoInfo.kt index 7b372af9..2da9d2db 100644 --- a/domain/upload/src/main/java/com/record/upload/model/VideoInfo.kt +++ b/domain/upload/src/main/java/com/record/upload/model/VideoInfo.kt @@ -1,9 +1,8 @@ package com.record.upload.model data class VideoInfo( - val location: String, val content: String, - val keywords: String, + val placeId: Long, val videoUrl: String, val previewUrl: String, ) diff --git a/feature/mypage/src/main/java/com/record/mypage/MypageScreen.kt b/feature/mypage/src/main/java/com/record/mypage/MypageScreen.kt index 372f933f..eb87468b 100644 --- a/feature/mypage/src/main/java/com/record/mypage/MypageScreen.kt +++ b/feature/mypage/src/main/java/com/record/mypage/MypageScreen.kt @@ -64,7 +64,7 @@ fun MypageRoute( navigateToFollower: () -> Unit, navigateToFollowing: () -> Unit, navigateToUplaod: () -> Unit, - navigateToHome: () -> Unit, + navigateVideoHome: () -> Unit, navigateToVideo: (VideoType, Long) -> Unit, ) { val uiState by viewModel.uiState.collectAsStateWithLifecycle() @@ -109,7 +109,7 @@ fun MypageRoute( onLoadMoreRecords = viewModel::loadMoreUserVideos, onBookmarkClick = viewModel::bookmark, navigateToUpload = navigateToUplaod, - navigateToHome = navigateToHome, + navigateVideoHome = navigateVideoHome, ) } } @@ -124,9 +124,9 @@ fun MypageScreen( onFollowingClick: () -> Unit, navigateToVideo: (VideoType, Long) -> Unit, navigateToUpload: () -> Unit, - navigateToHome: () -> Unit, onLoadMoreRecords: () -> Unit, onLoadMoreBookmarks: () -> Unit, + navigateVideoHome: () -> Unit, onBookmarkClick: (Long) -> Unit, ) { val pagerState = rememberPagerState( @@ -229,7 +229,7 @@ fun MypageScreen( onItemClick = navigateToVideo, onLoadMore = onLoadMoreBookmarks, onBookmarkClick = onBookmarkClick, - navigateToHome = navigateToHome, + navigateToVideo = navigateVideoHome, ) } } diff --git a/feature/mypage/src/main/java/com/record/mypage/navigation/MypageNavigation.kt b/feature/mypage/src/main/java/com/record/mypage/navigation/MypageNavigation.kt index 6311b5b3..f703f14a 100644 --- a/feature/mypage/src/main/java/com/record/mypage/navigation/MypageNavigation.kt +++ b/feature/mypage/src/main/java/com/record/mypage/navigation/MypageNavigation.kt @@ -32,6 +32,7 @@ fun NavGraphBuilder.mypageNavGraph( navigateToUpload: () -> Unit, navigateToHome: () -> Unit, navigateToProfile: (Long) -> Unit, + navigateVideoHome: () -> Unit, navigateToVideo: (VideoType, Long) -> Unit, ) { composable(route = MypageRoute.route) { @@ -43,7 +44,7 @@ fun NavGraphBuilder.mypageNavGraph( navigateToFollower = navigateToFollower, navigateToVideo = navigateToVideo, navigateToUplaod = navigateToUpload, - navigateToHome = navigateToHome, + navigateVideoHome = navigateVideoHome, ) } composable(route = MypageRoute.followingRoute) { diff --git a/feature/mypage/src/main/java/com/record/mypage/screen/BookmarkScreen.kt b/feature/mypage/src/main/java/com/record/mypage/screen/BookmarkScreen.kt index 7c363387..3985180a 100644 --- a/feature/mypage/src/main/java/com/record/mypage/screen/BookmarkScreen.kt +++ b/feature/mypage/src/main/java/com/record/mypage/screen/BookmarkScreen.kt @@ -31,7 +31,7 @@ fun BookmarkScreen( onItemClick: (VideoType, Long) -> Unit, onLoadMore: () -> Unit, onBookmarkClick: (Long) -> Unit, - navigateToHome: () -> Unit, + navigateToVideo: () -> Unit, ) { val lazyGridState = rememberLazyGridState() lazyGridState.OnBottomReached(2) { @@ -63,7 +63,7 @@ fun BookmarkScreen( showButton = true, selectedTab = MypageTab.BOOKMARK, onButtonClick = { - navigateToHome() + navigateToVideo() }, ) } diff --git a/feature/navigator/src/main/java/com/record/navigator/MainNavigator.kt b/feature/navigator/src/main/java/com/record/navigator/MainNavigator.kt index 892e8e4e..410dc9e5 100644 --- a/feature/navigator/src/main/java/com/record/navigator/MainNavigator.kt +++ b/feature/navigator/src/main/java/com/record/navigator/MainNavigator.kt @@ -97,7 +97,9 @@ internal class MainNavigator( fun navigateMypage() { navController.navigateMypage(navOptions { }) } - + fun navigateToVideo() { + navController.navigateVideo(null) + } fun navigateVideoDetail(videoType: VideoType, videoId: Long, keyword: String? = "all", userId: Long = 0) { navController.navigateVideoDetail( videoType = videoType, diff --git a/feature/navigator/src/main/java/com/record/navigator/MainScreen.kt b/feature/navigator/src/main/java/com/record/navigator/MainScreen.kt index 21519c0a..3d0a0728 100644 --- a/feature/navigator/src/main/java/com/record/navigator/MainScreen.kt +++ b/feature/navigator/src/main/java/com/record/navigator/MainScreen.kt @@ -130,6 +130,7 @@ internal fun MainScreen( navigateToProfile = navigator::navigateProfile, navigateToUpload = navigator::navigateToUpload, navigateToHome = navigator::navigateHome, + navigateVideoHome = navigator::navigateToVideo, ) settingNavGraph( diff --git a/feature/upload/src/main/java/com/record/upload/UploadContract.kt b/feature/upload/src/main/java/com/record/upload/UploadContract.kt index 8209a062..0ea928ed 100644 --- a/feature/upload/src/main/java/com/record/upload/UploadContract.kt +++ b/feature/upload/src/main/java/com/record/upload/UploadContract.kt @@ -1,6 +1,7 @@ package com.record.upload import com.record.designsystem.component.snackbar.SnackBarType +import com.record.model.AlertInfo import com.record.ui.base.SideEffect import com.record.ui.base.UiState import com.record.upload.model.GalleryVideo @@ -15,8 +16,7 @@ data class UploadState( val galleryPage: Int = 1, val isItemLoading: Boolean = false, val video: GalleryVideo? = null, - val showShouldShowRationaleDialog: Boolean = false, - val showExitUploadDialog: Boolean = false, + val alertInfo: AlertInfo = AlertInfo(), val isSelectedVideoSheetOpen: Boolean = false, val isSelectedDefinedContentSheetOpen: Boolean = false, val buttonEnabled: Boolean = false, diff --git a/feature/upload/src/main/java/com/record/upload/UploadViewModel.kt b/feature/upload/src/main/java/com/record/upload/UploadViewModel.kt index a53742de..873adfec 100644 --- a/feature/upload/src/main/java/com/record/upload/UploadViewModel.kt +++ b/feature/upload/src/main/java/com/record/upload/UploadViewModel.kt @@ -1,9 +1,9 @@ package com.record.upload import androidx.lifecycle.viewModelScope -import com.record.common.util.encodingString import com.record.designsystem.component.snackbar.SnackBarType import com.record.keyword.repository.KeywordRepository +import com.record.model.AlertInfo import com.record.ui.base.BaseViewModel import com.record.upload.model.GalleryVideo import com.record.upload.model.RecordInfo @@ -34,9 +34,8 @@ class UploadViewModel @Inject constructor( val recordInfo = RecordInfo( filePath, - uiState.value.locationTextValue, uiState.value.contentTextValue, - keywords = encodingString(uiState.value.selectedList.joinToString(separator = ",")).trim(), + placeId = 0, ) uploadRepository.upload(recordInfo) popBackStack() @@ -75,19 +74,35 @@ class UploadViewModel @Inject constructor( } fun showShouldShowRationaleDialog() = intent { - copy(showShouldShowRationaleDialog = true) + copy( + alertInfo = AlertInfo( + showDialog = true, + title = "필수 권한을 허용해주세요", + subTitle = "프로필 사진 업로드를 위해 \n사진 라이브러리에 접근하도록 허용해 주세요.", + negativeButtonLabel = "닫기", + positiveButtonLabel = "지금 설정", + ), + ) } - fun hideShouldShowRationaleDialog() = intent { - copy(showShouldShowRationaleDialog = false) + fun hideUploadDialog() = intent { + copy( + alertInfo = AlertInfo( + showDialog = false, + ), + ) } fun showExitUploadDialog() = intent { - copy(showExitUploadDialog = true) - } - - fun hideExitUploadDialog() = intent { - copy(showExitUploadDialog = false) + copy( + alertInfo = AlertInfo( + showDialog = true, + title = "화면을 나가시겠어요?", + subTitle = "지금까지 작성하신 내용이 모두 사라져요.", + negativeButtonLabel = "취소", + positiveButtonLabel = "나가기", + ), + ) } fun showIsSelectedVideoSheetOpen() = intent { diff --git a/feature/upload/src/main/java/com/record/upload/VideoPickerScreen.kt b/feature/upload/src/main/java/com/record/upload/VideoPickerScreen.kt index 0993a380..1bf762aa 100644 --- a/feature/upload/src/main/java/com/record/upload/VideoPickerScreen.kt +++ b/feature/upload/src/main/java/com/record/upload/VideoPickerScreen.kt @@ -17,9 +17,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi -import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -64,7 +62,7 @@ import com.google.accompanist.permissions.rememberPermissionState import com.google.accompanist.permissions.shouldShowRationale import com.record.designsystem.R import com.record.designsystem.component.button.RecordyButton -import com.record.designsystem.component.button.RecordyChipButton +import com.record.designsystem.component.button.RecordyImgButton import com.record.designsystem.component.dialog.RecordyDialog import com.record.designsystem.component.navbar.TopNavigationBar import com.record.designsystem.component.snackbar.SnackBarType @@ -135,9 +133,8 @@ fun VideoPickerRoute( contentFocusRequester = locationFocusRequester, updateLocationTextField = viewModel::updateLocationTextField, showShouldShowRationaleDialog = viewModel::showShouldShowRationaleDialog, + hideExitUploadDialog = viewModel::hideUploadDialog, updateContentTextField = viewModel::updateContentTextField, - hideShouldShowRationaleDialog = viewModel::hideShouldShowRationaleDialog, - hideExitUploadDialog = viewModel::hideExitUploadDialog, showIsSelectedVideoSheetOpen = viewModel::showIsSelectedVideoSheetOpen, hideIsSelectedVideoSheetOpen = viewModel::hideIsSelectedVideoSheetOpen, showIsSelectedDefinedContentSheetOpen = viewModel::showIsSelectedDefinedContentSheetOpen, @@ -161,7 +158,6 @@ fun VideoPickerScreen( onClickVideo: (GalleryVideo) -> Unit, onClickUpload: () -> Unit, showShouldShowRationaleDialog: () -> Unit = {}, - hideShouldShowRationaleDialog: () -> Unit = {}, hideExitUploadDialog: () -> Unit = {}, showIsSelectedVideoSheetOpen: () -> Unit = {}, hideIsSelectedVideoSheetOpen: () -> Unit = {}, @@ -237,17 +233,14 @@ fun VideoPickerScreen( ) Column( modifier = Modifier - .padding(horizontal = 16.dp), + .padding(top = 16.dp) + .weight(1f) + .fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, ) { - Text( - text = "영상", - color = RecordyTheme.colors.white, - style = RecordyTheme.typography.subtitle, - modifier = Modifier.padding(top = 20.dp, bottom = 9.dp), - ) Box( modifier = Modifier - .background(RecordyTheme.colors.gray08, shape = RoundedCornerShape(16.dp)) + .background(RecordyTheme.colors.gray10, shape = RoundedCornerShape(16.dp)) .customClickable( onClick = { if (cameraPermissionState.status.isGranted) { @@ -284,7 +277,7 @@ fun VideoPickerScreen( ) Text( text = "영상 선택", - color = RecordyTheme.colors.white, + color = RecordyTheme.colors.gray01, style = RecordyTheme.typography.subtitle, ) } @@ -303,100 +296,43 @@ fun VideoPickerScreen( ) } } - } - Text( - text = "키워드", - color = RecordyTheme.colors.white, - style = RecordyTheme.typography.subtitle, - modifier = Modifier - .padding(horizontal = 16.dp) - .padding(top = 22.dp, bottom = 12.dp), - ) - FlowRow( - modifier = Modifier - .padding(vertical = 8.dp) - .padding(start = 16.dp, end = 12.dp) - .customClickable(onClick = showIsSelectedDefinedContentSheetOpen), - verticalArrangement = Arrangement.spacedBy(12.dp), - horizontalArrangement = Arrangement.spacedBy(9.dp), - ) { - state.selectedList.forEach { - RecordyChipButton( - text = it, - isActive = true, - isCheckSmall = false, - onClick = { }, - ) - } - Row( + RecordyBasicTextField( + placeholder = "나의 생각을 자유롭게 적어주세요!", + maxLines = 20, + maxLength = 300, + minHeight = 80.dp, + value = state.contentTextValue, modifier = Modifier - .background(RecordyTheme.colors.gray08, shape = RoundedCornerShape(30.dp)) - .padding( - start = 8.dp, - top = 10.dp, - end = 12.dp, - bottom = 10.dp, - ), - - horizontalArrangement = Arrangement.Center, - verticalAlignment = Alignment.CenterVertically, - ) { - Image( - painter = painterResource(id = R.drawable.ic_plus_16), - contentDescription = null, - ) - Text( - text = "키워드", - color = RecordyTheme.colors.gray03, - style = RecordyTheme.typography.body2M, - ) - } + .padding(horizontal = 16.dp) + .padding(top = 24.dp) + .focusRequester(contentFocusRequester), + onValueChange = updateContentTextField, + ) + RecordyImgButton( + modifier = Modifier.padding(16.dp), + icon = R.drawable.ic_move_18, + text = "장소", + onClick = { Timber.d("basic key word") }, + ) + RecordyBasicTextField( + modifier = Modifier + .padding(horizontal = 16.dp) + .focusRequester(locationFocusRequester), + placeholder = "전시명을 입력해 주세요.", + maxLines = 1, + maxLength = 20, + value = state.locationTextValue, + onValueChange = updateLocationTextField, + keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Done), + ) } - Text( - text = "위치", - color = RecordyTheme.colors.white, - style = RecordyTheme.typography.subtitle, - modifier = Modifier - .padding(horizontal = 16.dp) - .padding(top = 20.dp, bottom = 12.dp), - ) - RecordyBasicTextField( - modifier = Modifier - .padding(horizontal = 16.dp) - .focusRequester(locationFocusRequester), - placeholder = "영상 속 위치는 어디인가요?", - maxLines = 1, - maxLength = 20, - value = state.locationTextValue, - onValueChange = updateLocationTextField, - keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Done), - ) - Text( - text = "내용", - color = RecordyTheme.colors.white, - style = RecordyTheme.typography.subtitle, - modifier = Modifier - .padding(horizontal = 16.dp) - .padding(top = 10.dp, bottom = 12.dp), - ) - RecordyBasicTextField( - placeholder = "공간에 대한 나의 생각을 자유롭게 적어주세요!", - maxLines = 20, - maxLength = 300, - minHeight = 148.dp, - value = state.contentTextValue, - modifier = Modifier - .padding(horizontal = 16.dp) - .padding(bottom = 10.dp) - .focusRequester(contentFocusRequester), - onValueChange = updateContentTextField, - ) + Box(modifier = Modifier.padding(16.dp)) { RecordyButton( - text = "업로드", - enabled = state.selectedList.isNotEmpty() && state.locationTextValue.isNotEmpty() && state.video != null, + text = "다음", + enabled = state.locationTextValue.isNotEmpty() && state.video != null, onClick = { - if (state.selectedList.isNotEmpty() && state.locationTextValue.isNotEmpty() && state.video != null) { + if (state.video != null) { onClickUpload() // compressVideo(context, state.video.uri,state.video.name, onSuccess = onSuccess) } @@ -405,31 +341,23 @@ fun VideoPickerScreen( } } - if (state.showShouldShowRationaleDialog) { + if (state.alertInfo.showDialog) { RecordyDialog( - graphicAsset = R.drawable.img_allow, - title = "필수 권한을 허용해주세요", - subTitle = "사진 접근을 허용하여 영상을 업로드 하세요.", - negativeButtonLabel = "닫기", - positiveButtonLabel = "지금 설정", - onDismissRequest = hideShouldShowRationaleDialog, + graphicAsset = R.drawable.ic_alert_warning_80, + title = state.alertInfo.title, + subTitle = state.alertInfo.subTitle, + negativeButtonLabel = state.alertInfo.negativeButtonLabel, + positiveButtonLabel = state.alertInfo.positiveButtonLabel, + onDismissRequest = hideExitUploadDialog, onPositiveButtonClick = { - openAppSettings(context) + if (cameraPermissionState.status.shouldShowRationale) { + openAppSettings(context) + } else { + onClickBackStack() + } }, ) } - - if (state.showExitUploadDialog) { - RecordyDialog( - graphicAsset = R.drawable.img_pen, - title = "화면을 나가시겠어요?", - subTitle = "지금까지 작성하신 내용이 모두 사라져요.", - negativeButtonLabel = "취소", - positiveButtonLabel = "나가기", - onDismissRequest = hideExitUploadDialog, - onPositiveButtonClick = onClickBackStack, - ) - } SelectedVideoBottomSheet( sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), isSheetOpen = state.isSelectedVideoSheetOpen, diff --git a/feature/video/src/main/java/com/record/video/navigation/VideoNavigation.kt b/feature/video/src/main/java/com/record/video/navigation/VideoNavigation.kt index 25160ef4..e5bfe328 100644 --- a/feature/video/src/main/java/com/record/video/navigation/VideoNavigation.kt +++ b/feature/video/src/main/java/com/record/video/navigation/VideoNavigation.kt @@ -11,7 +11,7 @@ import com.record.model.VideoType import com.record.video.VideoRoute import com.record.video.videodetail.VideoDetailRoute -fun NavController.navigateVideo(navOptions: NavOptions) { +fun NavController.navigateVideo(navOptions: NavOptions?) { navigate(VideoRoute.route, navOptions) }