Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9d8edc7
del/#137 주완햄의 노력의 산물 제거..ㅠ
sonms Sep 21, 2025
7427efa
mod/#137 퍼미션 관리
sonms Sep 21, 2025
df3625e
feat/#137 나중에 사용할 contentresolver hilt 설정
sonms Sep 21, 2025
5ea9b90
move/#137 옮긴 파일 내용 적용
sonms Sep 21, 2025
eccb536
feat/#137 suffix 적용, 커서, 커서 물방울 색상 적용
sonms Sep 21, 2025
4521889
feat/#137 DataLoadingScreen 추가 나중에 디자인에 따라 변경예정
sonms Sep 21, 2025
2f1e159
mod/#137 안 쓰는 파라미터 제거, 예전거 적용(커뮤니티 줄바꿈, 홈카드)
sonms Sep 21, 2025
254c999
mod/#137 util로 변경
sonms Sep 21, 2025
6545c0d
add/#137 icon 내용 변경 및 추가
sonms Sep 21, 2025
26f7d07
feat/#137 예전 버튼의 내용은 두고 새로운 공통 컴포넌트 버튼 구현 - pawkey 버튼은 나중에 제거예정
sonms Sep 21, 2025
a47c318
feat/#137 화면(navhost)이동 애니메이션 추가
sonms Sep 21, 2025
930c070
feat/#137 coil 이미지 로더 팩토리 적용 - 이미지 캐싱
sonms Sep 21, 2025
cf1f833
feat/#137 modal용 공통 컴포넌트 구현
sonms Sep 21, 2025
a4e3a3c
feat/#137 region 가져오기
sonms Sep 21, 2025
d3d4d55
feat/#137 bitmap -> cache 적용해서 메모리에 들지 않도록 하는 함수 구현
sonms Sep 21, 2025
e982d6e
mod/#137 헤더 디자인에 맞게 수정
sonms Sep 21, 2025
01d9526
mod/#137 이전 디자인 적용 및 로직 수정
sonms Sep 21, 2025
22ef312
mod/#137 savedStateHandle 사용 backstackentry 제거
sonms Sep 21, 2025
8164539
mod/#137 entity 수정
sonms Sep 21, 2025
56558f9
feat/#137 펫 이미지 컴포넌트
sonms Sep 21, 2025
f03fe37
feat/#137 서브 헤더
sonms Sep 21, 2025
df2dacb
feat/#137 유저 select 버튼 수정
sonms Sep 21, 2025
358e179
feat/#137 home region setting 화면 오류와userid 분기 처리
sonms Sep 21, 2025
a2ab4af
mod/#137 온보딩 의존성 수정
sonms Sep 21, 2025
3345f38
feat/#137 필요한 파라미터 추가
sonms Sep 21, 2025
2060068
feat/#137 splash status bar 색상 변경
sonms Sep 21, 2025
bd02e96
feat/#137 state holder 패턴으로 변경
sonms Sep 21, 2025
44cdee8
feat/#137 텍스트 변환 VisualTransformation
sonms Sep 21, 2025
3272929
feat/#137 user info screen
sonms Sep 21, 2025
9f75618
feat/#137 pet info screen
sonms Sep 21, 2025
cf062f5
feat/#137 location info screen
sonms Sep 21, 2025
3f72dc0
feat/#137 map info screen
sonms Sep 21, 2025
3cc41dd
feat/#137 스크린 타입 마다 검증 로직 및 next, backpress 구현
sonms Sep 21, 2025
bbac76c
feat/#137 전체 관리 signupscreen 적용
sonms Sep 21, 2025
6f43395
mod/#137 네비게이션 수정
sonms Sep 21, 2025
64d6fe5
Merge #137 -> develop
sonms Sep 22, 2025
ab95666
fix#137 conflict 수정
sonms Sep 22, 2025
ff9420d
Merge branch 'mod/#137-sign-up-screen' of https://github.com/PAW-KEY/…
sonms Sep 22, 2025
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
6 changes: 2 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_HEALTH"/>

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<application
android:name="com.paw.key.PawKeyApplication"
Expand Down
25 changes: 24 additions & 1 deletion app/src/main/java/com/paw/key/PawKeyApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package com.paw.key

import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.disk.DiskCache
import coil.memory.MemoryCache
import coil.util.DebugLogger
import com.kakao.vectormap.KakaoMapSdk
import com.naver.maps.map.NaverMapSdk
import dagger.hilt.android.HiltAndroidApp
Expand All @@ -10,7 +15,7 @@ import javax.inject.Inject
import javax.inject.Named

@HiltAndroidApp
class PawKeyApplication : Application() {
class PawKeyApplication : Application(), ImageLoaderFactory {
@Inject
@Named("kakao.native.key")
lateinit var kakaoNativeKey: String // BuildConfig는 컴파일 타임에 생성되는 정적 클래스이기 때문에 Mocking이 불가능 = 테스트 용이성
Expand All @@ -33,4 +38,22 @@ class PawKeyApplication : Application() {
private fun setDarkMode() {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}

override fun newImageLoader(): ImageLoader {
return ImageLoader.Builder(this)
.memoryCache {
MemoryCache.Builder(this)
.maxSizePercent(0.25)
.build()
}
.diskCache {
DiskCache.Builder()
.directory(cacheDir.resolve("image_cache"))
.maxSizeBytes(50 * 1024 * 1024)
.build()
}
.logger(DebugLogger())
.respectCacheHeaders(false)
.build()
}
Copy link
Member

Choose a reason for hiding this comment

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

진도가 너무 빠릅니다 교수님

Copy link
Member Author

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ coil의 구현 방식에 대해 읽어보고 이미지 캐싱 전략 중 메모리 캐시와 디스크 캐시에 대해 한 번 알아봅시다 ^^

}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.paw.key.core.designsystem.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
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.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.paw.key.core.designsystem.theme.PawKeyTheme

@Composable
fun DataLoadingScreen() {
Box(
modifier = Modifier
.fillMaxSize()
.background(
color = PawKeyTheme.colors.gray950.copy(alpha = 0.5f)
),
contentAlignment = Alignment.Center
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally
) {
CircularProgressIndicator(
color = PawKeyTheme.colors.green500
)

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

//Text("현재 위치를 가져오는 중...")
}
}
}

@Preview
@Composable
private fun LoadingScreenPreview() {
PawKeyTheme {
DataLoadingScreen()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.paw.key.core.designsystem.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
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.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.paw.key.core.designsystem.theme.PawKeyTheme
import com.paw.key.core.extension.noRippleClickable

@Composable
fun DogkyButton(
text: String,
enabled: Boolean,
onClick: () -> Unit,
modifier: Modifier = Modifier
) {
val backgroundColor = when {
enabled -> PawKeyTheme.colors.primary
else -> PawKeyTheme.colors.background1
}

val textColor = when {
enabled -> PawKeyTheme.colors.background1
else -> PawKeyTheme.colors.default
}

Box(
modifier = modifier
.fillMaxWidth()
.background(backgroundColor, shape = RoundedCornerShape(8.dp))
.noRippleClickable {
if (enabled) onClick()
}
.padding(vertical = 14.dp),
contentAlignment = Alignment.Center
) {
Text(
text = text,
style = PawKeyTheme.typography.mainButtonDefault,
color = textColor
)
}
}

@Preview
@Composable
private fun DogkyButtonPreview() {
PawKeyTheme {
DogkyButton(
text = "",
enabled = true,
onClick = {}
)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

공통 컴포넌트 작업 굳굳

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.paw.key.core.designsystem.component

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.paw.key.core.designsystem.theme.PawKeyTheme

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PawKeyBottomSheet(
sheetState: SheetState,
onDismissRequest: () -> Unit,
modifier: Modifier = Modifier,
content: @Composable (sheetState: SheetState) -> Unit
Copy link
Member

Choose a reason for hiding this comment

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

👍

) {
ModalBottomSheet(
onDismissRequest = onDismissRequest,
sheetState = sheetState,
shape = RoundedCornerShape(topStart = 20.dp, topEnd = 20.dp),
containerColor = PawKeyTheme.colors.background2,
modifier = modifier
.fillMaxWidth(),
dragHandle = null,
) {
content(sheetState)
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Preview
@Composable
private fun PawKeyBottomSheetPreview() {
PawKeyTheme {
val sheetState = rememberModalBottomSheetState(
skipPartiallyExpanded = true
)

PawKeyBottomSheet(
sheetState = sheetState,
onDismissRequest = {}
) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private fun PreviewPawkeyButton() {
}
}

// Todo : 이 더러운 분기의 버튼 제거예정
@Composable
fun PawkeyButton(
text: String,
Expand All @@ -102,7 +103,7 @@ fun PawkeyButton(
}

val backgroundColor = when {
actualEnabled && !isBackGround -> PawKeyTheme.colors.green500
actualEnabled && !isBackGround -> PawKeyTheme.colors.primary
actualEnabled && isBackGround -> PawKeyTheme.colors.white1
!actualEnabled && isBackGround -> PawKeyTheme.colors.white1
else -> PawKeyTheme.colors.gray200
Expand Down Expand Up @@ -139,7 +140,7 @@ fun PawkeyButton(
) {
Text(
text = text,
style = PawKeyTheme.typography.body16Sb,
style = PawKeyTheme.typography.mainButtonActive,
color = contentColor
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.paw.key.core.util

import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.input.OffsetMapping
import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.input.VisualTransformation

// 날짜 텍스트 입력받아서 변환 텍스트 만들기
class DateVisualTransformation : VisualTransformation {
override fun filter(text: AnnotatedString): TransformedText {
val digitsOnly = text.text.filter { it.isDigit() }

val trimmed = if (digitsOnly.length > 8) digitsOnly.substring(0, 8) else digitsOnly

val formattedText = buildString {
trimmed.forEachIndexed { index, char ->
append(char)
if (index == 3 || index == 5) {
append('/')
}
}
}

val offsetMapping = object : OffsetMapping {
override fun originalToTransformed(offset: Int): Int {
return when {
offset >= 6 -> offset + 2
offset >= 4 -> offset + 1
else -> offset
}
}

override fun transformedToOriginal(offset: Int): Int {
return when {
offset >= 8 -> offset - 2 // yyyy/MM/dd
offset >= 5 -> offset - 1 // yyyy/MM
else -> offset
}
}
}

return TransformedText(AnnotatedString(formattedText), offsetMapping)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paw.key.presentation.ui.course.util
package com.paw.key.core.util

import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.paw.key.core.util

import com.naver.maps.geometry.LatLng
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toPersistentList

fun flattenCoordinatesToLatLng(
coordinates: List<List<List<Pair<Double, Double>>>>
): ImmutableList<ImmutableList<LatLng>> {
return coordinates.map { polygon -> // 각 Polygon
polygon.firstOrNull()?.map { point ->
LatLng(point.first, point.second)
}.orEmpty().toPersistentList()
}.toPersistentList()
}
56 changes: 56 additions & 0 deletions app/src/main/java/com/paw/key/core/util/saveBitmapToCache.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.paw.key.core.util

import android.content.Context
import android.graphics.Bitmap
import android.net.Uri
import androidx.core.content.FileProvider
import java.io.File
import java.io.FileOutputStream
import java.io.IOException

// 혹시나 비트맵 사용 시
fun saveBitmapToCache(
context: Context,
bitmap: Bitmap,
maxFiles: Int = 5, // 캐시 최대 개수
maxCacheSizeBytes: Long = 50L * 1024 * 1024, // 50mb,
childName : String = "map_snapshot_" // 이미지 이름 변경용
): Result<Uri> {
val cacheDir = context.cacheDir

// 기존 스냅샷 파일 목록 오래된 순 정렬
val existingFiles = cacheDir.listFiles { file ->
file.name.startsWith(childName) && file.extension == "png"
}?.sortedBy { it.lastModified() } ?: emptyList()

// 최대 개수 초과 시 오래된 파일 삭제 LRU 구현
if (existingFiles.size >= maxFiles) {
val filesToDelete = existingFiles.take(existingFiles.size - maxFiles + 1)
filesToDelete.forEach { it.delete() }
}

// 용량 기반 삭제
var totalSize = existingFiles.sumOf { it.length() }
val iterator = existingFiles.iterator()
while (totalSize > maxCacheSizeBytes && iterator.hasNext()) {
val file = iterator.next()
totalSize -= file.length()
file.delete()
}

val imageFile = File(cacheDir, "${childName}${System.currentTimeMillis()}.png")
return try {
FileOutputStream(imageFile).use { out ->
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out)
}
Result.success(
FileProvider.getUriForFile(
context,
"${context.packageName}.fileprovider",
imageFile
)
)
} catch (e: IOException) {
Result.failure(e)
}
}
Loading