From 719c87bd59326cbd865f10c5ddc2223fa0c2f61b Mon Sep 17 00:00:00 2001 From: Sunghun Kim <81547954+kimsh153@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:38:59 +0900 Subject: [PATCH 1/2] =?UTF-8?q?:coffin:=20[#239]=20All=20/=20dream?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=EB=90=9C=20=EB=82=B4=EC=9A=A9=20=EC=A7=80?= =?UTF-8?q?=EC=9A=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Interface/DI/FileDomainBuildable.swift | 1 - .../DataSource/RemoteFileDataSource.swift | 1 - .../Interface/Repository/FileRepository.swift | 1 - .../UseCase/DreamBookUploadUseCase.swift | 5 ---- .../Sources/DI/FileDomainComponent.swift | 3 --- .../Response/DreamBookUploadResponseDTO.swift | 9 -------- .../DataSource/RemoteFileDataSourceImpl.swift | 8 ------- .../Sources/Endpoint/FileEndpoint.swift | 17 +------------- .../Repository/FileRepositoryImpl.swift | 4 ---- .../UseCase/DreamBookUploadUseCaseImpl.swift | 14 ----------- .../DTO/Request/StudentRequestDTO.swift | 4 ---- .../Entity/StudentDetailEntity.swift | 3 --- ...tchStudentDetailByTeacherResponseDTO.swift | 2 -- .../DI/InputInformationComponent.swift | 1 - .../Intent/InputInformationIntent.swift | 8 ------- .../Sources/Intent/StudentDetailIntent.swift | 23 ------------------- .../Intent/StudentDetailIntentProtocol.swift | 2 -- .../Sources/Model/StudentDetailModel.swift | 5 ---- .../Model/StudentDetailModelProtocol.swift | 2 -- .../Sources/Scene/StudentDetailView.swift | 18 --------------- 20 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 Projects/Domain/FileDomain/Interface/UseCase/DreamBookUploadUseCase.swift delete mode 100644 Projects/Domain/FileDomain/Sources/DTO/Response/DreamBookUploadResponseDTO.swift delete mode 100644 Projects/Domain/FileDomain/Sources/UseCase/DreamBookUploadUseCaseImpl.swift diff --git a/Projects/Domain/FileDomain/Interface/DI/FileDomainBuildable.swift b/Projects/Domain/FileDomain/Interface/DI/FileDomainBuildable.swift index d9672fdb..f92da64a 100644 --- a/Projects/Domain/FileDomain/Interface/DI/FileDomainBuildable.swift +++ b/Projects/Domain/FileDomain/Interface/DI/FileDomainBuildable.swift @@ -1,5 +1,4 @@ public protocol FileDomainBuildable { - var dreamBookUploadUseCase: any DreamBookUploadUseCase { get } var imageUploadUseCase: any ImageUploadUseCase { get } var fileRepository: any FileRepository { get } } diff --git a/Projects/Domain/FileDomain/Interface/DataSource/RemoteFileDataSource.swift b/Projects/Domain/FileDomain/Interface/DataSource/RemoteFileDataSource.swift index 032d79bf..d1a6cbe5 100644 --- a/Projects/Domain/FileDomain/Interface/DataSource/RemoteFileDataSource.swift +++ b/Projects/Domain/FileDomain/Interface/DataSource/RemoteFileDataSource.swift @@ -1,6 +1,5 @@ import Foundation public protocol RemoteFileDataSource { - func dreamBookUpload(file: Data, fileName: String) async throws -> String func imageUpload(image: Data, fileName: String) async throws -> String } diff --git a/Projects/Domain/FileDomain/Interface/Repository/FileRepository.swift b/Projects/Domain/FileDomain/Interface/Repository/FileRepository.swift index 0be19549..913b8175 100644 --- a/Projects/Domain/FileDomain/Interface/Repository/FileRepository.swift +++ b/Projects/Domain/FileDomain/Interface/Repository/FileRepository.swift @@ -1,6 +1,5 @@ import Foundation public protocol FileRepository { - func dreamBookUpload(file: Data, fileName: String) async throws -> String func imageUpload(image: Data, fileName: String) async throws -> String } diff --git a/Projects/Domain/FileDomain/Interface/UseCase/DreamBookUploadUseCase.swift b/Projects/Domain/FileDomain/Interface/UseCase/DreamBookUploadUseCase.swift deleted file mode 100644 index 54dbe35d..00000000 --- a/Projects/Domain/FileDomain/Interface/UseCase/DreamBookUploadUseCase.swift +++ /dev/null @@ -1,5 +0,0 @@ -import Foundation - -public protocol DreamBookUploadUseCase { - func execute(file: Data, fileName: String) async throws -> String -} diff --git a/Projects/Domain/FileDomain/Sources/DI/FileDomainComponent.swift b/Projects/Domain/FileDomain/Sources/DI/FileDomainComponent.swift index 01c730a4..c8aa1dbb 100644 --- a/Projects/Domain/FileDomain/Sources/DI/FileDomainComponent.swift +++ b/Projects/Domain/FileDomain/Sources/DI/FileDomainComponent.swift @@ -10,9 +10,6 @@ public final class FileDomainComponent: Component, FileDom public var imageUploadUseCase: any ImageUploadUseCase { ImageUploadUseCaseImpl(fileRepository: fileRepository) } - public var dreamBookUploadUseCase: any DreamBookUploadUseCase { - DreamBookUploadUseCaseImpl(fileRepository: fileRepository) - } public var fileRepository: any FileRepository { FileRepositoryImpl(remoteFileDataSource: remoteFileDataSource) } diff --git a/Projects/Domain/FileDomain/Sources/DTO/Response/DreamBookUploadResponseDTO.swift b/Projects/Domain/FileDomain/Sources/DTO/Response/DreamBookUploadResponseDTO.swift deleted file mode 100644 index 18bc28b6..00000000 --- a/Projects/Domain/FileDomain/Sources/DTO/Response/DreamBookUploadResponseDTO.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -public struct DreamBookUploadResponseDTO: Decodable { - public let fileURL: String - - enum CodingKeys: String, CodingKey { - case fileURL = "fileUrl" - } -} diff --git a/Projects/Domain/FileDomain/Sources/DataSource/RemoteFileDataSourceImpl.swift b/Projects/Domain/FileDomain/Sources/DataSource/RemoteFileDataSourceImpl.swift index 1582618e..687b87de 100644 --- a/Projects/Domain/FileDomain/Sources/DataSource/RemoteFileDataSourceImpl.swift +++ b/Projects/Domain/FileDomain/Sources/DataSource/RemoteFileDataSourceImpl.swift @@ -3,14 +3,6 @@ import Foundation import BaseDomain final class RemoteFileDataSourceImpl: BaseRemoteDataSource, RemoteFileDataSource { - func dreamBookUpload(file: Data, fileName: String) async throws -> String { - try await request( - .dreamBookUpload(file: file, fileName: fileName), - dto: DreamBookUploadResponseDTO.self - ) - .fileURL - } - func imageUpload(image: Data, fileName: String) async throws -> String { try await request( .imageUpload(image: image, fileName: fileName), diff --git a/Projects/Domain/FileDomain/Sources/Endpoint/FileEndpoint.swift b/Projects/Domain/FileDomain/Sources/Endpoint/FileEndpoint.swift index 83e636d8..8e23daf0 100644 --- a/Projects/Domain/FileDomain/Sources/Endpoint/FileEndpoint.swift +++ b/Projects/Domain/FileDomain/Sources/Endpoint/FileEndpoint.swift @@ -4,7 +4,6 @@ import FileDomainInterface import Foundation enum FileEndpoint { - case dreamBookUpload(file: Data, fileName: String) case imageUpload(image: Data, fileName: String) } @@ -17,9 +16,6 @@ extension FileEndpoint: SMSEndpoint { var route: Route { switch self { - case .dreamBookUpload: - return .post("") - case .imageUpload: return .post("/image") } @@ -27,11 +23,6 @@ extension FileEndpoint: SMSEndpoint { var task: HTTPTask { switch self { - case let .dreamBookUpload(file, fileName): - return .uploadMultipart([ - MultiPartFormData(field: "file", data: file, fileName: fileName) - ]) - case let .imageUpload(image, fileName): return .uploadMultipart([ MultiPartFormData(field: "file", data: image, fileName: fileName) @@ -44,7 +35,7 @@ extension FileEndpoint: SMSEndpoint { var jwtTokenType: JwtTokenType { switch self { - case .dreamBookUpload, .imageUpload: + case .imageUpload: return .accessToken default: @@ -58,12 +49,6 @@ extension FileEndpoint: SMSEndpoint { var errorMap: [Int: ErrorType]? { switch self { - case .dreamBookUpload: - return [ - 400: .notHwpFile, - 500: .internalServerError - ] - case .imageUpload: return [ 400: .notImageType, diff --git a/Projects/Domain/FileDomain/Sources/Repository/FileRepositoryImpl.swift b/Projects/Domain/FileDomain/Sources/Repository/FileRepositoryImpl.swift index 48ddfa15..75172fac 100644 --- a/Projects/Domain/FileDomain/Sources/Repository/FileRepositoryImpl.swift +++ b/Projects/Domain/FileDomain/Sources/Repository/FileRepositoryImpl.swift @@ -8,10 +8,6 @@ struct FileRepositoryImpl: FileRepository { self.remoteFileDataSource = remoteFileDataSource } - func dreamBookUpload(file: Data, fileName: String) async throws -> String { - try await remoteFileDataSource.dreamBookUpload(file: file, fileName: fileName) - } - func imageUpload(image: Data, fileName: String) async throws -> String { try await remoteFileDataSource.imageUpload(image: image, fileName: fileName) } diff --git a/Projects/Domain/FileDomain/Sources/UseCase/DreamBookUploadUseCaseImpl.swift b/Projects/Domain/FileDomain/Sources/UseCase/DreamBookUploadUseCaseImpl.swift deleted file mode 100644 index c41a0f0c..00000000 --- a/Projects/Domain/FileDomain/Sources/UseCase/DreamBookUploadUseCaseImpl.swift +++ /dev/null @@ -1,14 +0,0 @@ -import FileDomainInterface -import Foundation - -struct DreamBookUploadUseCaseImpl: DreamBookUploadUseCase { - private let fileRepository: any FileRepository - - init(fileRepository: any FileRepository) { - self.fileRepository = fileRepository - } - - func execute(file: Data, fileName: String) async throws -> String { - try await fileRepository.dreamBookUpload(file: file, fileName: fileName) - } -} diff --git a/Projects/Domain/StudentDomain/Interface/DTO/Request/StudentRequestDTO.swift b/Projects/Domain/StudentDomain/Interface/DTO/Request/StudentRequestDTO.swift index 7b6f7ba5..ecde9a72 100644 --- a/Projects/Domain/StudentDomain/Interface/DTO/Request/StudentRequestDTO.swift +++ b/Projects/Domain/StudentDomain/Interface/DTO/Request/StudentRequestDTO.swift @@ -3,7 +3,6 @@ import Foundation public struct InputStudentInformationRequestDTO: Encodable { public let certificate: [String] public let contactEmail: String - public let dreamBookFileURL: String public let formOfEmployment: FormOfEmployment public let gsmAuthenticationScore: Int public let introduce: String @@ -21,7 +20,6 @@ public struct InputStudentInformationRequestDTO: Encodable { public init( certificate: [String], contactEmail: String, - dreamBookFileURL: String, formOfEmployment: FormOfEmployment, gsmAuthenticationScore: Int, introduce: String, @@ -38,7 +36,6 @@ public struct InputStudentInformationRequestDTO: Encodable { ) { self.certificate = certificate self.contactEmail = contactEmail - self.dreamBookFileURL = dreamBookFileURL self.formOfEmployment = formOfEmployment self.gsmAuthenticationScore = gsmAuthenticationScore self.introduce = introduce @@ -57,7 +54,6 @@ public struct InputStudentInformationRequestDTO: Encodable { enum CodingKeys: String, CodingKey { case certificate case contactEmail - case dreamBookFileURL = "dreamBookFileUrl" case formOfEmployment case gsmAuthenticationScore case introduce diff --git a/Projects/Domain/StudentDomain/Interface/Entity/StudentDetailEntity.swift b/Projects/Domain/StudentDomain/Interface/Entity/StudentDetailEntity.swift index 562a2491..a95fdedb 100644 --- a/Projects/Domain/StudentDomain/Interface/Entity/StudentDetailEntity.swift +++ b/Projects/Domain/StudentDomain/Interface/Entity/StudentDetailEntity.swift @@ -50,7 +50,6 @@ extension StudentDetailEntity { } public struct DetailInfoByTeacher: Equatable { - public let dreamBookFileURL: String? public let portfolioURL: String? public let grade: Int public let `class`: Int @@ -66,7 +65,6 @@ extension StudentDetailEntity { public let certificate: [String] public init( - dreamBookFileURL: String?, portfolioURL: String?, grade: Int, class: Int, @@ -81,7 +79,6 @@ extension StudentDetailEntity { languageCertificate: [LanguageCertificateEntity], certificate: [String] ) { - self.dreamBookFileURL = dreamBookFileURL self.portfolioURL = portfolioURL self.grade = grade self.class = `class` diff --git a/Projects/Domain/StudentDomain/Sources/DTO/Response/FetchStudentDetailByTeacherResponseDTO.swift b/Projects/Domain/StudentDomain/Sources/DTO/Response/FetchStudentDetailByTeacherResponseDTO.swift index f3126700..8cb1c408 100644 --- a/Projects/Domain/StudentDomain/Sources/DTO/Response/FetchStudentDetailByTeacherResponseDTO.swift +++ b/Projects/Domain/StudentDomain/Sources/DTO/Response/FetchStudentDetailByTeacherResponseDTO.swift @@ -4,7 +4,6 @@ import Foundation public struct FetchStudentDetailByTeacherResponseDTO: Decodable { public let name: String public let introduce: String - public let dreamBookFileUrl: String? public let portfolioUrl: String? public let grade: Int public let classNum: Int @@ -54,7 +53,6 @@ public extension FetchStudentDetailByTeacherResponseDTO { projects: projects.map { $0.toDomain() }, prizes: prizes.map { $0.toDomain() }, detailInfoByTeacher: .init( - dreamBookFileURL: dreamBookFileUrl, portfolioURL: portfolioUrl, grade: grade, class: classNum, diff --git a/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift b/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift index bf754009..efdadaa2 100644 --- a/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift +++ b/Projects/Feature/InputInformationFeature/Sources/DI/InputInformationComponent.swift @@ -35,7 +35,6 @@ public final class InputInformationComponent: let intent = InputInformationIntent( model: model, inputInformationDelegate: delegate, - dreamBookUploadUseCase: dependency.fileDomainBuildable.dreamBookUploadUseCase, imageUploadUseCase: dependency.fileDomainBuildable.imageUploadUseCase, inputInformationUseCase: dependency.studentDomainBuildable.inputInformationUseCase ) diff --git a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift index 2f2470fd..3fc5b777 100644 --- a/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift +++ b/Projects/Feature/InputInformationFeature/Sources/Intent/InputInformationIntent.swift @@ -16,20 +16,17 @@ import DateUtil final class InputInformationIntent: InputInformationIntentProtocol { private weak var model: (any InputInformationActionProtocol)? private weak var inputInformationDelegate: (any InputInformationDelegate)? - private let dreamBookUploadUseCase: any DreamBookUploadUseCase private let imageUploadUseCase: any ImageUploadUseCase private let inputInformationUseCase: any InputInformationUseCase init( model: any InputInformationActionProtocol, inputInformationDelegate: any InputInformationDelegate, - dreamBookUploadUseCase: any DreamBookUploadUseCase, imageUploadUseCase: any ImageUploadUseCase, inputInformationUseCase: any InputInformationUseCase ) { self.model = model self.inputInformationDelegate = inputInformationDelegate - self.dreamBookUploadUseCase = dreamBookUploadUseCase self.imageUploadUseCase = imageUploadUseCase self.inputInformationUseCase = inputInformationUseCase } @@ -52,15 +49,10 @@ final class InputInformationIntent: InputInformationIntentProtocol { image: inputProfileInfo.profileImageData, fileName: inputProfileInfo.profileImageFilename ) - async let dreamBookURL = dreamBookUploadUseCase.execute( - file: inputSchoolLifeInfo.hwpData, - fileName: inputSchoolLifeInfo.hwpFilename - ) let inputInformationRequest = try await InputStudentInformationRequestDTO( certificate: state.certificates, contactEmail: inputProfileInfo.contactEmail, - dreamBookFileURL: dreamBookURL, formOfEmployment: FormOfEmployment(rawValue: inputWorkInfo.formOfEmployment) ?? .fullTime, gsmAuthenticationScore: inputSchoolLifeInfo.gsmAuthenticationScore, introduce: inputProfileInfo.introduce, diff --git a/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntent.swift b/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntent.swift index da4e2bfc..bb0fe60e 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntent.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntent.swift @@ -41,32 +41,9 @@ final class StudentDetailIntent: StudentDetailIntentProtocol { } } - func dreamBookDownloadButtonDidTap(dreamBookFileURL: String) { - guard let url = URL(string: dreamBookFileURL) else { return } - throttler { - self.model?.updateIsDownloading(isDownloading: true) - Task(priority: .background) { - do { - let (dreamBookFileData, _) = try await URLSession.shared.data(from: url) - let hwpDocument = HWPDocument(hwpData: dreamBookFileData) - self.model?.updateHWPDocument(hwpDocument: hwpDocument) - try await Task.sleep(nanoseconds: 1_000_000_000) - self.model?.updateIsDownloading(isDownloading: false) - self.model?.updateIsPresentedDreamBookExporter(isPresented: true) - } catch { - self.model?.updateIsDownloading(isDownloading: false) - } - } - } - } - deinit { print("DEIIN") } - - func dreamBookFileExporterDismissed() { - model?.updateIsPresentedDreamBookExporter(isPresented: false) - } } private extension UserRoleType { diff --git a/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntentProtocol.swift b/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntentProtocol.swift index 12393091..4a7197ed 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntentProtocol.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Intent/StudentDetailIntentProtocol.swift @@ -2,6 +2,4 @@ import Foundation protocol StudentDetailIntentProtocol { func onAppear() - func dreamBookDownloadButtonDidTap(dreamBookFileURL: String) - func dreamBookFileExporterDismissed() } diff --git a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift index 1a91d961..88f00a5d 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift @@ -26,7 +26,6 @@ final class StudentDetailModel: ObservableObject, StudentDetailStateProtocol { @Published var _studentDetailEntity: StudentDetailEntity? @Published var isLoading: Bool = false @Published var isDownloading: Bool = false - @Published var isPresentedDreamBookExporter: Bool = false @Published var hwpDocument: HWPDocument? var hwpFilename: String { guard let studentDetailEntity, let info = studentDetailEntity.detailInfoByTeacher else { return "" } @@ -53,10 +52,6 @@ extension StudentDetailModel: StudentDetailActionProtocol { self.isDownloading = isDownloading } - func updateIsPresentedDreamBookExporter(isPresented: Bool) { - self.isPresentedDreamBookExporter = isPresented - } - func updateHWPDocument(hwpDocument: HWPDocument) { self.hwpDocument = hwpDocument } diff --git a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift index dc5385d3..a3725c91 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift @@ -7,7 +7,6 @@ protocol StudentDetailStateProtocol { var studentDetailEntity: StudentDetailEntity? { get } var isLoading: Bool { get } var isDownloading: Bool { get } - var isPresentedDreamBookExporter: Bool { get } var hwpDocument: HWPDocument? { get } var hwpFilename: String { get } } @@ -17,6 +16,5 @@ protocol StudentDetailActionProtocol: AnyObject { func updateStudentDetailEntity(entity: StudentDetailEntity) func updateIsLoading(isLoading: Bool) func updateIsDownloading(isDownloading: Bool) - func updateIsPresentedDreamBookExporter(isPresented: Bool) func updateHWPDocument(hwpDocument: HWPDocument) } diff --git a/Projects/Feature/StudentDetailFeature/Sources/Scene/StudentDetailView.swift b/Projects/Feature/StudentDetailFeature/Sources/Scene/StudentDetailView.swift index 4ade0ae8..17833886 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Scene/StudentDetailView.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Scene/StudentDetailView.swift @@ -104,17 +104,6 @@ struct StudentDetailView: View { .frame(width: 24, height: 24) } .navigationBarHidden(true) - .fileExporter( - isPresented: Binding( - get: { state.isPresentedDreamBookExporter }, - set: { _ in intent.dreamBookFileExporterDismissed() } - ), - document: state.hwpDocument, - contentType: UTType(filenameExtension: "hwp") ?? .pdf, - defaultFilename: state.hwpFilename - ) { result in - print(result) - } } // swiftlint: disable function_body_length @@ -130,13 +119,6 @@ struct StudentDetailView: View { Spacer() - SMSIcon(.book) - .buttonWrapper { - guard - let dreamBookURLString = studentDetail?.detailInfoByTeacher?.dreamBookFileURL - else { return } - intent.dreamBookDownloadButtonDidTap(dreamBookFileURL: dreamBookURLString) - } } } else { SMSText(studentDetail?.major ?? "전공", font: .body1) From 612683d25116c68048c6df2cd73f57edd2efe6bc Mon Sep 17 00:00:00 2001 From: Sunghun Kim <81547954+kimsh153@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:46:04 +0900 Subject: [PATCH 2/2] =?UTF-8?q?:coffin:=20[#239]=20All=20/=20hwpDocument?= =?UTF-8?q?=20=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EC=A7=80=EC=9A=B0?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Model/HWPDocument.swift | 23 ------------------- .../Sources/Model/StudentDetailModel.swift | 10 -------- .../Model/StudentDetailModelProtocol.swift | 3 --- 3 files changed, 36 deletions(-) delete mode 100644 Projects/Feature/StudentDetailFeature/Sources/Model/HWPDocument.swift diff --git a/Projects/Feature/StudentDetailFeature/Sources/Model/HWPDocument.swift b/Projects/Feature/StudentDetailFeature/Sources/Model/HWPDocument.swift deleted file mode 100644 index 93111429..00000000 --- a/Projects/Feature/StudentDetailFeature/Sources/Model/HWPDocument.swift +++ /dev/null @@ -1,23 +0,0 @@ -import SwiftUI -import UniformTypeIdentifiers - -struct HWPDocument: FileDocument { - static var readableContentTypes: [UTType] = [ - UTType(filenameExtension: "hwp"), - UTType(filenameExtension: "hwpx") - ].compactMap { $0 } - - let hwpData: Data - - init(hwpData: Data) { - self.hwpData = hwpData - } - - init(configuration: ReadConfiguration) throws { - self.hwpData = configuration.file.regularFileContents ?? .init() - } - - func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper { - return FileWrapper(regularFileWithContents: hwpData) - } -} diff --git a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift index 88f00a5d..53683190 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModel.swift @@ -26,12 +26,6 @@ final class StudentDetailModel: ObservableObject, StudentDetailStateProtocol { @Published var _studentDetailEntity: StudentDetailEntity? @Published var isLoading: Bool = false @Published var isDownloading: Bool = false - @Published var hwpDocument: HWPDocument? - var hwpFilename: String { - guard let studentDetailEntity, let info = studentDetailEntity.detailInfoByTeacher else { return "" } - let number = info.number >= 10 ? "\(info.number)" : "0\(info.number)" - return "\(info.grade)\(info.class)\(number)\(studentDetailEntity.name)-드림북.hwp" - } } // swiftlint: enable identifier_name @@ -51,8 +45,4 @@ extension StudentDetailModel: StudentDetailActionProtocol { func updateIsDownloading(isDownloading: Bool) { self.isDownloading = isDownloading } - - func updateHWPDocument(hwpDocument: HWPDocument) { - self.hwpDocument = hwpDocument - } } diff --git a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift index a3725c91..ed14a12a 100644 --- a/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift +++ b/Projects/Feature/StudentDetailFeature/Sources/Model/StudentDetailModelProtocol.swift @@ -7,8 +7,6 @@ protocol StudentDetailStateProtocol { var studentDetailEntity: StudentDetailEntity? { get } var isLoading: Bool { get } var isDownloading: Bool { get } - var hwpDocument: HWPDocument? { get } - var hwpFilename: String { get } } protocol StudentDetailActionProtocol: AnyObject { @@ -16,5 +14,4 @@ protocol StudentDetailActionProtocol: AnyObject { func updateStudentDetailEntity(entity: StudentDetailEntity) func updateIsLoading(isLoading: Bool) func updateIsDownloading(isDownloading: Bool) - func updateHWPDocument(hwpDocument: HWPDocument) }