Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
14c2486
🐛 카테고리 색상 수정 바텀 시트 UI 애니메이션 에러 수정
ugmin1030 Dec 23, 2025
1472ec9
🎨 파일 UI 테스트를 위한 TestActivity 세팅
ugmin1030 Dec 31, 2025
347eda3
📦 androidx-compose-foundation-layout 의존성 추가
ugmin1030 Dec 31, 2025
46c9dea
🎨 `noRippleClickable` Modifier 확장 함수 파라미터 추가 및 개선
ugmin1030 Jan 2, 2026
47b52cc
📝 `gradientTint` Modifier 확장 함수 KDoc 주석 추가
ugmin1030 Jan 2, 2026
4d7c30c
✨ `BottomFolderEditBottomSheet`에 `sheetState` 매개변수 추가 및 설정 최적화
ugmin1030 Jan 11, 2026
5142dbe
✨ `BottomFolderGrid` 내 링크 리스트가 비어있을 경우 UI 숨김 처리
ugmin1030 Jan 25, 2026
44fb94b
✨ `TopFolderListMenu` UI 레이아웃 리팩토링 및 구성 요소 분리
ugmin1030 Jan 25, 2026
84a0ff1
✨ `SearchBarTopSheet` UI 개선 및 기능 고도화
ugmin1030 Jan 25, 2026
b3128aa
Merge branch 'feature/#44', commit '1a36217006d2e0c5a9bd41bbe9c672ae5…
KateteDeveloper Jan 26, 2026
ae780cd
⚡️ feature/#72 : 로그인 뷰 모델 수정
KateteDeveloper Jan 26, 2026
90b62c6
libs.version.toml feature/#44 맞춰서 수정함.
KateteDeveloper Jan 26, 2026
21ef2fb
✨ feature/#72 : 공통 탑바 컴포턴트 제작
KateteDeveloper Jan 26, 2026
ec7c27c
✨ 닉네임 체크박스 ui 추가
KateteDeveloper Jan 30, 2026
9d261c3
📝 자동로그인 로직 주석 추 가
KateteDeveloper Jan 30, 2026
e7136a0
자동로그인 리펙토링 세션 관리 최적화
KateteDeveloper Feb 2, 2026
6a0d6ab
⚡️ 피드백 반영 수정
KateteDeveloper Feb 2, 2026
15c617b
⚡️ 로그인&회원가입 MainApp에서 네비게이션 분리
KateteDeveloper Feb 2, 2026
eeac11a
LoginApp 수정
KateteDeveloper Feb 3, 2026
b9dae13
✨ 사용자 정보 호출 api 줄기오, 세션 스토어에서 관리하도록 수정함.
KateteDeveloper Feb 3, 2026
602d2ac
⚡️ : 마이페이지 세션 수정 완료
KateteDeveloper 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
395 changes: 88 additions & 307 deletions app/src/main/java/com/example/linku_android/MainApp.kt

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions core/src/main/java/com/example/core/model/LoginResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.example.core.model

data class LoginResult(
val userId: Int,
val token: String,
val accessToken: String, // token에서 수정
val refreshToken: String,
val status: String,
val inactiveDate: String? = null
)
/*
도메인 모델링. 뷰 모델에서 사용하기 쉬움!*/
28 changes: 28 additions & 0 deletions core/src/main/java/com/example/core/repository/UserRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ import com.example.core.model.TokenReissueResult
import com.example.core.model.UserInfo


// 목적 (Purposes)
private val purposeMap = mapOf(
"자기개발" to "SELF_DEVELOPMENT",
"사이드 프로젝트/창업준비" to "SIDE_PROJECT",
"기타" to "OTHERS",
"그냥 나중에 읽고 싶은 글 저장" to "LATER_READING",
"취업 커리어 준비" to "CAREER",
"블로그/콘텐츠 작성 참고용" to "CREATION_REFERENCE",
"인사이트 모으기" to "INSIGHTS",
"업무자료 아카이빙" to "WORK"
)

// 관심 분야 (Interests)
private val interestMap = mapOf(
"비즈니스/마케팅" to "BUSINESS",
"학업/리포트" to "STUDY",
"커리어/채용" to "CAREER",
"심리/자기개발" to "PSYCHOLOGY",
"디자인/크리에이티브" to "DESIGN",
"it 개발" to "IT",
"글쓰기/콘텐츠 작성" to "WRITING",
"시사/트렌드" to "CURRENT_EVENTS",
"스타트업/창업" to "STARTUP",
"그냥 모아두고 싶은 글들" to "COLLECT",
"사회/문화/환경" to "SOCIETY",
"책/인 사이트 요약" to "INSIGHTS"
)

interface UserRepository {
suspend fun checkNickname(nickname: String): Boolean
//suspend fun getNickname(userId: Long): String?
Expand Down
120 changes: 86 additions & 34 deletions core/src/main/java/com/example/core/session/SessionStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,31 @@ import android.content.Context
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.longPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import dagger.hilt.android.qualifiers.ApplicationContext
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.coroutines.flow.first

/**
* [지현이 사용법 요약]
*
* 1. 세션 데이터 읽기 (UI 표시용)
* - session.nickname, session.email, session.purposes 등
*
* 2. 사용자 정보 수정
* - MyPageViewModel.updateUserInfo() 호출하면 끝!
* - 서버 API + 세션 업데이트 모두 자동 처리됨
*
* 3. 닉네임만 수정할 때
* - sessionStore.updateNickname(nickname) 사용 가능
*/
// 파일 최상위에 위치해야 합니다.

private val Context.dataStore by preferencesDataStore(name = "session_prefs")

@Singleton
Expand All @@ -22,24 +38,22 @@ class SessionStore @Inject constructor(
) {
private object Keys {
val LOGGED_IN = booleanPreferencesKey("logged_in")
val USER_ID = stringPreferencesKey("user_id")
val USER_ID = longPreferencesKey("user_id") // String -> Long
val USER_NICK = stringPreferencesKey("user_nickname")
val USER_EMAIL = stringPreferencesKey("user_email")
val USER_GENDER = stringPreferencesKey("user_gender")
val USER_JOB_ID = stringPreferencesKey("user_job_id")
val USER_JOB_ID = longPreferencesKey("user_job_id") // String -> Long
val USER_JOB_NAME = stringPreferencesKey("user_job_name")
val USER_MY_LINKU = stringPreferencesKey("user_my_linku")
val USER_MY_FOLDER = stringPreferencesKey("user_my_folder")
val USER_MY_AI_LINKU = stringPreferencesKey("user_my_ai_linku")
}

suspend fun setLoggedIn(value: Boolean) {
context.dataStore.edit { p -> p[Keys.LOGGED_IN] = value }
val USER_MY_LINKU = longPreferencesKey("user_my_linku") // String -> Long
val USER_MY_FOLDER = longPreferencesKey("user_my_folder") // String -> Long
val USER_MY_AI_LINKU = longPreferencesKey("user_my_ai_linku") // String -> Long
Comment on lines +41 to +49
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "SessionStore.kt" -type f

Repository: LinkYou-2025/LinkU_Android

Length of output: 131


🏁 Script executed:

cat -n ./core/src/main/java/com/example/core/session/SessionStore.kt | head -100

Repository: LinkYou-2025/LinkU_Android

Length of output: 4283


🏁 Script executed:

wc -l ./core/src/main/java/com/example/core/session/SessionStore.kt

Repository: LinkYou-2025/LinkU_Android

Length of output: 135


🏁 Script executed:

cat -n ./core/src/main/java/com/example/core/session/SessionStore.kt | tail -80

Repository: LinkYou-2025/LinkU_Android

Length of output: 3332


String → Long 타입 변경에 대한 마이그레이션 전략이 필요합니다.

user_id, user_job_id, user_my_linku, user_my_folder, user_my_ai_linku가 String 타입에서 Long 타입으로 변경되었습니다. 기존 사용자의 데이터스토어에 문자열로 저장된 값이 있다면, 업데이트 후 longPreferencesKey로 읽을 때 타입 불일치로 인해 null이 반환되어 로그인 상태 검증이나 사용자 정보 로드가 실패할 수 있습니다.

마이그레이션 전략이 필요합니다. 예를 들어:

  • 레거시 String 키에서 Long으로 자동 변환하는 로직 추가
  • 새로운 키명으로 마이그레이션 후 레거시 키 정리

또한 purposesinterestsjoinToString(",") 방식으로 저장되는데, 데이터에 쉼표가 포함되면 분할 시 손상될 수 있으므로 JSON 또는 더 안전한 포맷 사용을 검토하세요.

🤖 Prompt for AI Agents
In `@core/src/main/java/com/example/core/session/SessionStore.kt` around lines 41
- 49, Add a datastore migration that reads the legacy string keys (those created
via stringPreferencesKey) and converts them to Long into the new
longPreferencesKey entries: specifically handle USER_ID, USER_JOB_ID,
USER_MY_LINKU, USER_MY_FOLDER, USER_MY_AI_LINKU by attempting to read the old
string value, parseLong (with safe fallback), write into the new long key, and
then remove the legacy string key; implement this as part of the SessionStore
preferences migration path (where the datastore is initialized) so existing
users are upgraded on first run. Also replace the fragile joinToString(",")
storage for purposes and interests with a JSON array encoding/decoding (store as
a JSON string in the same stringPreferencesKey) to preserve values containing
commas and update read/write helpers to use JSON parse/serialize. Ensure all
changes reference the existing preference key symbols (USER_ID, USER_JOB_ID,
USER_MY_LINKU, USER_MY_FOLDER, USER_MY_AI_LINKU, and the purposes/interests
keys) and perform safe parsing with fallbacks to avoid breaking login/session
loading.

val USER_PURPOSES = stringPreferencesKey("user_purposes") // 마이페이지 수정을 위해 추가.
val USER_INTERESTS = stringPreferencesKey("user_interests") // 마이페이지 수정을 위해 추가.
}

/** 앱 시작 시 오토로그인 분기용 */
val isLoggedIn: Flow<Boolean> =
context.dataStore.data.map { prefs: Preferences ->
context.dataStore.data.map { prefs ->
prefs[Keys.LOGGED_IN] ?: false
}

Expand All @@ -53,36 +67,70 @@ class SessionStore @Inject constructor(
myLinku: Long,
myFolder: Long,
myAiLinku: Long,
purposes: List<String>, // 추가 - 마이페이지 수정.
interests: List<String>,
) {
context.dataStore.edit { p ->
p[Keys.LOGGED_IN] = true
p[Keys.USER_ID] = userId.toString()
p[Keys.USER_ID] = userId
p[Keys.USER_NICK] = nickname
p[Keys.USER_EMAIL] = email
p[Keys.USER_GENDER] = gender
p[Keys.USER_JOB_ID] = jobId.toString()
p[Keys.USER_JOB_ID] = jobId
p[Keys.USER_JOB_NAME] = jobName
p[Keys.USER_MY_LINKU] = myLinku.toString()
p[Keys.USER_MY_FOLDER] = myFolder.toString()
p[Keys.USER_MY_AI_LINKU] = myAiLinku.toString()
p[Keys.USER_MY_LINKU] = myLinku
p[Keys.USER_MY_FOLDER] = myFolder
p[Keys.USER_MY_AI_LINKU] = myAiLinku
p[Keys.USER_PURPOSES] = purposes.joinToString(",") //추가 - 마이페이지 수정.
p[Keys.USER_INTERESTS] = interests.joinToString(",")
Comment on lines +70 to +85
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "SessionStore.kt" -type f

Repository: LinkYou-2025/LinkU_Android

Length of output: 131


🏁 Script executed:

# Get the full SessionStore.kt file to understand the structure
git ls-files | grep -i sessionstore

Repository: LinkYou-2025/LinkU_Android

Length of output: 129


🏁 Script executed:

# Search for SessionStore in the codebase
fd -t f "SessionStore" --extension kt

Repository: LinkYou-2025/LinkU_Android

Length of output: 129


🏁 Script executed:

wc -l core/src/main/java/com/example/core/session/SessionStore.kt

Repository: LinkYou-2025/LinkU_Android

Length of output: 133


🏁 Script executed:

cat -n core/src/main/java/com/example/core/session/SessionStore.kt

Repository: LinkYou-2025/LinkU_Android

Length of output: 7148


🏁 Script executed:

# Check if stringSetPreferencesKey is mentioned anywhere in the project
rg "stringSetPreferencesKey" --type kt

Repository: LinkYou-2025/LinkU_Android

Length of output: 96


🏁 Script executed:

# Check gradle or build files for DataStore version
find . -name "build.gradle*" -o -name "build.gradle.kts" | head -10

Repository: LinkYou-2025/LinkU_Android

Length of output: 352


🏁 Script executed:

# Look for DataStore dependency version
rg "datastore" -A 2 build.gradle.kts

Repository: LinkYou-2025/LinkU_Android

Length of output: 52


🏁 Script executed:

cat core/build.gradle.kts | grep -A 10 -B 2 "datastore"

Repository: LinkYou-2025/LinkU_Android

Length of output: 208


🏁 Script executed:

# Search for stringSetPreferencesKey in the project
rg "stringSetPreferencesKey" .

Repository: LinkYou-2025/LinkU_Android

Length of output: 52


🏁 Script executed:

# Check DataStore API documentation by examining imports and available keys
rg "import androidx.datastore.preferences.core" core/src/main/java/com/example/core/session/SessionStore.kt

Repository: LinkYou-2025/LinkU_Android

Length of output: 363


🏁 Script executed:

# Check what keys are available in DataStore 1.1.1
web_search "androidx.datastore:datastore-preferences 1.1.1 stringSetPreferencesKey"

Repository: LinkYou-2025/LinkU_Android

Length of output: 120


🏁 Script executed:

web_search "DataStore Preferences stringSetPreferencesKey availability android"

Repository: LinkYou-2025/LinkU_Android

Length of output: 120


🌐 Web query:

androidx.datastore:datastore-preferences 1.1.1 stringSetPreferencesKey

💡 Result:

In androidx.datastore:datastore-preferences:1.1.1, the key factory you want is:

import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.stringSetPreferencesKey

val TAGS_KEY: Preferences.Key<Set<String>> = stringSetPreferencesKey("tags")

stringSetPreferencesKey(name: String) returns a Preferences.Key<Set<String>>. The Set<String> you read back from DataStore is unmodifiable, so when updating you must write a new set (e.g., oldSet + "newValue"). [1][2]

Sources: [1] [2]


🌐 Web query:

DataStore Preferences stringSetPreferencesKey Android API

💡 Result:

stringSetPreferencesKey() is the Preferences DataStore API that creates a typed key for storing a Set<String> in DataStore<Preferences>:

  • Signature: fun stringSetPreferencesKey(name: String): Preferences.Key<Set<String>> [1]
  • Import: import androidx.datastore.preferences.core.stringSetPreferencesKey [1]
  • Artifact: androidx.datastore:datastore-preferences-core (also available via androidx.datastore:datastore-preferences) [1][2]
  • Notes: don’t reuse the same name for different types (can cause ClassCastException), and the returned sets are unmodifiable (mutating them throws) [1].

Example (Kotlin)

import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.stringSetPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import kotlinx.coroutines.flow.map

private val Context.dataStore by preferencesDataStore(name = "settings")

private val TAGS = stringSetPreferencesKey("tags")

suspend fun addTag(context: Context, tag: String) {
    context.dataStore.edit { prefs ->
        val current = prefs[TAGS].orEmpty()
        prefs[TAGS] = current + tag
    }
}

val tagsFlow = context.dataStore.data.map { prefs ->
    prefs[TAGS].orEmpty()
}

Gradle (example):

implementation "androidx.datastore:datastore-preferences:1.0.0"

[2]

Sources: Android API reference for androidx.datastore.preferences.core [1] and Android Developers codelab (dependency example) [2].

[1] https://developer.android.com/reference/kotlin/androidx/datastore/preferences/core/package-summary
[2] https://developer.android.com/codelabs/android-preferences-datastore


purposes/interests를 콤마 문자열로 저장하면 데이터 손상이 가능합니다.

항목 값에 콤마가 포함되면 분해 시 원본이 깨집니다. 순서가 중요하지 않다면 stringSetPreferencesKey로 저장하고, 순서가 필요하면 JSON 직렬화 등을 권장합니다.

♻️ 제안 변경안 (순서 불필요한 경우)
-import androidx.datastore.preferences.core.stringPreferencesKey
+import androidx.datastore.preferences.core.stringPreferencesKey
+import androidx.datastore.preferences.core.stringSetPreferencesKey

-        val USER_PURPOSES = stringPreferencesKey("user_purposes")
-        val USER_INTERESTS = stringPreferencesKey("user_interests")
+        val USER_PURPOSES = stringSetPreferencesKey("user_purposes")
+        val USER_INTERESTS = stringSetPreferencesKey("user_interests")

-            p[Keys.USER_PURPOSES] = purposes.joinToString(",")
-            p[Keys.USER_INTERESTS] = interests.joinToString(",")
+            p[Keys.USER_PURPOSES] = purposes.toSet()
+            p[Keys.USER_INTERESTS] = interests.toSet()

-            p[Keys.USER_PURPOSES] = purposes.joinToString(",")
-            p[Keys.USER_INTERESTS] = interests.joinToString(",")
+            p[Keys.USER_PURPOSES] = purposes.toSet()
+            p[Keys.USER_INTERESTS] = interests.toSet()

-                purposes = p[Keys.USER_PURPOSES]?.split(",")?.map { it.trim() }?.filter { it.isNotBlank() } ?: emptyList(),
-                interests = p[Keys.USER_INTERESTS]?.split(",")?.map { it.trim() }?.filter { it.isNotBlank() } ?: emptyList(),
+                purposes = p[Keys.USER_PURPOSES]?.toList() ?: emptyList(),
+                interests = p[Keys.USER_INTERESTS]?.toList() ?: emptyList(),

적용 위치: 84-85, 110-111, 162-163

🤖 Prompt for AI Agents
In `@core/src/main/java/com/example/core/session/SessionStore.kt` around lines 70
- 85, The code stores purposes/interests by joining with commas which corrupts
items containing commas; replace the comma-joined string storage for
Keys.USER_PURPOSES and Keys.USER_INTERESTS with a safe representation: either
(preferred if order not required) use Preferences.Set via
stringSetPreferencesKey and save the List<String> as a Set<String>, or (if order
must be preserved) JSON-serialize the List<String> (e.g., via
kotlinx.serialization/Moshi/Gson) and store the JSON string under those keys;
update the corresponding read logic to parse the Set<String> back to List or
deserialize the JSON, and change references around the context.dataStore.edit
block and the read helpers that use Keys.USER_PURPOSES / Keys.USER_INTERESTS to
use the new storage format.

}
}

suspend fun clear() {
context.dataStore.edit { p ->
p[Keys.LOGGED_IN] = false
p.remove(Keys.USER_ID)
p.remove(Keys.USER_NICK)
p.remove(Keys.USER_EMAIL)
p.remove(Keys.USER_GENDER)
p.remove(Keys.USER_JOB_ID)
p.remove(Keys.USER_JOB_NAME)
p.remove(Keys.USER_MY_LINKU)
p.remove(Keys.USER_MY_FOLDER)
p.remove(Keys.USER_MY_AI_LINKU)
p.clear() // 모든 세션 데이터 한 번에 삭제
}
}

// TODO : 지현이에게 전달
// 지현이를 위한 실시간 프로필 업데이트 지원
// 프로필 수정 시 purposes/interests도 업데이트
suspend fun updateProfile(
nickname: String,
jobId: Long,
jobName: String,
purposes: List<String>,
interests: List<String>
) {
context.dataStore.edit { p ->
p[Keys.USER_NICK] = nickname
p[Keys.USER_JOB_ID] = jobId
p[Keys.USER_JOB_NAME] = jobName
p[Keys.USER_PURPOSES] = purposes.joinToString(",")
p[Keys.USER_INTERESTS] = interests.joinToString(",")
}
}

/** MyPageViewModel에서 사용방법
* fun updateUserInfo(nickname: String, jobId: Long, jobName: String) {
* viewModelScope.launch {
* // 1. 서버 API 호출 (UserRepository)
* val isSuccess = userRepository.updateUserInfo(nickname, jobId, ...)
*
* if (isSuccess) {
* // 2. 서버 성공 시 세션 스토어만 업데이트 (이것만 하면 UI가 알아서 바뀜!)
* sessionStore.updateProfile(nickname, jobId, jobName)
* }
Comment on lines +115 to +124
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

사용 예시 주석이 변경된 시그니처와 불일치합니다.

updateProfilepurposes, interests가 추가되었는데 예시 호출에는 누락되어 혼동될 수 있습니다. 주석을 최신 시그니처에 맞춰 주세요.

✍️ 주석 수정 예시
-     *             sessionStore.updateProfile(nickname, jobId, jobName)
+     *             sessionStore.updateProfile(nickname, jobId, jobName, purposes, interests)
🤖 Prompt for AI Agents
In `@core/src/main/java/com/example/core/session/SessionStore.kt` around lines 115
- 124, Update the outdated example comment to match the new
SessionStore.updateProfile signature by adding the missing parameters `purposes`
and `interests` to the example call used in MyPageViewModel usage; locate the
example block in SessionStore.kt (the comment showing how to call
updateUserInfo/updateProfile) and modify the example invocation to include
appropriate placeholders/variables for `purposes` and `interests` so the comment
reflects the current method signature of updateProfile.

* }
* }
* */

// 닉네임만 수정할 때 -> TODO : 지현이에게 전달
suspend fun updateNickname(nickname: String) {
context.dataStore.edit { p -> p[Keys.USER_NICK] = nickname }
}

data class SessionSnapshot(
val loggedIn: Boolean,
val userId: Long?,
Expand All @@ -94,21 +142,25 @@ class SessionStore @Inject constructor(
val myLinku: Long?,
val myFolder: Long?,
val myAiLinku: Long?,
val purposes: List<String>, // 추가 - 마이페이지 수정을 위해.
val interests: List<String>,
)

val session: Flow<SessionSnapshot> =
context.dataStore.data.map { p ->
SessionSnapshot(
loggedIn = p[Keys.LOGGED_IN] ?: false,
userId = p[Keys.USER_ID]?.toLongOrNull(),
nickname = p[Keys.USER_NICK],
email = p[Keys.USER_EMAIL],
gender = p[Keys.USER_GENDER],
jobId = p[Keys.USER_JOB_ID]?.toLongOrNull(),
jobName = p[Keys.USER_JOB_NAME],
myLinku = p[Keys.USER_MY_LINKU]?.toLongOrNull(),
myFolder = p[Keys.USER_MY_FOLDER]?.toLongOrNull(),
myAiLinku = p[Keys.USER_MY_AI_LINKU]?.toLongOrNull(),
loggedIn = p[Keys.LOGGED_IN] ?: false,
userId = p[Keys.USER_ID],
nickname = p[Keys.USER_NICK],
email = p[Keys.USER_EMAIL],
gender = p[Keys.USER_GENDER],
jobId = p[Keys.USER_JOB_ID],
jobName = p[Keys.USER_JOB_NAME],
myLinku = p[Keys.USER_MY_LINKU],
myFolder = p[Keys.USER_MY_FOLDER],
myAiLinku = p[Keys.USER_MY_AI_LINKU],
purposes = p[Keys.USER_PURPOSES]?.split(",")?.map { it.trim() }?.filter { it.isNotBlank() } ?: emptyList(),
interests = p[Keys.USER_INTERESTS]?.split(",")?.map { it.trim() }?.filter { it.isNotBlank() } ?: emptyList(),
)
}

Expand Down
45 changes: 2 additions & 43 deletions data/src/main/java/com/example/data/api/ServerApi.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package com.example.data.api


import java.io.IOException
import com.example.core.error.TokenExpiredException
import com.example.data.api.dto.BaseResponse
import com.example.data.api.dto.RefreshApi
import com.example.data.preference.AuthPreference

// --- 기존 ServerApi + RefreshApi 확장 (AuthApi 제거) ---

// 모든 api를 ServerApi를 하나로 합치면 한 번의 조립으로 자동 상속이 가능함.
interface ServerApi :
UserApi,
LinkuApi,
Expand All @@ -17,40 +13,3 @@ interface ServerApi :
CategoryApi,
RefreshApi



// 이전 리프레쉬 없을 때, 혹시 오류 발생시 참고.
//suspend fun <T> ServerApi.withCheck(
// getter: suspend ServerApi.() -> BaseResponse<T>
//): T {
// val response = getter()
// if (!response.isSuccess) throw Exception(response.message)
// return response.result
//}
//// refreshToken 갱신 有
////suspend fun <T> ServerApi.withAuth(
//// authPreference: AuthPreference,
//// routine: suspend ServerApi.() -> BaseResponse<T>,
////): T {
//// try {
//// return withCheck { routine() }
//// } catch (_: Exception) {
//// val response = withCheck { refreshToken(authPreference.refreshToken!!) }
//// authPreference.refreshToken = response.refreshToken!!
//// authPreference.accessToken = response.accessToken!!
//// return withCheck { routine() }
//// }
////}
//
//// 토큰 자동 갱신이 불가능하므로 단순 실패 처리 (→ 로그인 페이지로 유도)
//suspend fun <T> ServerApi.withAuth(
// authPreference: AuthPreference,
// routine: suspend ServerApi.() -> BaseResponse<T>
//): T {
// return try {
// withCheck { routine() }
// } catch (e: Exception) {
// // refreshToken 없이 처리 → 로그인 유도
// throw TokenExpiredException("Access token expired. Please log in again.")
// }
//}
Loading