Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ class BundleViewModel {

var selectedBundle: KeyringBundle?

/// 메인 뭉치로 selected* 상태 복원 (상세/완성 화면에서 나갈 때 호출)
/// 홈 화면이 공유 bundleVM을 참조하므로, 다른 화면에서 변경된 상태를 정리
func restoreMainBundle() {
guard let mainBundle = sortedBundles.first(where: { $0.isMain }) ?? sortedBundles.first else { return }
selectedBundle = mainBundle
selectedBackground = resolveBackground(from: mainBundle.selectedBackground)
selectedCarabiner = resolveCarabiner(from: mainBundle.selectedCarabiner)
}

// MARK: - 사용자 데이터

var bundles: [KeyringBundle] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ extension BundleCompleteView {
ToolbarItem(placement: .topBarLeading) {
Button {
cleanupCachedVideo()
bundleVM.restoreMainBundle()
TabBarManager.switchTo(.workshop)
TabBarManager.show()
router.reset()
Expand Down Expand Up @@ -318,6 +319,7 @@ extension BundleCompleteView {

private func navigateToInventory() {
cleanupCachedVideo()
bundleVM.restoreMainBundle()
CollectionViewModel.shouldStartWithBundleTab = true
TabBarManager.switchTo(.collection)
TabBarManager.show()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ extension BundleCreateView {
// 미리 선택된 배경이 없으면 "퍼플키치"를 기본으로 선택
if bundleVM.newSelectedBackground == nil {
bundleVM.newSelectedBackground = bundleVM.backgroundViewData.first { bg in
bg.background.backgroundName == "퍼플키치"
bg.background.backgroundName == "퍼플 키치"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

별건 아닌데 큰일날 뻔했네요

} ?? bundleVM.backgroundViewData.first
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ extension BundleCreateView {
var customNavigationBar: some View {
CustomNavigationBar {
BackToolbarButton {
bundleVM.restoreMainBundle()
TabBarManager.show()
router.pop()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ extension BundleDetailView {
bundleVM.lastCarabinerIdForDetail = ""
bundleVM.lastBackgroundIdForDetail = ""
router.pop()

// pop 애니메이션 완료 후 메인 뭉치로 복원
Task { @MainActor in
try? await Task.sleep(for: .milliseconds(350))
bundleVM.restoreMainBundle()
}
}

Spacer()
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "d.pdf",
"filename" : "homeGuiding.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.