Skip to content
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 @@ -11,6 +11,9 @@ import com.foke.together.domain.output.AppPreferenceInterface
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import javax.inject.Inject
import kotlin.time.Duration
import kotlin.time.DurationUnit
import kotlin.time.toDuration

// TODO: datasource -> local / remote 기준으로 module 구분하는게 어떨지?
class AppPreferencesRepository @Inject constructor(
Expand Down Expand Up @@ -98,6 +101,19 @@ class AppPreferencesRepository @Inject constructor(
}
}

override fun getCaptureDuration(): Flow<Duration> = appPreferencesFlow.map {
it.cameraDuration.toDuration(DurationUnit.MILLISECONDS)
}

override suspend fun setCaptureDuration(duration: Duration) {
appPreferences.updateData {
it.toBuilder()
.setCameraDuration(duration.toLong(DurationUnit.MILLISECONDS))
.build()
}
}



override suspend fun clearAll() {
appPreferences.updateData {
Expand Down
2 changes: 2 additions & 0 deletions data/src/main/proto/app_preferences.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ message AppPreferences {
int32 internal_camera_capture_mode = 22;
int32 internal_camera_aspect_ratio = 23;

int64 camera_duration = 24;

// TODO: sample code. remove later.
string sample_id = 999997;
string sample_title = 999998;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.foke.together.domain

import com.foke.together.domain.output.AppPreferenceInterface
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject
import kotlin.time.Duration

class GetCaptureDurationUseCase @Inject constructor(
private val appPreferenceInterface: AppPreferenceInterface
) {
operator fun invoke() : Flow<Duration> = appPreferenceInterface.getCaptureDuration()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.foke.together.domain

import com.foke.together.domain.output.AppPreferenceInterface
import javax.inject.Inject
import kotlin.time.Duration

class SetCaptureDurationUseCase @Inject constructor(
private val appPreferenceInterface: AppPreferenceInterface
) {
suspend operator fun invoke(duration: Duration) = appPreferenceInterface.setCaptureDuration(duration)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ import javax.inject.Inject
class GetInternalCameraLensFacingUseCase @Inject constructor(
private val appPreferenceRepository: AppPreferenceInterface
) {
operator fun invoke() : Flow<CameraSelector> = appPreferenceRepository.getInternalCameraLensFacing().map { cameraSelectorIdx ->
CameraSelector.Builder()
.requireLensFacing(cameraSelectorIdx)
.build()
}
operator fun invoke() : Flow<Int> = appPreferenceRepository.getInternalCameraLensFacing()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.foke.together.domain.interactor

import com.foke.together.domain.output.AppPreferenceInterface
import javax.inject.Inject

class SetInternalCameraLensFacingUseCase @Inject constructor(
private val appPreferenceRepository: AppPreferenceInterface
) {
suspend operator fun invoke(lensFacing: Int) = appPreferenceRepository.setInternalCameraLensFacing(lensFacing)
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,18 @@ sealed class DefaultCutFrameSet (
),
dateStringHeight = 495
)

companion object {
val entries = listOf(
FourCutLight,
FourCurDark,
MakerFaire,
Wedding1,
Wedding2,
Bride1,
Bride2,
Groom1,
Groom2,
).sortedBy { it.index }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.camera.core.CameraSelector
import com.foke.together.domain.interactor.entity.CameraSourceType
import com.foke.together.domain.interactor.entity.ExternalCameraIP
import kotlinx.coroutines.flow.Flow
import kotlin.time.Duration

interface AppPreferenceInterface {
fun getCameraSourceType(): Flow<CameraSourceType>
Expand All @@ -28,5 +29,11 @@ interface AppPreferenceInterface {
@IntRange(from = 0, to = 2) captureMode: Int
)

fun getCaptureDuration(): Flow<Duration>

suspend fun setCaptureDuration(
duration: Duration
)

suspend fun clearAll()
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import javax.inject.Singleton
@Singleton
class InternalCameraRepository @Inject constructor(
): InternalCameraRepositoryInterface{
private lateinit var previewView: PreviewView
private lateinit var cameraController: LifecycleCameraController
private lateinit var imageCapture: ImageCapture

Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-ui-text-google-fonts = { group = "androidx.compose.ui", name = "ui-text-google-fonts" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigation-compose" }

Expand Down
1 change: 1 addition & 0 deletions presenter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ dependencies {
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.ui.text.google.fonts)
implementation(libs.androidx.material3)
implementation(libs.androidx.hilt.compiler)
implementation(libs.androidx.material.icons.extended)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ class MainActivity : ComponentActivity() {
// TODO: temporary remove this option
// enableEdgeToEdge()
setContent {
MainScreen()
FourCutTogetherTheme {
val navController = rememberNavController()
NavGraph(navController)
}
}
}
}
Expand Down
Loading