Skip to content

Commit

Permalink
feat: #50 Add feature to delete completion book and app logo
Browse files Browse the repository at this point in the history
- μΆœμ‹œλ₯Ό μœ„ν•΄ μ•± 이미지λ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€.
- μ™„λ…ν•œ 책을 μ‚­μ œν•˜λŠ” κΈ°λŠ₯을 μΆ”κ°€ν•©λ‹ˆλ‹€.
  • Loading branch information
zaehorang committed Nov 11, 2024
1 parent a3335bd commit 1b1be58
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 46 deletions.
12 changes: 8 additions & 4 deletions FiveGuyes/FiveGuyes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@
};
buildConfigurationList = 26890B8C2CAE811A008DFF49 /* Build configuration list for PBXProject "FiveGuyes" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
developmentRegion = ko;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
ko,
);
mainGroup = 26890B882CAE811A008DFF49;
packageReferences = (
Expand Down Expand Up @@ -573,10 +573,12 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"FiveGuyes/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = LYC8XX4ZNC;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = FiveGuyes/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "ν•œμž…λ…μ„œ";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.books";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -609,10 +611,12 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"FiveGuyes/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = LYC8XX4ZNC;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = FiveGuyes/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "ν•œμž…λ…μ„œ";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.books";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"}]}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import SwiftData
import SwiftUI

struct CompletionListView: View {
@Environment(\.modelContext) private var modelContext

@State private var selectedBookIndex: Int = 0
@State var showCompletionAlert: Bool = false

// μ™„λ…ν•œ 책을 κ°€μ Έμ˜€λŠ” 쿼리
@Query(
Expand All @@ -18,6 +21,9 @@ struct CompletionListView: View {
)
private var completedBooks: [UserBook]

let completionAlertMessage = "μ •λ§λ‘œ λ‚΄μš©μ„ μ‚­μ œν• κΉŒμš”?"
let completionAlertText = "μ‚­μ œ ν›„μ—λŠ” 볡원할 수 μ—†μ–΄μš”"

var body: some View {
VStack(alignment: .leading, spacing: 16) {
HStack {
Expand Down Expand Up @@ -55,14 +61,13 @@ struct CompletionListView: View {
}

VStack(alignment: .leading, spacing: 0) {
Text(book.book.title ?? "")
Text(book.book.title )
.font(.system(size: 14, weight: .semibold))
.foregroundColor(.black)
Text(book.book.author ?? "")
Text(book.book.author)
.font(.system(size: 12, weight: .medium))
.foregroundColor(Color(red: 0.44, green: 0.44, blue: 0.44))
}
//
}
.frame(width: 115)
.onTapGesture {
Expand All @@ -85,6 +90,18 @@ struct CompletionListView: View {
HStack {
Text("\(selectedBook.book.targetEndDate.toKoreanDateStringWithoutYear()) μ™„λ…μ™„λ£Œ")
Spacer()
// TODO: μˆ˜μ •ν•˜κΈ° κΈ°λŠ₯ μΆ”κ°€
Button {
showCompletionAlert = true
} label: {
Image(systemName: "ellipsis")
.resizable()
.scaledToFit()
.frame(width: 20, height: 22)
.tint(Color(red: 0.44, green: 0.44, blue: 0.44))
.padding(.trailing, 3)
}

}
.font(.system(size: 12, weight: .medium))
.foregroundColor(Color(red: 0.44, green: 0.44, blue: 0.44))
Expand All @@ -103,9 +120,16 @@ struct CompletionListView: View {
.foregroundColor(Color(red: 0.93, green: 0.97, blue: 0.95))
}
}
.alert(isPresented: $showCompletionAlert) {
Alert(
title: Text(completionAlertText),
message: Text(completionAlertMessage),
primaryButton: .cancel(Text("μ·¨μ†Œν•˜κΈ°")),
secondaryButton: .destructive(Text("μ‚­μ œ")) {
let book = completedBooks[selectedBookIndex]
modelContext.delete(book)
}
)
}
}
}

#Preview {
CompletionListView()
}
12 changes: 8 additions & 4 deletions FiveGuyes/FiveGuyes/Sources/Views/EmptyNotiView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ import SwiftUI
struct EmptyNotiView: View {
var body: some View {
VStack(spacing: 0) {
Image("wandoki2")
Image("nothingWandoki")
.resizable()
.frame(width: 194, height: 194)
.scaledToFit()
.frame(width: 194)
.padding(.bottom, 10)
Text("아직 λ„μ°©ν•œ μ•Œλ¦Όμ΄ μ—†μ–΄μš”")
.font(.system(size: 24))
.fontWeight(.semibold)
.font(.system(size: 24, weight: .semibold))
}
.navigationTitle("μ•Œλ¦Ό")
.navigationBarTitleDisplayMode(.inline)
.navigationBarBackButtonHidden(true)
.customNavigationBackButton()
}
}

Expand Down
50 changes: 32 additions & 18 deletions FiveGuyes/FiveGuyes/Sources/Views/Screen/Main/MainHomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ struct MainHomeView: View {
@Environment(\.modelContext) private var modelContext

@State private var topSafeAreaInset: CGFloat = 0
@State private var showAlert = false
@State private var showReadingBookAlert = false
@State private var showCompletionAlert = false

let mainAlertMessage = "μ‚­μ œ ν›„μ—λŠ” 볡원할 수 μ—†μ–΄μš”"

@Query(filter: #Predicate<UserBook> { $0.isCompleted == false })
private var currentlyReadingBooks: [UserBook]

let alertMessage = "μ‚­μ œ ν›„μ—λŠ” 볡원할 수 μ—†μ–΄μš”"

var body: some View {
let title = currentlyReadingBooks.first?.book.title ?? "제λͺ© μ—†μŒ"
let alertText = "ν˜„μž¬ 읽고 μžˆλŠ” <\(title)>\(title.postPositionParticle()) μ±…μž₯μ—μ„œ μ‚­μ œν• κΉŒμš”?"
let mainAlertText = "ν˜„μž¬ 읽고 μžˆλŠ” <\(title)>\(title.postPositionParticle()) μ±…μž₯μ—μ„œ μ‚­μ œν• κΉŒμš”?"

ScrollView {
ZStack(alignment: .top) {
Expand All @@ -45,14 +46,27 @@ struct MainHomeView: View {

if !currentlyReadingBooks.isEmpty {
Button {
showAlert = true
showReadingBookAlert = true
} label: {
Image(systemName: "ellipsis")
.resizable()
.scaledToFit()
.frame(width: 20, height: 22)
.tint(Color(red: 0.44, green: 0.44, blue: 0.44))
}
.alert(isPresented: $showReadingBookAlert) {
Alert(
title: Text(mainAlertText),
message: Text(mainAlertMessage),
primaryButton: .cancel(Text("μ·¨μ†Œν•˜κΈ°")),
secondaryButton: .destructive(Text("μ‚­μ œ")) {
if let currentReadingBook = currentlyReadingBooks.first {
// SwiftData μ»¨ν…μŠ€νŠΈμ—μ„œ μ‚­μ œ ν•„μš”
modelContext.delete(currentReadingBook)
}
}
)
}
}
}

Expand Down Expand Up @@ -92,6 +106,7 @@ struct MainHomeView: View {
}
.padding(.bottom, 40)

// completionList
CompletionListView()

}
Expand All @@ -102,19 +117,18 @@ struct MainHomeView: View {
.background(.white)
.ignoresSafeArea(edges: .top)
.scrollIndicators(.hidden)
.alert(isPresented: $showAlert) {
Alert(
title: Text(alertText),
message: Text(alertMessage),
primaryButton: .cancel(Text("μ·¨μ†Œν•˜κΈ°")),
secondaryButton: .destructive(Text("μ‚­μ œ")) {
if let currentReadingBook = currentlyReadingBooks.first {
// SwiftData μ»¨ν…μŠ€νŠΈμ—μ„œ μ‚­μ œ ν•„μš”
modelContext.delete(currentReadingBook)
}
}
)
}

// .alert(isPresented: $showCompletionAlert) {
// Alert(
// title: Text(completionAlertText),
// message: Text(completionAlertMessage),
// primaryButton: .cancel(Text("μ·¨μ†Œν•˜κΈ°")),
// secondaryButton: .destructive(Text("μ‚­μ œ")) {
// let book = completedBooks[selectedBookIndex]
// modelContext.delete(book)
// }
// )
// }
.onAppear {
// 상단 μ•ˆμ „ μ˜μ—­ κ°’ 계산
if let window = UIApplication.shared.connectedScenes
Expand Down

0 comments on commit 1b1be58

Please sign in to comment.