Skip to content

Commit

Permalink
Merge branch 'Develop' into Feature/OptionOverlayGuide
Browse files Browse the repository at this point in the history
  • Loading branch information
the-hye authored Dec 5, 2024
2 parents cd781d3 + f12ba04 commit ef1577b
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 52 deletions.
8 changes: 4 additions & 4 deletions Kabinett.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,7 @@
CODE_SIGN_ENTITLEMENTS = Kabinett/Kabinett.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = "\"Kabinett/Preview Content\"";
DEVELOPMENT_TEAM = 59FP2PXRXK;
ENABLE_PREVIEWS = YES;
Expand All @@ -1242,7 +1242,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1.0;
PRODUCT_BUNDLE_IDENTIFIER = co.kr.codegrove.Kabinett;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1264,7 +1264,7 @@
CODE_SIGN_ENTITLEMENTS = Kabinett/Kabinett.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_ASSET_PATHS = "\"Kabinett/Preview Content\"";
DEVELOPMENT_TEAM = 59FP2PXRXK;
ENABLE_PREVIEWS = YES;
Expand All @@ -1283,7 +1283,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1.0;
PRODUCT_BUNDLE_IDENTIFIER = co.kr.codegrove.Kabinett;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ struct CustomTabView: View {
var body: some View {
ZStack(alignment: .bottom) {
TabView(selection: $customTabViewModel.selectedTab) {
LetterBoxView()
LetterBoxView(customTabViewModel: customTabViewModel)
.tag(0)

Color.clear
.tag(1)

ProfileView()
ProfileView(customTabViewModel: customTabViewModel)
.tag(2)
}
.overlay(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ final class CustomTabViewModel: ObservableObject {
@Published var isLetterWrite: Bool = false
@Published var previousTab: Int?

static let profileTabTappedNotification = Notification.Name("profileTabTapped")
static let resetProfileNavigationNotification = Notification.Name("resetProfileNavigation")

private var lastTabSelectionTime: Date?
private let doubleTapInterval: TimeInterval = 0.2
Expand Down
16 changes: 13 additions & 3 deletions Kabinett/Presentation/View/LetterBox/LetterBoxView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ struct LetterBoxView: View {
@StateObject private var calendarViewModel = CalendarViewModel()
@StateObject private var searchBarViewModel = SearchBarViewModel()

init() {
@ObservedObject var customTabViewModel: CustomTabViewModel

init(customTabViewModel: CustomTabViewModel) {
self.customTabViewModel = customTabViewModel

@Injected(LetterBoxUseCaseKey.self) var letterBoxUseCase: LetterBoxUseCase
_letterBoxViewModel = StateObject(wrappedValue: LetterBoxViewModel(letterBoxUseCase: letterBoxUseCase))

Expand All @@ -25,7 +29,7 @@ struct LetterBoxView: View {

var body: some View {
ZStack {
NavigationStack {
NavigationStack(path: $customTabViewModel.letterBoxNavigationPath) {
ZStack {
Color.background
.ignoresSafeArea()
Expand All @@ -34,7 +38,7 @@ struct LetterBoxView: View {
ForEach(LetterType.allCases, id: \.self) { type in
let unreadCount = letterBoxViewModel.getIsReadLetters(for: type)

NavigationLink(destination: LetterBoxDetailView(viewModel: letterBoxDetailViewModel, calendarViewModel: calendarViewModel, searchBarViewModel: searchBarViewModel)) {
NavigationLink(value: type) {
LetterBoxCell(viewModel: letterBoxViewModel, type: type, unreadCount: unreadCount)
}
.simultaneousGesture(TapGesture().onEnded {
Expand All @@ -43,6 +47,12 @@ struct LetterBoxView: View {
}
}
.padding(.top, LayoutHelper.shared.getSize(forSE: 0.035, forOthers: 0.035))
.navigationDestination(for: LetterType.self) { type in
LetterBoxDetailView(viewModel: letterBoxDetailViewModel, calendarViewModel: calendarViewModel, searchBarViewModel: searchBarViewModel)
.onAppear {
letterBoxDetailViewModel.currentLetterType = type
}
}

VStack {
Spacer()
Expand Down
39 changes: 29 additions & 10 deletions Kabinett/Presentation/View/LetterBox/PhotoDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import Kingfisher

struct PhotoDetailView: View {
let photoUrl: String
let savedColor = Color(UIColor(red: 95/255, green: 239/255, blue: 155/255, alpha: 1))

@State private var isPhotoSaved: Bool = false
@Environment(\.dismiss) private var dismiss

var body: some View {
Expand All @@ -26,15 +29,24 @@ struct PhotoDetailView: View {
VStack {
Spacer()
Button(action: {
Task {
await savePhotoToAlbum()
if !isPhotoSaved {
Task {
await savePhotoToAlbum()
}
}
}) {
Image(systemName: "square.and.arrow.down")
.font(.system(size: 20, weight: .medium))
.foregroundStyle(.white)
ZStack {
Circle()
.fill(isPhotoSaved ? savedColor : .contentPrimary)
.frame(width: isPhotoSaved ? 35 : 37)

Image(systemName: isPhotoSaved ? "checkmark" : "square.and.arrow.down")
.font(.system(size: 20, weight: .medium))
.foregroundStyle(isPhotoSaved ? .black : .white)
.padding(.bottom, isPhotoSaved ? 0 : 5)
}
}
.padding(.bottom, 30)
.padding(.bottom, 10)
}

VStack {
Expand All @@ -43,10 +55,16 @@ struct PhotoDetailView: View {
Button(action: {
dismiss()
}) {
Image(systemName: "xmark")
.font(.system(size: 22, weight: .medium))
.foregroundStyle(.white)
.padding(.trailing, 4)
ZStack {
Circle()
.fill(.contentPrimary)
.frame(width: 31, height: 31)

Image(systemName: "xmark")
.font(.system(size: 16, weight: .medium))
.foregroundStyle(.white)
}
.padding(.trailing, 4)
}
.padding()
}
Expand All @@ -63,6 +81,7 @@ struct PhotoDetailView: View {
let (data, _) = try await URLSession.shared.data(from: url)
if let image = UIImage(data: data) {
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
isPhotoSaved = true
} else {
print("이미지 변환에 실패했습니다.")
}
Expand Down
24 changes: 15 additions & 9 deletions Kabinett/Presentation/View/Profile/ProfileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ import Kingfisher
struct ProfileView: View {
//
@StateObject private var viewModel: ProfileViewModel
@ObservedObject var customTabViewModel: CustomTabViewModel

init() {
init(customTabViewModel: CustomTabViewModel) {
self.customTabViewModel = customTabViewModel

@Injected(ProfileUseCaseKey.self)
var profileUseCase: ProfileUseCase

Expand All @@ -23,21 +26,21 @@ struct ProfileView: View {
}

var body: some View {
NavigationStack {
NavigationStack(path: $customTabViewModel.profileNavigationPath) {
Group {
if case .toLogin = viewModel.navigateState {
SignUpView()
} else {
ZStack {
Color.background.ignoresSafeArea(.all)
if viewModel.profileUpdateError != nil {
// VStack {
// Text("프로필을 불러오는 데 문제가 발생했어요.")
// .fontWeight(.regular)
// .foregroundColor(.alert)
// .font(.headline)
// .padding()
// }
// VStack {
// Text("프로필을 불러오는 데 문제가 발생했어요.")
// .fontWeight(.regular)
// .foregroundColor(.alert)
// .font(.headline)
// .padding()
// }
} else {
VStack {
if let image = viewModel.currentWriter.imageUrlString {
Expand Down Expand Up @@ -95,5 +98,8 @@ struct ProfileView: View {
SettingsView(viewModel: viewModel)
}
}
.onReceive(NotificationCenter.default.publisher(for: CustomTabViewModel.resetProfileNavigationNotification)) { _ in
viewModel.showSettingsView = false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct ContentWriteView: View {
.alert(isPresented: $viewModel.isDeleteAlertPresented) {
Alert(
title: Text("Delete Page"),
message: Text("현재 페이지를 삭제하시겠습니까?"),
message: Text("현재 페이지를 지우시겠어요?"),
primaryButton: .destructive(Text("삭제")) {
viewModel.deleteLetter(idx: viewModel.currentIndex)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ struct EnvelopeStampSelectionView: View {
@StateObject var viewModel: EnvelopeStampSelectionViewModel
@ObservedObject var imageViewModel: ImagePickerViewModel
@ObservedObject var customTabViewModel: CustomTabViewModel
@State private var text: String = ""
@State private var postScriptText: String = ""
@State private var envelopeImageUrl: String
@State private var stampImageUrl: String
@State private var postScriptText: String = ""

init(
letterContent: Binding<LetterWriteModel>,
Expand All @@ -29,7 +28,6 @@ struct EnvelopeStampSelectionView: View {

_envelopeImageUrl = State(initialValue: letterContent.wrappedValue.envelopeImageUrlString)
_stampImageUrl = State(initialValue: letterContent.wrappedValue.stampImageUrlString)
_postScriptText = State(initialValue: letterContent.wrappedValue.postScript ?? "")

@Injected(WriteLetterUseCaseKey.self) var writeLetterUseCase: WriteLetterUseCase
_viewModel = StateObject(wrappedValue: EnvelopeStampSelectionViewModel(useCase: writeLetterUseCase))
Expand All @@ -43,7 +41,7 @@ struct EnvelopeStampSelectionView: View {
}

VStack {
WriteLetterEnvelopeCell(letter: Letter(fontString: letterContent.fontString, postScript: letterContent.postScript, envelopeImageUrlString: letterContent.envelopeImageUrlString, stampImageUrlString: letterContent.stampImageUrlString, fromUserId: letterContent.fromUserId, fromUserName: letterContent.fromUserName, fromUserKabinettNumber: letterContent.fromUserKabinettNumber, toUserId: letterContent.toUserId, toUserName: letterContent.toUserName, toUserKabinettNumber: letterContent.toUserKabinettNumber, content: letterContent.content, photoContents: [""], date: letterContent.date, stationeryImageUrlString: letterContent.stationeryImageUrlString, isRead: true))
WriteLetterEnvelopeCell(letter: Letter(fontString: letterContent.fontString, postScript: postScriptText, envelopeImageUrlString: letterContent.envelopeImageUrlString, stampImageUrlString: letterContent.stampImageUrlString, fromUserId: letterContent.fromUserId, fromUserName: letterContent.fromUserName, fromUserKabinettNumber: letterContent.fromUserKabinettNumber, toUserId: letterContent.toUserId, toUserName: letterContent.toUserName, toUserKabinettNumber: letterContent.toUserKabinettNumber, content: letterContent.content, photoContents: [""], date: letterContent.date, stationeryImageUrlString: letterContent.stationeryImageUrlString, isRead: true))
.padding(.top, 10)
.padding(.bottom, 50)
.onChange(of: viewModel.envelopes) {
Expand All @@ -61,15 +59,15 @@ struct EnvelopeStampSelectionView: View {
Text("봉투에 적을 내용")
.font(.system(size: 13))
.padding(.bottom, 1)
TextField("최대 15글자를 적을 수 있어요.", text: $text)
.maxLength(text: $text, 15)
TextField("최대 15글자를 적을 수 있어요.", text: $postScriptText)
.maxLength(text: $postScriptText, 15)
.padding(.leading, 6)
.font(.system(size: 14))
.frame(maxWidth: .infinity, minHeight: 35, alignment: .leading)
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 5))
.onChange(of: text) {
letterContent.postScript = text
.onChange(of: postScriptText) {
letterContent.postScript = postScriptText
}
}
.padding(.bottom, 30)
Expand All @@ -82,7 +80,6 @@ struct EnvelopeStampSelectionView: View {
await viewModel.loadStamps()
await viewModel.loadEnvelopes()

postScriptText = letterContent.postScript ?? ""
if letterContent.dataSource == .fromImagePicker {
await imageViewModel.loadAndUpdateEnvelopeAndStamp()
envelopeImageUrl = imageViewModel.envelopeURL ?? ""
Expand Down
12 changes: 12 additions & 0 deletions Kabinett/Presentation/View/WriteLetter/UserSelectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ struct UserSelectionView: View {
Spacer(minLength: 95)
VStack {
SearchBar(letterContent: $letterContent, searchText: $viewModel.searchText, viewModel: viewModel)
Group {
Text("정확한 닉네임")
.bold() +
Text(" 혹은 -를 뺀") +
Text(" 6개의 카비넷 번호만\n")
.bold() +
Text("입력해주세요.")
}
.font(.system(size: 12))
.foregroundColor(Color("ContentSecondary"))
.lineSpacing(3)
.padding(.top, 1)
}
} else {
Spacer(minLength: 65)
Expand Down
Loading

0 comments on commit ef1577b

Please sign in to comment.