Skip to content

Commit b094802

Browse files
authored
[#416] NavigationSplitView를 적용한다 (#432)
* refactor: ViewBuilder를 추가해 코드 가독성 개선 * fix: NavigationSplitView의 details 파트와 selection이 연계되지 않는 현상 해결 * ui: NavigationSplitView 사용 * ui: compact ui일 때는 시트, 그렇지 않을때는 detail로 푸시 알람 내용을 보이도록 수정 * feat: 푸시알람 리스트를 탭했을 때 선택되었는지 확인하는 ui 구현 * fix: PushtNotificationListView에서 푸시알림을 탭했을 때 색이 잘 보이지 않는 현상 해결 * ui: MainView에 NavigationSplitView 적용 * style: 인덴트 수정 * ui: 프로필뷰는 2단, 나머지는 3단 형태로 구성할 수 있도록 수정 * ui: 3단 형태로 구성할 수 있도록 수정 * fix: PushNotificationListView에서 푸시알림 리스트를 탭 해도 detail이 보이지 않는 현상 해결 * ui: HomeView에 3계층 NavigationSplitView 적용 * fix: HomeView의 details 부분이 내비게이션이 되지 않는 현상 해결 * ui: TodayView를 3단 컬럼 형태의 SplitView로 구성 * refactor: Home, Today의 각 State를 NavigationRouter를 개선하여 정리 * refactor: 중복 모디파이어 제거
1 parent f9cd8d3 commit b094802

13 files changed

Lines changed: 906 additions & 401 deletions

File tree

DevLog/Presentation/Structure/Todo/SystemTodoCategoryItem.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ struct SystemTodoCategoryItem: Identifiable, Hashable {
4242
}
4343
}
4444

45-
var color: Color {
45+
var color: UIColor {
4646
switch systemTodoCategory {
47-
case .issue: return .red
48-
case .feature: return .green
49-
case .improvement: return .cyan
50-
case .review: return .orange
51-
case .test: return .purple
52-
case .doc: return .yellow
53-
case .research: return .teal
54-
case .etc: return .gray
47+
case .issue: return .systemRed
48+
case .feature: return .systemGreen
49+
case .improvement: return .systemCyan
50+
case .review: return .systemOrange
51+
case .test: return .systemPurple
52+
case .doc: return .systemYellow
53+
case .research: return .systemTeal
54+
case .etc: return .systemGray
5555
}
5656
}
5757
}

DevLog/Presentation/Structure/Todo/TodoCategoryItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct TodoCategoryItem: Identifiable, Hashable {
6464
var color: Color {
6565
switch category {
6666
case .system(let systemTodoCategory):
67-
return SystemTodoCategoryItem(from: systemTodoCategory).color
67+
return Color(SystemTodoCategoryItem(from: systemTodoCategory).color)
6868
case .user(let userTodoCategory):
6969
return UserTodoCategoryItem(from: userTodoCategory).color
7070
}

DevLog/Presentation/ViewModel/PushNotificationListViewModel.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ final class PushNotificationListViewModel: Store {
2121
var hasMore: Bool = false
2222
var nextCursor: PushNotificationCursor?
2323
var query: PushNotificationQuery
24+
var selectedNotificationId: String?
2425
var selectedTodoId: TodoIdItem?
2526
}
2627

@@ -42,8 +43,7 @@ final class PushNotificationListViewModel: Store {
4243
case setTimeFilter(PushNotificationQuery.TimeFilter)
4344
case toggleUnreadOnly
4445
case resetFilters
45-
case tapNotification(PushNotificationItem)
46-
case setSelectedTodoId(TodoIdItem?)
46+
case selectNotification(String?)
4747
}
4848

4949
enum SideEffect {
@@ -97,10 +97,10 @@ final class PushNotificationListViewModel: Store {
9797

9898
switch action {
9999
case .deleteNotification, .toggleRead, .undoDelete, .setAlert, .toggleSortOption,
100-
.setTimeFilter, .toggleUnreadOnly, .resetFilters, .tapNotification:
100+
.setTimeFilter, .toggleUnreadOnly, .resetFilters, .selectNotification:
101101
effects = reduceByUser(action, state: &state)
102102

103-
case .fetchNotifications, .setToast, .setSelectedTodoId, .loadNextPage:
103+
case .fetchNotifications, .setToast, .loadNextPage:
104104
effects = reduceByView(action, state: &state)
105105

106106
case .setLoading, .appendNotifications, .resetPagination, .setHasMore,
@@ -221,9 +221,19 @@ private extension PushNotificationListViewModel {
221221
updateQueryUseCase.execute(state.query)
222222
state.nextCursor = nil
223223
return [.fetchNotifications(state.query, cursor: nil)]
224-
case .tapNotification(let item):
224+
case .selectNotification(let notificationId):
225+
state.selectedNotificationId = notificationId
226+
guard let notificationId else {
227+
state.selectedTodoId = nil
228+
return []
229+
}
230+
guard let index = state.notifications.firstIndex(where: { $0.id == notificationId }) else {
231+
state.selectedTodoId = nil
232+
return []
233+
}
234+
let item = state.notifications[index]
225235
state.selectedTodoId = TodoIdItem(id: item.todoId)
226-
if let index = state.notifications.firstIndex(where: { $0.id == item.id }), !item.isRead {
236+
if !item.isRead {
227237
state.notifications[index].isRead.toggle()
228238
return [.toggleRead(item.todoId)]
229239
}
@@ -247,8 +257,6 @@ private extension PushNotificationListViewModel {
247257
state.notifications.removeAll { $0.isHidden }
248258
self.undoNotificationId = nil
249259
}
250-
case .setSelectedTodoId(let todoId):
251-
state.selectedTodoId = todoId
252260
default:
253261
break
254262
}

DevLog/Resource/Localizable.xcstrings

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,23 @@
425425
}
426426
}
427427
},
428+
"home_select_detail" : {
429+
"extractionState" : "manual",
430+
"localizations" : {
431+
"en" : {
432+
"stringUnit" : {
433+
"state" : "translated",
434+
"value" : "Select an item."
435+
}
436+
},
437+
"ko" : {
438+
"stringUnit" : {
439+
"state" : "translated",
440+
"value" : "항목을 선택해주세요."
441+
}
442+
}
443+
}
444+
},
428445
"home_recent_title" : {
429446
"extractionState" : "manual",
430447
"localizations" : {
@@ -1064,6 +1081,23 @@
10641081
}
10651082
}
10661083
},
1084+
"push_notifications_select_detail" : {
1085+
"extractionState" : "manual",
1086+
"localizations" : {
1087+
"en" : {
1088+
"stringUnit" : {
1089+
"state" : "translated",
1090+
"value" : "Select a notification."
1091+
}
1092+
},
1093+
"ko" : {
1094+
"stringUnit" : {
1095+
"state" : "translated",
1096+
"value" : "알림을 선택해주세요."
1097+
}
1098+
}
1099+
}
1100+
},
10671101
"push_period" : {
10681102
"extractionState" : "manual",
10691103
"localizations" : {
@@ -1897,6 +1931,23 @@
18971931
}
18981932
}
18991933
},
1934+
"today_select_detail" : {
1935+
"extractionState" : "manual",
1936+
"localizations" : {
1937+
"en" : {
1938+
"stringUnit" : {
1939+
"state" : "translated",
1940+
"value" : "Select a todo."
1941+
}
1942+
},
1943+
"ko" : {
1944+
"stringUnit" : {
1945+
"state" : "translated",
1946+
"value" : "Todo를 선택해주세요."
1947+
}
1948+
}
1949+
}
1950+
},
19001951
"today_due_overdue" : {
19011952
"extractionState" : "manual",
19021953
"localizations" : {

0 commit comments

Comments
 (0)