Skip to content

Commit

Permalink
[Feat] - #37 중간 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
ILWAT committed Feb 9, 2023
1 parent 618919e commit f10d6f9
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Damso.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
0214CCE129926D6400EC5CAE /* secondInfoTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0214CCD429926D6400EC5CAE /* secondInfoTableViewCell.swift */; };
7C7EA1298971C6508DBBC2CE /* Pods_Damso.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC41CC4BF6B184B7B5B646D5 /* Pods_Damso.framework */; };
DE0139ED29953DD500EC9A5A /* Keys.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0139EC29953DD400EC9A5A /* Keys.swift */; };
DE0139EF2995604A00EC9A5A /* ReportInputModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0139EE2995604A00EC9A5A /* ReportInputModel.swift */; };
DE0139F12995671C00EC9A5A /* ReportInputManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0139F02995671C00EC9A5A /* ReportInputManager.swift */; };
DE0139F329957B8D00EC9A5A /* ReportInputResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE0139F229957B8D00EC9A5A /* ReportInputResult.swift */; };
DE123C2A296C39AC00B7149B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE123C29296C39AC00B7149B /* AppDelegate.swift */; };
DE123C2C296C39AC00B7149B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE123C2B296C39AC00B7149B /* SceneDelegate.swift */; };
DE123C33296C39AE00B7149B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DE123C32296C39AE00B7149B /* Assets.xcassets */; };
Expand Down Expand Up @@ -90,6 +93,9 @@
5255AD62BEE5A9637A7D0115 /* Pods-Damso.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Damso.release.xcconfig"; path = "Target Support Files/Pods-Damso/Pods-Damso.release.xcconfig"; sourceTree = "<group>"; };
DB7F394FDC0E35B9274B56E2 /* Pods-Damso.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Damso.debug.xcconfig"; path = "Target Support Files/Pods-Damso/Pods-Damso.debug.xcconfig"; sourceTree = "<group>"; };
DE0139EC29953DD400EC9A5A /* Keys.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Keys.swift; path = "../../../../../../../PersonalFolder/Study/UMC/3기/앱런칭 프로젝트/iOS/Keys.swift"; sourceTree = "<group>"; };
DE0139EE2995604A00EC9A5A /* ReportInputModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportInputModel.swift; sourceTree = "<group>"; };
DE0139F02995671C00EC9A5A /* ReportInputManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportInputManager.swift; sourceTree = "<group>"; };
DE0139F229957B8D00EC9A5A /* ReportInputResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReportInputResult.swift; sourceTree = "<group>"; };
DE123C26296C39AC00B7149B /* Damso.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Damso.app; sourceTree = BUILT_PRODUCTS_DIR; };
DE123C29296C39AC00B7149B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
DE123C2B296C39AC00B7149B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -289,6 +295,9 @@
DE0139EC29953DD400EC9A5A /* Keys.swift */,
DE5F0BA62990513F00660E52 /* GeocodingManager.swift */,
DE5F0BA82990579D00660E52 /* ReverseGCModel.swift */,
DE0139EE2995604A00EC9A5A /* ReportInputModel.swift */,
DE0139F02995671C00EC9A5A /* ReportInputManager.swift */,
DE0139F229957B8D00EC9A5A /* ReportInputResult.swift */,
);
path = Network;
sourceTree = "<group>";
Expand Down Expand Up @@ -526,8 +535,10 @@
DE0139ED29953DD500EC9A5A /* Keys.swift in Sources */,
DE5F0BA72990513F00660E52 /* GeocodingManager.swift in Sources */,
DEA95B1D297751D400AE8D0C /* OnboardingMessage.swift in Sources */,
DE0139F329957B8D00EC9A5A /* ReportInputResult.swift in Sources */,
DE123C51296D746300B7149B /* BaseView.swift in Sources */,
0214CCDB29926D6400EC5CAE /* LoginView.swift in Sources */,
DE0139EF2995604A00EC9A5A /* ReportInputModel.swift in Sources */,
0214CCD829926D6400EC5CAE /* LoginDataView.swift in Sources */,
0214CCD929926D6400EC5CAE /* MydataView.swift in Sources */,
DE123C2C296C39AC00B7149B /* SceneDelegate.swift in Sources */,
Expand All @@ -545,6 +556,7 @@
0214CCE129926D6400EC5CAE /* secondInfoTableViewCell.swift in Sources */,
0214CCD629926D6400EC5CAE /* PopupVC.swift in Sources */,
EC46E73D29892CCE00F767C4 /* SearchViewController.swift in Sources */,
DE0139F12995671C00EC9A5A /* ReportInputManager.swift in Sources */,
DEA95B4129884B9600AE8D0C /* BookmarkTableViewCell.swift in Sources */,
DEA95B122976A75B00AE8D0C /* ReportVC.swift in Sources */,
DE123C4F296D743C00B7149B /* BaseVC.swift in Sources */,
Expand Down
55 changes: 55 additions & 0 deletions Damso/Data/Network/ReportInputManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// ReportInputManager.swift
// Damso
//
// Created by 문정호 on 2023/02/10.
//

import Foundation
import Alamofire


class ReportInputManager{
static let reportInputManager = ReportInputManager()

private init() {}

//MARK: - callAPI
func uploadNewArea(model: ReportInputModel, completion: @escaping (Bool)->Void){
let url = "3.37.122.59:3000/main/facility/register" //url

let header: HTTPHeaders = [
"Content-Type" : "multipart/form-data" //멀티파트 폼 데이터 형식으로 넘길 것이라는 것을 명시
]
AF.upload(multipartFormData: {(MultipartFormData) in
MultipartFormData.append(Data(model.location.utf8), withName: "location")
MultipartFormData.append(Data(model.title.utf8), withName: "title")
MultipartFormData.append(Data(String(model.type).utf8), withName: "type")
MultipartFormData.append(Data(model.installAgency.utf8), withName: "installAgency")

if let imgArray = model.img {
for array in imgArray {
MultipartFormData.append(array,
withName: "img",
fileName: "Area_img",
mimeType:"image/jpeg")
}
}
}, to: url,
headers: header)
.validate()
.responseDecodable(of: ReportInputResult.self) { response in

switch response.result {
case .success(let result):
if result.isSuccess{
print("업로드 성공")
} else {
print(result.message)
}
case .failure(let error):
print(error.localizedDescription)
}
}
}
}
26 changes: 26 additions & 0 deletions Damso/Data/Network/ReportInputModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ReportInputModel.swift
// Damso
//
// Created by 문정호 on 2023/02/10.
//

import Foundation

struct ReportInputModel: Codable{
var location: String
var title: String
var type: Int
var installAgency: String
var img: [Data]?

init(location: String, title: String, type: Int, installAgency: String, img: [Data]? = nil) {
self.location = location
self.title = title
self.type = type
self.installAgency = installAgency
self.img = img
}
}


14 changes: 14 additions & 0 deletions Damso/Data/Network/ReportInputResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ReportInputResult.swift
// Damso
//
// Created by 문정호 on 2023/02/10.
//

import Foundation

struct ReportInputResult: Codable{
var isSuccess: Bool
var code: Int
var message: Bool
}
8 changes: 4 additions & 4 deletions Damso/Presentation/Input/Inputinformation/ReportInputVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ class ReportInputVC: BaseVC {
$0.sourceType = .photoLibrary //image를 앨범에서 선택하는 코드
}


override func loadView(){
view = reportinputView
}

override func viewDidLoad() {
super.viewDidLoad()

// Do any additional setup after loading the view.
}

Expand Down Expand Up @@ -68,13 +69,12 @@ class ReportInputVC: BaseVC {
}

@objc func tappedReportButton(_ sender: UIButton){
print("제보하기")
lazy var data: ReportInputModel = ReportInputModel(location: reportinputView.locationLabel?.text, title: reportinputView.locationTitle?.text, type: 2, installAgency: reportinputView.supervisorTextField?.text)
}

@objc func tappedUploadButton(_ sender: UIButton){
self.present(imgPicker, animated: true, completion: nil) //imagepickerview 화면을 띄우는 코드
}

}

extension ReportInputVC: UITextFieldDelegate,UIImagePickerControllerDelegate, UINavigationControllerDelegate
Expand Down

0 comments on commit f10d6f9

Please sign in to comment.