Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
084eb6a
➕ Build: CameraX dependency 추가
chanho0908 Jan 25, 2026
3597ab5
✨Feat: 카메라 활영 버튼, 렌즈 전후면 토글 버튼 컴포저블 추가
chanho0908 Jan 25, 2026
4e001bd
✨Feat: 카메라 플래시 on/off SVG 추가
chanho0908 Jan 25, 2026
6f50885
✨Feat: cameraX 촬영 기능 구현
chanho0908 Jan 25, 2026
846a1ef
♻️ Refactor: 버전 카탈로그 주석 추가 및 위치 수정
chanho0908 Jan 25, 2026
7df1e27
♻️ Refactor: CameraControlBar에 noRippleClickable 적용
chanho0908 Jan 26, 2026
8c2818e
✨ Feat: 화면 닫기 아이콘 추가
chanho0908 Jan 26, 2026
b33218e
✨ Feat: 인증샷 촬용 상태를 표현하기 위한 객체 추가
chanho0908 Jan 26, 2026
d3a4a95
✨ Feat: 임시 이미지 추가
chanho0908 Jan 26, 2026
0fd6cf3
✨ Feat: 카메라 프리뷰 화면 구현
chanho0908 Jan 26, 2026
203fd84
✨ Feat: 카메라 촬영 가능 구현
chanho0908 Jan 26, 2026
df06bb4
♻️ Refactor: 할일 인증 화면 KtlintFormat 적용
chanho0908 Jan 26, 2026
6949feb
♻️ Refactor: CameraControlBar 컬포저블 수정
chanho0908 Jan 26, 2026
4f7972e
♻️ Refactor: 이미지 캡쳐후 저장 로직 수정
chanho0908 Jan 26, 2026
215fae3
✨ Feat: 카메라 렌즈 토글 기능 추가
chanho0908 Jan 26, 2026
1d1a933
♻️ Refactor: 잘못 커밋된 파일 수정
chanho0908 Jan 26, 2026
9268343
♻️ Refactor: 잘못된 패키지명 수정
chanho0908 Jan 26, 2026
c678149
✨ Feat: TaskCertificationGraph 추가
chanho0908 Jan 26, 2026
4146605
♻️ Refactor: 미완성 코드 제거
chanho0908 Jan 26, 2026
5fb89fe
♻️ Refactor: CaptureStatus에 @Immutable 추가
chanho0908 Jan 27, 2026
5f881aa
♻️ Refactor: 플래시 아이콘 이름 변경
chanho0908 Jan 27, 2026
41d90d6
✨ Feat: 카메라 클래스에 플래시 On/Off 기능 추가
chanho0908 Jan 27, 2026
7a50827
➕ Build: 미사용 dependency 제거
chanho0908 Jan 27, 2026
2b7534e
➕ Build: guava dependency 추가
chanho0908 Jan 27, 2026
8c61d1a
✨ Feat: UI 카메라 플래시 토글 기능 추가
chanho0908 Jan 27, 2026
f2947c7
♻️ Refactor: 토치 아이콘 변수명 수정
chanho0908 Jan 27, 2026
19c23fe
♻️ Refactor: 로깅 제거
chanho0908 Jan 27, 2026
9733fde
♻️ Refactor: 불필요한 lifecycleowner 제거
chanho0908 Jan 27, 2026
900c7cc
♻️ Refactor: 카메라 바인딩 책임을 UI로 이동
chanho0908 Jan 30, 2026
ac190dd
♻️ Refactor: 카메라 촬영 책임을 UI로 이동
chanho0908 Jan 30, 2026
753f3b8
♻️ Refactor: 임시 코드 제거
chanho0908 Jan 30, 2026
94ea778
♻️ Refactor: 카메라 렌즈 토글 책임을 UI로 이동
chanho0908 Jan 30, 2026
8deb072
♻️ Refactor: 사진 촬영 함수를 콜백에서 suspend로 변경
chanho0908 Jan 30, 2026
7cf1a78
♻️ Refactor:: LifecycleOwner import 수정
chanho0908 Jan 30, 2026
326c781
♻️ Refactor: 카메라 바인딩 책임을 UI로 이동
chanho0908 Jan 30, 2026
34442dd
♻️ Refactor: 카메라 촬영 책임을 UI로 이동
chanho0908 Jan 30, 2026
5706c1a
♻️ Refactor: 임시 코드 제거
chanho0908 Jan 30, 2026
ccfe5e0
♻️ Refactor: 카메라 렌즈 토글 책임을 UI로 이동
chanho0908 Jan 30, 2026
d56df8b
♻️ Refactor: 사진 촬영 함수를 콜백에서 suspend로 변경
chanho0908 Jan 30, 2026
b2f436e
♻️ Refactor:: LifecycleOwner import 수정
chanho0908 Jan 30, 2026
c6d7b0d
♻️ Refactor: 불필요한 lifecycleowner 제거
chanho0908 Jan 27, 2026
acaeec3
♻️ Refactor: 카메라 촬영 책임을 UI로 이동
chanho0908 Jan 30, 2026
0f480fd
♻️ Refactor: 불필요한 lifecycleowner 제거
chanho0908 Jan 27, 2026
0e22c51
♻️ Refactor: 카메라 촬영 책임을 UI로 이동
chanho0908 Jan 30, 2026
0450fef
♻️ Refactor: 카메라 플래시 토글 책임을 UI로 이동
chanho0908 Jan 30, 2026
a0255ea
♻️ Refactor: 사진 촬영시 에러 콜백 처리 방식 수정
chanho0908 Jan 30, 2026
e862959
♻️ Refactor: 임시 코드 제거
chanho0908 Jan 30, 2026
987840d
✨Merge branch 'feat/#38-task-certification' into feat/#38-task-certif…
chanho0908 Jan 30, 2026
1b1895b
✨Merge branch 'feat/#38-task-certification-torch' into feat/#38-task-…
chanho0908 Jan 30, 2026
c8b73b6
✨ Feat: 카메라 권한 로직 추가
chanho0908 Jan 30, 2026
1d628d7
✨Merge branch 'develop' into feat/#38-task-certification
chanho0908 Jan 30, 2026
3f55676
♻️ Refactor: 토치 토글 로직 함수, 변수명 수정
chanho0908 Feb 2, 2026
4f5b5fc
♻️ Refactor: 사진 촬영시 토치 off 함수명 하나로 수정
chanho0908 Feb 2, 2026
f7654f4
♻️ Refactor: 이미지 캡쳐 실패 sideEffect 명 수정
chanho0908 Feb 2, 2026
0658bd3
✨ Feat: 후면 카메라로 변경시 토치 Off 기능 추가
chanho0908 Feb 2, 2026
6d72767
♻️ Refactor: lifecycle의 coroutineScope에서 rememberCoroutineScope로 수정
chanho0908 Feb 2, 2026
170a413
♻️ Refactor: 람다 제거
chanho0908 Feb 2, 2026
d908bbf
♻️ Refactor: 카메라를 생명주기에 맞게 unbind 하도록 수정
chanho0908 Feb 2, 2026
342d989
♻️ Refactor: viewModel에 reduce 함수들의 prefix에 reduce 추가
chanho0908 Feb 2, 2026
6f6c4b5
♻️ Refactor: 전면 카메라일 때 토치 버튼 숨김 처리
chanho0908 Feb 3, 2026
af74717
♻️ Refactor: camera unbinding 메서드를 동기 방식으로 수정
chanho0908 Feb 3, 2026
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
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
implementation(projects.domain)
implementation(projects.feature.login)
implementation(projects.feature.main)
implementation(projects.feature.taskCertification)

// Firebase
implementation(platform(libs.google.firebase.bom))
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/yapp/twix/di/FeatureModules.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.yapp.twix.di

import com.peto.task_certification.di.taskCertificationModule
import com.twix.home.di.homeModule
import com.twix.login.di.loginModule
import com.twix.main.di.mainModule
Expand All @@ -10,4 +11,5 @@ val featureModules: List<Module> =
loginModule,
mainModule,
homeModule,
taskCertificationModule,
)
1 change: 1 addition & 0 deletions feature/task-certification/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
10 changes: 10 additions & 0 deletions feature/task-certification/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins {
alias(libs.plugins.twix.feature)
}

android {
namespace = "com.peto.task_certification"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace 값이 peto로 들어갔는데 다른 모듈들이랑 네이밍 맞춰주세요!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헉 꼼꼼하게 봐줘서 고마워 ! 👍

리뷰 반영 커밋 : 9268343

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NavGraph도 적용해놨어 !

리뷰 반영 커밋 : c678149

}
dependencies {
implementation(libs.bundles.cameraX)
}
Empty file.
21 changes: 21 additions & 0 deletions feature/task-certification/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
4 changes: 4 additions & 0 deletions feature/task-certification/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.CAMERA"/>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
package com.peto.task_certification

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.LocalLifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.peto.task_certification.component.CameraControlBar
import com.peto.task_certification.component.CameraPreviewBox
import com.peto.task_certification.component.TaskCertificationTopBar
import com.peto.task_certification.model.TaskCertificationIntent
import com.peto.task_certification.model.TaskCertificationUiState
import com.twix.designsystem.components.text.AppText
import com.twix.designsystem.theme.GrayColor
import com.twix.designsystem.theme.LocalStatusBarColor
import com.twix.designsystem.theme.StatusBarStyle
import com.twix.designsystem.theme.TwixTheme
import com.twix.domain.model.enums.AppTextStyle
import org.koin.androidx.compose.koinViewModel

@Composable
fun TaskCertificationRoute(
viewModel: TaskCertificationViewModel = koinViewModel(),
navigateToBack: () -> Unit,
) {
val uiSate by viewModel.uiState.collectAsStateWithLifecycle()
val lifecycleOwner = LocalLifecycleOwner.current

LaunchedEffect(Unit) {
viewModel.dispatch(TaskCertificationIntent.BindCamera(lifecycleOwner))
}

CompositionLocalProvider(
LocalStatusBarColor provides
StatusBarStyle(
GrayColor.C500.toArgb(),
false,
),
) {
TaskCertificationScreen(
uiState = uiSate,
onClickClose = {
navigateToBack()
},
onCaptureClick = {
viewModel.dispatch(TaskCertificationIntent.TakePicture)
},
onToggleCameraClick = {
viewModel.dispatch(TaskCertificationIntent.ToggleCamera(lifecycleOwner))
},
)
}
}

@Composable
private fun TaskCertificationScreen(
uiState: TaskCertificationUiState,
onClickClose: () -> Unit,
onCaptureClick: () -> Unit,
onToggleCameraClick: () -> Unit,
) {
Column(
Modifier
.fillMaxSize()
.background(GrayColor.C500),
horizontalAlignment = Alignment.CenterHorizontally,
) {
TaskCertificationTopBar(
onClickClose = { onClickClose() },
)

Spacer(modifier = Modifier.height(24.26.dp))

AppText(
text = stringResource(R.string.task_certification_title),
style = AppTextStyle.H2,
color = GrayColor.C100,
)

Spacer(modifier = Modifier.height(40.dp))

CameraPreviewBox(
captureStatus = uiState.capture,
previewRequest = uiState.preview,
)

Spacer(modifier = Modifier.height(52.dp))

CameraControlBar(
onCaptureClick = onCaptureClick,
onToggleCameraClick = onToggleCameraClick,
)
}
}

@Preview
@Composable
fun TaskCertificationScreenPreview() {
TwixTheme {
TaskCertificationScreen(
uiState = TaskCertificationUiState(),
onClickClose = {},
onCaptureClick = {},
onToggleCameraClick = {},
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package com.peto.task_certification

import android.net.Uri
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.viewModelScope
import com.peto.task_certification.camera.Camera
import com.peto.task_certification.model.CameraPreview
import com.peto.task_certification.model.TaskCertificationIntent
import com.peto.task_certification.model.TaskCertificationSideEffect
import com.peto.task_certification.model.TaskCertificationUiState
import com.twix.ui.base.BaseViewModel
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch

class TaskCertificationViewModel(
private val camera: Camera,
) : BaseViewModel<TaskCertificationUiState, TaskCertificationIntent, TaskCertificationSideEffect>(
TaskCertificationUiState(),
) {
init {
camera.surfaceRequests
.map { request -> request?.let { CameraPreview(request) } }
.onEach { preview ->
reduce { copy(preview = preview) }
}.launchIn(viewModelScope)
}

override suspend fun handleIntent(intent: TaskCertificationIntent) {
when (intent) {
is TaskCertificationIntent.BindCamera -> {
bindCamera(intent.lifecycleOwner)
}

is TaskCertificationIntent.TakePicture -> {
takePicture()
}

is TaskCertificationIntent.ToggleCamera -> {
toggleCamera(intent.lifecycleOwner)
}
}
}

private fun takePicture() {
camera.takePicture(
onComplete = {
updateCapturedCImage(it)
unbindCamera()
},
onFailure = {
onFailureCapture()
},
)
}

private fun onFailureCapture() {
viewModelScope.launch {
emitSideEffect(TaskCertificationSideEffect.ImageCaptureFailException)
}
}

private fun unbindCamera() {
viewModelScope.launch {
camera.unbind()
}
}

private fun bindCamera(lifecycleOwner: LifecycleOwner) {
viewModelScope.launch {
camera.bind(lifecycleOwner, uiState.value.lens)
}
}

private fun updateCapturedCImage(uri: Uri?) {
uri?.let {
reduce { updateCapturedCImage(uri) }
} ?: run {
viewModelScope.launch {
emitSideEffect(TaskCertificationSideEffect.ImageCaptureFailException)
}
}
}

private fun toggleCamera(lifecycleOwner: LifecycleOwner) {
reduce { toggleLens() }
bindCamera(lifecycleOwner)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.peto.task_certification.camera

import android.net.Uri
import androidx.camera.core.CameraSelector
import androidx.camera.core.ImageCaptureException
import androidx.camera.core.SurfaceRequest
import androidx.lifecycle.LifecycleOwner
import kotlinx.coroutines.flow.StateFlow

interface Camera {
val surfaceRequests: StateFlow<SurfaceRequest?>

suspend fun bind(
lifecycleOwner: LifecycleOwner,
lens: CameraSelector,
)

suspend fun unbind()

fun takePicture(
onComplete: (Uri?) -> Unit,
onFailure: (ImageCaptureException) -> Unit,
)
}
Loading
Loading