Skip to content

Commit 6b67e10

Browse files
lsakeeSangwook123
authored andcommitted
[feat] #62 limited video durationd
1 parent 986dbda commit 6b67e10

File tree

5 files changed

+26
-35
lines changed

5 files changed

+26
-35
lines changed

feature/upload/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies {
1212
implementation("com.google.accompanist:accompanist-systemuicontroller:0.24.13-rc")
1313
implementation("com.github.AbedElazizShe:LightCompressor:1.3.2")
1414
implementation(projects.domain.upload)
15+
implementation(projects.domain.keyword)
1516
implementation("com.arthenica:mobile-ffmpeg-full-gpl:4.4")
1617
implementation("com.amazonaws:aws-android-sdk-mobile-client:2.13.5")
1718
implementation("com.amazonaws:aws-android-sdk-cognito:2.13.5")

feature/upload/src/main/java/com/record/upload/UploadViewModel.kt

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.content.Context
44
import android.util.Base64
55
import android.util.Log
66
import androidx.lifecycle.viewModelScope
7+
import com.record.keyword.repository.KeywordRepository
78
import com.record.ui.base.BaseViewModel
89
import com.record.upload.extension.GalleryVideo
910
import com.record.upload.extension.uploadFileToS3PresignedUrl
@@ -19,8 +20,14 @@ import javax.inject.Inject
1920
@HiltViewModel
2021
class UploadViewModel @Inject constructor(
2122
private val uploadRepository: UploadRepository,
22-
) : BaseViewModel<UploadState, UploadSideEffect>(UploadState()) {
23+
private val keywordRepository: KeywordRepository,
2324

25+
) : BaseViewModel<UploadState, UploadSideEffect>(UploadState()) {
26+
fun getKeyWordList() = viewModelScope.launch {
27+
keywordRepository.getKeywords().onSuccess {
28+
intent { copy(contentList = it.keywords) }
29+
}
30+
}
2431
fun setSelectedList(selectedContent: String) = intent {
2532
val newSelectedList = selectedList.toMutableList()
2633
if (newSelectedList.contains(selectedContent)) {
@@ -66,12 +73,11 @@ class UploadViewModel @Inject constructor(
6673

6774
fun uploadRecord(a: String, b: String) =
6875
viewModelScope.launch {
69-
Log.d("test", "${uiState.value.selectedList}")
7076
uploadRepository.uploadRecord(
7177
videoInfo = VideoInfo(
7278
location = uiState.value.locationTextValue,
7379
content = uiState.value.contentTextValue,
74-
keywords = encodingString("감각적인,강렬한,귀여운").trim(),
80+
keywords = encodingString(uiState.value.selectedList.joinToString(separator = ",")).trim(),
7581
videoUrl = a,
7682
previewUrl = b,
7783
),

feature/upload/src/main/java/com/record/upload/VideoPickerScreen.kt

+2-17
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ fun VideoPickerRoute(
9999

100100
LaunchedEffectWithLifecycle {
101101
viewModel.getPresignedUrl()
102+
viewModel.getKeyWordList()
102103
}
103104

104105
LaunchedEffectWithLifecycle {
@@ -369,9 +370,6 @@ fun VideoPickerScreen(
369370
.padding(bottom = 10.dp)
370371
.focusRequester(contentFocusRequester),
371372
onValueChange = updateContentTextField,
372-
keyboardOptions = KeyboardOptions.Default.copy(
373-
imeAction = ImeAction.Done,
374-
),
375373
)
376374
Box(modifier = Modifier.padding(16.dp)) {
377375
RecordyButton(
@@ -424,20 +422,7 @@ fun VideoPickerScreen(
424422
sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true),
425423
isSheetOpen = state.isSelectedDefinedContentSheetOpen,
426424
onDismissRequest = hideIsSelectedDefinedContentSheetOpen,
427-
contentList = listOf(
428-
"asdsadasdasda",
429-
"asdasdb",
430-
"asdasdc",
431-
"dasd",
432-
"asdsadasdasda",
433-
"asdasdbasd",
434-
"asdasdc12312",
435-
"dasd124123",
436-
"asdsada124sdasda",
437-
"asd124asdb",
438-
"asda3sdc",
439-
"das1d",
440-
),
425+
contentList = state.contentList,
441426
selectedList = state.selectedList,
442427
onClickContentChip = onClickContentChip,
443428
)

feature/upload/src/main/java/com/record/upload/component/bottomsheet/DefinedContentBottomSheet.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.record.upload.component.bottomsheet
22

3-
import android.util.Log
43
import androidx.compose.foundation.Image
54
import androidx.compose.foundation.background
65
import androidx.compose.foundation.layout.Arrangement
@@ -95,9 +94,7 @@ fun DefinedContentBottomSheet(
9594
.align(Alignment.CenterHorizontally),
9695
text = "적용하기",
9796
enabled = if (selectedList.isNotEmpty()) true else false,
98-
onClick = {
99-
if (selectedList.isNotEmpty()) Log.d("enable btn", "true") else Log.d("disable btn", "false")
100-
},
97+
onClick = onDismissRequest,
10198
)
10299
}
103100
}

feature/upload/src/main/java/com/record/upload/extension/UploadExtension.kt

+13-11
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,19 @@ fun getAllVideos(
6969
val date = cursor.getString(dateColumn)
7070
val contentUri = ContentUris.withAppendedId(uriExternal, id)
7171
val duration = getVideoDuration(context, contentUri)
72-
galleryVideoList.add(
73-
GalleryVideo(
74-
id,
75-
filepath = filepath,
76-
uri = contentUri,
77-
name = name,
78-
date = date ?: "",
79-
size = size,
80-
duration = duration,
81-
),
82-
)
72+
if (duration <= 15000) {
73+
galleryVideoList.add(
74+
GalleryVideo(
75+
id,
76+
filepath = filepath,
77+
uri = contentUri,
78+
name = name,
79+
date = date ?: "",
80+
size = size,
81+
duration = duration,
82+
),
83+
)
84+
}
8385
} while (cursor.moveToNext())
8486
}
8587
}

0 commit comments

Comments
 (0)