Skip to content
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

Feature/동봉된 사진 확대 및 저장 #255

Merged
merged 18 commits into from
Nov 13, 2024
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
12 changes: 12 additions & 0 deletions Kabinett.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
5329713E2C782D7A00E965B6 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 5329713D2C782D7A00E965B6 /* Kingfisher */; };
534C67B72C7FF85700F0C175 /* LetterContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 534C67B62C7FF85700F0C175 /* LetterContentView.swift */; };
53573A482C8BF18A00BD69AF /* DragHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53573A472C8BF18A00BD69AF /* DragHelper.swift */; };
5358E0732CE16E630089C59F /* SearchBarViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5358E0722CE16E630089C59F /* SearchBarViewModel.swift */; };
5358E0792CE1EC7E0089C59F /* PhotoDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5358E0782CE1EC7E0089C59F /* PhotoDetailView.swift */; };
5358E07B2CE1F0200089C59F /* ZoomableScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5358E07A2CE1F0200089C59F /* ZoomableScrollView.swift */; };
5359618D2C7488DD0031E181 /* TransparentBlurView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5359618C2C7488DD0031E181 /* TransparentBlurView.swift */; };
535961912C74F5870031E181 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535961902C74F5870031E181 /* CalendarView.swift */; };
538150512C8AD5FB007B1E5A /* LayoutHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538150502C8AD5FB007B1E5A /* LayoutHelper.swift */; };
Expand Down Expand Up @@ -166,6 +169,9 @@
530C765B2C76CEFC007E09C6 /* LetterBoxUseCaseStub.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterBoxUseCaseStub.swift; sourceTree = "<group>"; };
534C67B62C7FF85700F0C175 /* LetterContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LetterContentView.swift; sourceTree = "<group>"; };
53573A472C8BF18A00BD69AF /* DragHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragHelper.swift; sourceTree = "<group>"; };
5358E0722CE16E630089C59F /* SearchBarViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBarViewModel.swift; sourceTree = "<group>"; };
5358E0782CE1EC7E0089C59F /* PhotoDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDetailView.swift; sourceTree = "<group>"; };
5358E07A2CE1F0200089C59F /* ZoomableScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZoomableScrollView.swift; sourceTree = "<group>"; };
5359618C2C7488DD0031E181 /* TransparentBlurView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransparentBlurView.swift; sourceTree = "<group>"; };
535961902C74F5870031E181 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; };
538150502C8AD5FB007B1E5A /* LayoutHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutHelper.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -334,6 +340,7 @@
53BB36412C8E943600E74A4D /* CustomStrokePathView.swift */,
53FC6B832C90204D00E7D9A8 /* CloseButtonView.swift */,
53FC6B852C90207400E7D9A8 /* ContentRectangleView.swift */,
5358E07A2CE1F0200089C59F /* ZoomableScrollView.swift */,
);
path = Components;
sourceTree = "<group>";
Expand Down Expand Up @@ -524,6 +531,7 @@
53A482D72C6C6ACA00F00A9A /* LetterBoxDetailView.swift */,
5300DA4D2C7EC2F9005F22EB /* LetterView.swift */,
534C67B62C7FF85700F0C175 /* LetterContentView.swift */,
5358E0782CE1EC7E0089C59F /* PhotoDetailView.swift */,
);
path = LetterBox;
sourceTree = "<group>";
Expand Down Expand Up @@ -583,6 +591,7 @@
53972B9F2C7B4DE400A8D240 /* LetterBoxDetailViewModel.swift */,
53DC1A2E2C7F0FC000575ACC /* LetterViewModel.swift */,
53A99EA82C81914B00896AAC /* CalendarViewModel.swift */,
5358E0722CE16E630089C59F /* SearchBarViewModel.swift */,
);
path = LetterBox;
sourceTree = "<group>";
Expand Down Expand Up @@ -963,12 +972,14 @@
8356843F2CE0A43600120EC8 /* DIContainer.swift in Sources */,
538150542C8AF04B007B1E5A /* Extension+LetterType.swift in Sources */,
AF9B18F82C894B5900F3E446 /* DefaultImportLetterUseCase.swift in Sources */,
5358E0732CE16E630089C59F /* SearchBarViewModel.swift in Sources */,
83CA92AB2C8160CB00DFB68B /* Publisher+.swift in Sources */,
7F6CE9C42C6B50050074568E /* ImagePickerViewModel.swift in Sources */,
534C67B72C7FF85700F0C175 /* LetterContentView.swift in Sources */,
7FCAE2BA2C73102900228FA7 /* ImageDetailView.swift in Sources */,
04DEC0E72C6C6C7300D289EA /* ProfileView.swift in Sources */,
53A482DA2C6C6F2D00F00A9A /* LetterBoxCell.swift in Sources */,
5358E0792CE1EC7E0089C59F /* PhotoDetailView.swift in Sources */,
53A482D42C6B4E8600F00A9A /* LetterBoxView.swift in Sources */,
530C765A2C7638D9007E09C6 /* LetterBoxViewModel.swift in Sources */,
5359618D2C7488DD0031E181 /* TransparentBlurView.swift in Sources */,
Expand All @@ -981,6 +992,7 @@
AFA58F242C6A02BF00A7C569 /* ImportLetterUseCase.swift in Sources */,
83F0D6852C705E42001B8733 /* AuthManager.swift in Sources */,
57966B9A2C7D8B45008D650B /* Extension+Date.swift in Sources */,
5358E07B2CE1F0200089C59F /* ZoomableScrollView.swift in Sources */,
835684422CE0A43600120EC8 /* Module.swift in Sources */,
83A826CD2C6F2D23006FB09B /* ProfileUseCase.swift in Sources */,
7F6CE9E62C6E28400074568E /* CameraView.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import PhotosUI

struct CustomTabView: View {
@StateObject private var customTabViewModel = CustomTabViewModel()
@StateObject private var calendarViewModel: CalendarViewModel
@StateObject private var profileViewModel: ProfileViewModel
@StateObject private var envelopeStampSelectionViewModel: EnvelopeStampSelectionViewModel
@StateObject private var imagePickerViewModel: ImagePickerViewModel
Expand All @@ -23,7 +22,6 @@ struct CustomTabView: View {
@Injected(ImportLetterUseCaseKey.self) var importLetterUseCase: ImportLetterUseCase

self._customTabViewModel = StateObject(wrappedValue: CustomTabViewModel())
self._calendarViewModel = StateObject(wrappedValue: CalendarViewModel())
self._profileViewModel = StateObject(wrappedValue: ProfileViewModel(profileUseCase: profileUseCase))
self._envelopeStampSelectionViewModel = StateObject(wrappedValue: EnvelopeStampSelectionViewModel(useCase: writeLetterUseCase))
self._imagePickerViewModel = StateObject(wrappedValue: ImagePickerViewModel(componentsUseCase: importLetterUseCase))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct CalendarView: View {
calendarViewModel.endDate = selectedEndDate
calendarViewModel.showCalendarView.toggle()

letterBoxDetailviewModel.fetchSearchByDate(letterType: calendarViewModel.currentLetterType, startDate: calendarViewModel.startDate, endDate: calendarViewModel.endDate)
letterBoxDetailviewModel.fetchSearchByDate(letterType: letterBoxDetailviewModel.currentLetterType, startDate: calendarViewModel.startDate, endDate: calendarViewModel.endDate)

if !calendarViewModel.startDateFiltering {
calendarViewModel.startDateFiltering.toggle()
Expand Down Expand Up @@ -188,7 +188,6 @@ struct CalendarOverlayView: View {
CalendarView(letterBoxDetailviewModel: letterBoxDetailViewModel,
calendarViewModel: calendarViewModel)
.cornerRadius(20)
.padding(.top, 32)
}
}
}
Expand All @@ -206,7 +205,7 @@ struct CalendarBar: View {
.font(.system(size: UIScreen.main.bounds.width * 0.042))

Text("\(formattedDate(date: calendarViewModel.startDate))부터 \(formattedDate(date: calendarViewModel.endDate))까지")
.font(.system(size: UIScreen.main.bounds.width * 0.037))
.font(.system(size: UIScreen.main.bounds.width * 0.036))
.foregroundStyle(.contentSecondary)
.frame(maxWidth: .infinity, alignment: .leading)

Expand All @@ -221,10 +220,8 @@ struct CalendarBar: View {

Button(action: {
withAnimation {
calendarViewModel.startDateFiltering.toggle()
calendarViewModel.startDate = Date()
calendarViewModel.endDate = Date()
letterBoxDetailviewModel.fetchLetterBoxDetailLetters(letterType: calendarViewModel.currentLetterType)
calendarViewModel.resetDateFiltering()
letterBoxDetailviewModel.fetchLetterBoxDetailLetters(letterType: letterBoxDetailviewModel.currentLetterType)
}
}) {
Image(systemName: "xmark.circle.fill")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import SwiftUI
import Kingfisher

struct ContentRectangleView: View {
@StateObject var fontViewModel = FontSelectionViewModel()

var stationeryImageUrlString: String?
var fromUserName: String
var toUserName: String
Expand Down Expand Up @@ -46,11 +44,12 @@ struct ContentRectangleView: View {
.opacity(currentPageIndex == 0 ? 1 : 0)

Text(letterContent.forceCharWrapping)
.font(FontUtility.selectedFont(font: fontString, size: LayoutHelper.shared.getSize(forSE: 0.017, forOthers: 0.015)))
.font(FontUtility.selectedFont(font: fontString, size: FontUtility.fontSize(font: fontString)))
.lineSpacing(FontUtility.lineSpacing(font: fontString))
.kerning(FontUtility.kerning(font: fontString))
.foregroundStyle(.contentPrimary)
.lineSpacing(8)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.top, 15)
.padding(.top, 3)
.padding(.leading, 10)

Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ import SwiftUI

struct SearchBarView: View {
@ObservedObject var viewModel: LetterBoxDetailViewModel
@ObservedObject var searchBarViewModel: SearchBarViewModel

@Binding var searchText: String
@Binding var showSearchBarView: Bool

@Binding var isTextFieldFocused: Bool
@FocusState private var textFieldFocused: Bool

var letterType: LetterType
Expand All @@ -23,20 +20,20 @@ struct SearchBarView: View {
HStack {
Image(systemName: "magnifyingglass")
.tint(.black)
TextField("Search", text: $searchText)
TextField("Search", text: $searchBarViewModel.searchText)
.focused($textFieldFocused)
.textInputAutocapitalization(.never)
.onAppear {
textFieldFocused = isTextFieldFocused
textFieldFocused = searchBarViewModel.isTextFieldFocused
}
.onChange(of: textFieldFocused) { _, newValue in
isTextFieldFocused = newValue
searchBarViewModel.isTextFieldFocused = newValue
}
.onChange(of: searchText) { _, newValue in
.onChange(of: searchBarViewModel.searchText) { _, newValue in
if newValue.isEmpty {
viewModel.fetchLetterBoxDetailLetters(letterType: letterType)
} else {
viewModel.fetchSearchByKeyword(findKeyword: searchText, letterType: letterType)
viewModel.fetchSearchByKeyword(findKeyword: searchBarViewModel.searchText, letterType: letterType)
}
}
.foregroundStyle(.primary)
Expand All @@ -50,8 +47,7 @@ struct SearchBarView: View {

Button(action: {
withAnimation {
showSearchBarView = false
self.searchText = ""
searchBarViewModel.resetSearchFiltering()
viewModel.fetchLetterBoxDetailLetters(letterType: letterType)
}
}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// ZoomableScrollView.swift
// Kabinett
//
// Created by uunwon on 11/11/24.
//

import SwiftUI
import Kingfisher

struct ZoomableScrollView<Content: View>: UIViewRepresentable {
var content: () -> Content

func makeUIView(context: Context) -> UIScrollView {
let scrollView = UIScrollView()
scrollView.delegate = context.coordinator
scrollView.maximumZoomScale = 4.0
scrollView.minimumZoomScale = 1.0
scrollView.showsVerticalScrollIndicator = false
scrollView.showsHorizontalScrollIndicator = false
scrollView.bounces = false
scrollView.backgroundColor = .black

let hostingController = UIHostingController(rootView: content())
hostingController.view.backgroundColor = .clear
hostingController.view.translatesAutoresizingMaskIntoConstraints = false
scrollView.addSubview(hostingController.view)

NSLayoutConstraint.activate([
hostingController.view.leadingAnchor.constraint(equalTo: scrollView.contentLayoutGuide.leadingAnchor),
hostingController.view.trailingAnchor.constraint(equalTo: scrollView.contentLayoutGuide.trailingAnchor),
hostingController.view.topAnchor.constraint(equalTo: scrollView.contentLayoutGuide.topAnchor),
hostingController.view.bottomAnchor.constraint(equalTo: scrollView.contentLayoutGuide.bottomAnchor),
hostingController.view.widthAnchor.constraint(equalTo: scrollView.frameLayoutGuide.widthAnchor),
hostingController.view.heightAnchor.constraint(equalTo: scrollView.frameLayoutGuide.heightAnchor)
])

return scrollView
}

func updateUIView(_ uiView: UIScrollView, context: Context) {
}

func makeCoordinator() -> Coordinator {
Coordinator(self)
}

class Coordinator: NSObject, UIScrollViewDelegate {
var parent: ZoomableScrollView

init(_ parent: ZoomableScrollView) {
self.parent = parent
}

func viewForZooming(in scrollView: UIScrollView) -> UIView? {
scrollView.subviews.first
}
}
}
Loading