-
Notifications
You must be signed in to change notification settings - Fork 0
[Refactor/#323] 홈화면을 MVVM -> MVI 로 마이그레이션합니다. #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f253b46
196e0f5
94588bb
acebc07
c436359
3eb4945
9cb6ff4
c870328
1292c5e
9ad6900
98d77e6
f399ab5
5568ba8
264bca2
64cd81d
e388bba
e5c09d4
6e447fc
8463278
a48077e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.sopt.clody | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import android.os.Bundle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import androidx.appcompat.app.AppCompatActivity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import co.ab180.airbridge.Airbridge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class ClodyDeeplinkActivity : AppCompatActivity() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override fun onCreate(savedInstanceState: Bundle?) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super.onCreate(savedInstanceState) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| override fun onResume() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| super.onResume() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| val isFirstCalled = Airbridge.handleDeferredDeeplink { uri -> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused variable: The Apply this diff if the variable is not needed: - val isFirstCalled = Airbridge.handleDeferredDeeplink { uri ->
+ Airbridge.handleDeferredDeeplink { uri ->
// when handleDeferredDeeplink is called firstly after install
if (uri != null) {
// show proper content using uri (YOUR_SCHEME://...)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // when handleDeferredDeeplink is called firstly after install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (uri != null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // show proper content using uri (YOUR_SCHEME://...) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement URI handling and finish the Activity. The callback contains only a placeholder comment. Without actual URI processing and navigation logic, this Activity cannot fulfill its deep link handling purpose. Additionally, the Activity does not call Consider implementing:
Example: Airbridge.handleDeferredDeeplink { uri ->
- // when handleDeferredDeeplink is called firstly after install
if (uri != null) {
- // show proper content using uri (YOUR_SCHEME://...)
+ // Parse URI and navigate to the appropriate screen
+ val intent = Intent(this, MainActivity::class.java).apply {
+ data = uri
+ // Add any necessary extras based on URI
+ }
+ startActivity(intent)
+ } else {
+ // No deferred deep link, navigate to main screen
+ startActivity(Intent(this, MainActivity::class.java))
}
+ finish()
}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Complete the deep link URI handling implementation. The URI callback is incomplete with only a placeholder comment. This leaves the deep link functionality non-functional. The current implementation:
Apply this diff to add navigation and cleanup: override fun onResume() {
super.onResume()
val isFirstCalled = Airbridge.handleDeferredDeeplink { uri ->
// when handleDeferredDeeplink is called firstly after install
if (uri != null) {
- // show proper content using uri (YOUR_SCHEME://...)
+ // TODO: Parse uri and navigate to appropriate screen
+ // Example: NavigationUtil.handleDeepLink(this, uri)
}
+ // Finish this activity after handling the deep link
+ finish()
}
+
+ // If not first call, also finish immediately
+ if (!isFirstCalled) {
+ finish()
+ }
}Would you like me to help implement the URI parsing and navigation logic? 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| package com.sopt.clody.data.remote.dto.response | ||
|
|
||
| import com.sopt.clody.domain.model.ReplyStatus | ||
| import com.sopt.clody.domain.type.ReplyStatus | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API 변경 시 Domain 영향 최소화하려면 ReplyStatusDto - Mapper로 나중에 바꾸는 것도 좋아보입니다. |
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| package com.sopt.clody.domain.model | ||
|
|
||
| import com.sopt.clody.domain.type.ReplyStatus | ||
| import java.time.LocalDate | ||
| import java.time.ZoneId | ||
|
|
||
| /** | ||
| * 홈 화면의 월별 달력에서 사용되는 정보 | ||
| * | ||
| * @property totalCloverCount 지금까지 모은 클로버(답장)의 개수. 연 단위로 카운트 | ||
| * @property calendarDailyInfoList 해당 월의 일별 정보 | ||
| * | ||
| * */ | ||
| data class CalendarMonthlyInfo( | ||
| val totalCloverCount: Int = 0, | ||
| val calendarDailyInfoList: List<CalendarDailyInfo> = listOf(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 불변성을 보장한다면 emptyList()로 바꾸는 게 좋습니다 |
||
| ) { | ||
| /** | ||
| * 홈 화면 월별 달력을 구성하는 일별 일기 정보 | ||
| * | ||
| * @property diaryCount 해당 일에 작성한 일기의 개수 | ||
| * @property replyStatus 해당 일에 작성한 일기의 답장 상태 | ||
| * @property date 해당 일의 날짜, "2025-08-21" 형식 | ||
| * @property isDeleted 해당 일에 작성한 일기가 삭제 이력의 여부 | ||
| * | ||
| * */ | ||
| data class CalendarDailyInfo( | ||
| val diaryCount: Int = 0, | ||
| val replyStatus: ReplyStatus = ReplyStatus.UNREADY, | ||
| val date: String = "", | ||
| val isDeleted: Boolean = false, | ||
| ) { | ||
| fun isToday(): Boolean = date == LocalDate.now().toString() | ||
|
|
||
| fun enableWriteDiary(): Boolean { | ||
| val userTimeZone = ZoneId.systemDefault().id | ||
| val today = LocalDate.now().toString() | ||
| val yesterday = LocalDate.now().minusDays(1).toString() | ||
| val isAvailableDay = if (userTimeZone == "Asia/Seoul") { | ||
| date == today || date == yesterday | ||
| } else { | ||
| date == today | ||
| } | ||
| return diaryCount == 0 && isAvailableDay | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package com.sopt.clody.domain.model | ||
|
|
||
| /** | ||
| * 홈 화면에서 월별 달력 하단에 일별 일기 정보를 위한 데이터 클래스 | ||
| * | ||
| * @property diaryList 해당 일에 작성한 일기의 내용 | ||
| * @property isDraft 해당 일에 임시 저장 일기의 존재 여부 | ||
| * | ||
| */ | ||
| data class DailyDiaryInfo( | ||
| val diaryList: List<String> = listOf(), | ||
| val isDraft: Boolean = false, | ||
| ) |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package com.sopt.clody.domain | ||
| package com.sopt.clody.domain.type | ||
|
|
||
| enum class Notification { | ||
| DIARY, DRAFT, REPLY | ||
|
|
||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Set up proper activity behavior for a deep link handler.
This activity serves as a deep link entry point but doesn't set a content view or configure launch mode. Deep link handler activities typically:
setContentView)android:noHistory="true"in manifest)Consider adding
finish()after handling the deep link to prevent an empty activity from remaining in the back stack:override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + // No content view needed for deep link handler }🤖 Prompt for AI Agents