Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/TeamBeMe/BeMeiOS into fe…
Browse files Browse the repository at this point in the history
…ature/#107
  • Loading branch information
samsung-ga committed Jan 15, 2021
2 parents c211c3d + b578179 commit 71e53ba
Show file tree
Hide file tree
Showing 68 changed files with 1,632 additions and 335 deletions.
28 changes: 24 additions & 4 deletions BeMe/BeMe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
EC813F7B2599F88D00BBCE25 /* PastCardCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC813F7A2599F88D00BBCE25 /* PastCardCVC.swift */; };
EC813F7E2599F89A00BBCE25 /* NewCardCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC813F7D2599F89A00BBCE25 /* NewCardCVC.swift */; };
EC813F812599F8A800BBCE25 /* AddCardCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC813F802599F8A800BBCE25 /* AddCardCVC.swift */; };
EC85D4F125B02DAD00185E4A /* dailyblue.json in Resources */ = {isa = PBXBuildFile; fileRef = EC85D4F025B02DAD00185E4A /* dailyblue.json */; };
EC85D4F525B07B9A00185E4A /* FollowingNewAnswerData.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC85D4F425B07B9A00185E4A /* FollowingNewAnswerData.swift */; };
EC85D4F825B07CA300185E4A /* FollowingNewAnswerService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC85D4F725B07CA300185E4A /* FollowingNewAnswerService.swift */; };
EC85D4FF25B0BF4B00185E4A /* CustomToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC85D4FE25B0BF4B00185E4A /* CustomToastView.swift */; };
EC89E306259C1CA600DBAFE5 /* FollowSearch.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EC89E305259C1CA600DBAFE5 /* FollowSearch.storyboard */; };
EC89E309259C1CC700DBAFE5 /* FollowSearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC89E308259C1CC700DBAFE5 /* FollowSearchVC.swift */; };
EC89E30C259C273400DBAFE5 /* FollowingSearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC89E30B259C273400DBAFE5 /* FollowingSearchVC.swift */; };
Expand Down Expand Up @@ -385,6 +389,10 @@
EC813F7A2599F88D00BBCE25 /* PastCardCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PastCardCVC.swift; sourceTree = "<group>"; };
EC813F7D2599F89A00BBCE25 /* NewCardCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewCardCVC.swift; sourceTree = "<group>"; };
EC813F802599F8A800BBCE25 /* AddCardCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddCardCVC.swift; sourceTree = "<group>"; };
EC85D4F025B02DAD00185E4A /* dailyblue.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = dailyblue.json; sourceTree = "<group>"; };
EC85D4F425B07B9A00185E4A /* FollowingNewAnswerData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingNewAnswerData.swift; sourceTree = "<group>"; };
EC85D4F725B07CA300185E4A /* FollowingNewAnswerService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingNewAnswerService.swift; sourceTree = "<group>"; };
EC85D4FE25B0BF4B00185E4A /* CustomToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomToastView.swift; sourceTree = "<group>"; };
EC89E305259C1CA600DBAFE5 /* FollowSearch.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = FollowSearch.storyboard; sourceTree = "<group>"; };
EC89E308259C1CC700DBAFE5 /* FollowSearchVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowSearchVC.swift; sourceTree = "<group>"; };
EC89E30B259C273400DBAFE5 /* FollowingSearchVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowingSearchVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1034,6 +1042,7 @@
children = (
EC75A25325A8A71800F4E160 /* FollowingGetData.swift */,
ECC6310525A9987A009E4FD4 /* FollowingAnswersData.swift */,
EC85D4F425B07B9A00185E4A /* FollowingNewAnswerData.swift */,
);
path = Following;
sourceTree = "<group>";
Expand All @@ -1045,6 +1054,7 @@
ECC6310225A99404009E4FD4 /* FollowingFollowService.swift */,
ECC6310825A999DB009E4FD4 /* FollowingGetAnswersService.swift */,
ECB44D4C25AC886800F491F2 /* FollowerDeleteService.swift */,
EC85D4F725B07CA300185E4A /* FollowingNewAnswerService.swift */,
);
path = Following;
sourceTree = "<group>";
Expand All @@ -1059,6 +1069,7 @@
ECB44D5425AC9CD800F491F2 /* CustomLoadingView.swift */,
ECB44D6625ACCB4500F491F2 /* CustomEmtpyView.swift */,
D4C5872825AF77970089BD18 /* CustomMailView.swift */,
EC85D4FE25B0BF4B00185E4A /* CustomToastView.swift */,
);
path = CustomViews;
sourceTree = "<group>";
Expand Down Expand Up @@ -1414,6 +1425,7 @@
ECB44D5125AC968A00F491F2 /* loading.json */,
ECC6312B25A9E98E009E4FD4 /* data1.json */,
ECC6312825A9E8A0009E4FD4 /* animation_test.json */,
EC85D4F025B02DAD00185E4A /* dailyblue.json */,
ECB44D6025ACAF4A00F491F2 /* animation_love_final.json */,
ECB44D5F25ACAF4A00F491F2 /* animation_relation_final.json */,
);
Expand Down Expand Up @@ -1506,6 +1518,7 @@
ECC6311525A9E69A009E4FD4 /* HomeLottietest.storyboard in Resources */,
D44F6DC425A5784A002A9761 /* Answer.storyboard in Resources */,
D4C5873B25AF84170089BD18 /* Setting.storyboard in Resources */,
EC85D4F125B02DAD00185E4A /* dailyblue.json in Resources */,
EC7FEFA525A38AE200C61147 /* Search.storyboard in Resources */,
ECB44D6225ACAF4A00F491F2 /* animation_love_final.json in Resources */,
);
Expand Down Expand Up @@ -1707,10 +1720,12 @@
A53C28A025AE11E10054DA7E /* MyAnswer.swift in Sources */,
A57F708C25A1ACB100152E89 /* MypageResultTVC.swift in Sources */,
D4F1992925A4E804000AF0E7 /* SecretTVC.swift in Sources */,
EC85D4F825B07CA300185E4A /* FollowingNewAnswerService.swift in Sources */,
D4C5875F25B0165A0089BD18 /* ExploreWrite.swift in Sources */,
ECB44D6725ACCB4500F491F2 /* CustomEmtpyView.swift in Sources */,
D4E07CBA259F22C10075E616 /* MoreTVC.swift in Sources */,
EC75A24E25A88AC400F4E160 /* AnswerModifyService.swift in Sources */,
EC85D4FF25B0BF4B00185E4A /* CustomToastView.swift in Sources */,
D4475F0725AA1B6E00426591 /* ExploreDetailAnswerService.swift in Sources */,
D492E41A25A0A0DE0088A181 /* ExploreDetailVC.swift in Sources */,
EC7F0EA125A05460008EB88A /* CustomHomeActionSheetAlert.swift in Sources */,
Expand All @@ -1737,6 +1752,7 @@
EC813F262599A15100BBCE25 /* SceneDelegate.swift in Sources */,
EC89E30F259C274200DBAFE5 /* FollowerSearchVC.swift in Sources */,
EC7C1634259BAD0600A5BA4C /* FollowerPersonCVC.swift in Sources */,
EC85D4F525B07B9A00185E4A /* FollowingNewAnswerData.swift in Sources */,
D405E8C025ADD80E004CC60F /* AlarmService.swift in Sources */,
D44F6DFC25A5BDAD002A9761 /* QuestionAnswerTVC.swift in Sources */,
D44F6DC525A5784A002A9761 /* AnswerVC.swift in Sources */,
Expand Down Expand Up @@ -1888,16 +1904,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 6ZTQ76LJPZ;
INFOPLIST_FILE = BeMe/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe;
MARKETING_VERSION = 1.02;
PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe1;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
};
Expand All @@ -1908,16 +1926,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 6ZTQ76LJPZ;
INFOPLIST_FILE = BeMe/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe;
MARKETING_VERSION = 1.02;
PRODUCT_BUNDLE_IDENTIFIER = com.teamBeMe.BeMe1;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
};
Expand Down
6 changes: 3 additions & 3 deletions BeMe/BeMe/APIService/APIConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct APIConstants{
static let searchHistoryURL = baseURL+"/users/search/history"
static let searchDeleteURL = baseURL+"/users/search/"
static let followerDeleteURL = baseURL+"/follow/"

static let followingNewAnswerURL = baseURL+"/answers/question"

static let explorationCategoryURL = baseURL + "/exploration/category"
static let explorationDiffThoughtURL = baseURL + "/exploration/another"
Expand All @@ -43,8 +43,8 @@ struct APIConstants{
static let othersPageAnswerURL = baseURL + "/profiles/answers/"

static let myPageProfileURL = baseURL + "/profiles"
static let myPageAnswerURL = baseURL + "/profiles/answers?"
static let myPageScrapURL = baseURL + "/profiles/scraps?"
static let myPageAnswerURL = baseURL + "/profiles/answers"
static let myPageScrapURL = baseURL + "/profiles/scraps"
// static let settingMyPageProfileURL = baseURL + "/profiles"


Expand Down
90 changes: 90 additions & 0 deletions BeMe/BeMe/APIService/Following/FollowingNewAnswerService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
//
// LogInService.swift
// BeMe
//
// Created by Yunjae Kim on 2021/01/06.
//

import Foundation
import Alamofire

struct FollowingNewAnswerService{
static let shared = FollowingNewAnswerService()

func getNewData(questionID: Int, completion : @escaping (NetworkResult<Any>) -> (Void) ){
let url = APIConstants.followingNewAnswerURL

let header : HTTPHeaders = [
"Content-Type":"application/json",
"token":UserDefaults.standard.string(forKey: "token")!
]

let body : Parameters = [
"question_id": questionID
]

let dataRequest = AF.request(url,
method: .post,
parameters: body,
encoding: JSONEncoding.default,
headers: header)


dataRequest.responseData{ response in
switch response.result {
case .success:
guard let statusCode = response.response?.statusCode else{
return
}
guard let data = response.value else{
return

}

completion(judge(status: statusCode, data: data))





case .failure(let err):
print(err)
completion(.networkFail)
}

}



}

private func judge(status : Int, data : Data) -> NetworkResult<Any> {
let decoder = JSONDecoder()
guard let decodedData = try? decoder.decode(GenericResponse<FollowingNewAnswerData>.self, from : data) else{


return .pathErr

}

switch status{
case 200..<300:

print("성공성공")

return .success(decodedData.data)
case 400..<500 :
return .requestErr(decodedData.message)
case 500 :
return .serverErr

default :
return .networkFail


}


}

}
3 changes: 3 additions & 0 deletions BeMe/BeMe/APIService/Home/HomeChangePublicService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct HomeChangePublicService{
"public_flag": publicFlag,
]

print("HomeChangePublicService")
print(url)
print(body)
let dataRequest = AF.request(url,
method: .put,
parameters: body,
Expand Down
6 changes: 5 additions & 1 deletion BeMe/BeMe/APIService/LogIn/LogInService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import Alamofire
struct LogInService{
static let shared = LogInService()



func login(nickName: String, password: String, completion : @escaping (NetworkResult<Any>) -> (Void) ){
let url = APIConstants.loginURL

Expand Down Expand Up @@ -40,7 +42,8 @@ struct LogInService{
return

}

UserDefaults.standard.setValue(nickName, forKey: "nickName")
UserDefaults.standard.setValue(password, forKey: "password")
completion(judgeLogInData(status: statusCode, data: data))


Expand Down Expand Up @@ -70,6 +73,7 @@ struct LogInService{
switch status{
case 200..<300:
print(decodedData.data?.token)

UserDefaults.standard.setValue(decodedData.data?.token, forKey: "token")

return .success(decodedData.data)
Expand Down
25 changes: 15 additions & 10 deletions BeMe/BeMe/APIService/MyPage/MyPageAnswerService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ struct MyPageAnswerService {
func getMyAnswer(availability: String?, category: Int?, page: Int, query: String?, completion : @escaping (NetworkResult<Any>) -> (Void) ){

let category = category == nil ? "" : String(category!)
let availability = availability == nil ? "" : String(availability!)
let query = query == nil ? "" : String(query!)

let url = APIConstants.myPageAnswerURL+"public="+availability!+"&category="+category+"&page="+String(page)+"&query="+query!

let url = APIConstants.myPageAnswerURL

let params: Parameters = [
"public": "\(availability)",
"category": "\(category)",
"page": "\(page)",
"query": "\(query)"
]

print("getMyAnswer URll")
print(url)

let header : HTTPHeaders = [
"Content-Type":"application/json",
"token":UserDefaults.standard.string(forKey: "token")!
// "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjEwMDk5MjQwLCJleHAiOjE2MzYwMTkyNDAsImlzcyI6ImJlbWUifQ.JeYfzJsg-kdatqhIOqfJ4oXUvUdsiLUaGHwLl1mJRvQ"
]


let dataRequest = AF.request(url,
method: .get,
encoding: JSONEncoding.default,
headers: header)
let dataRequest = AF.request(url, method: .get, parameters: params, headers: header)


dataRequest.responseData{ response in
Expand Down Expand Up @@ -61,12 +69,9 @@ struct MyPageAnswerService {
print("디코딩 실패")
return .pathErr
}

switch status{
case 200..<300:
print("통신 성공")
// print(decodedData.message)
// print(decodedData.data?.answers[0].isScrapped)
return .success(decodedData.data)
case 400..<500 :
return .requestErr(decodedData.message)
Expand Down
5 changes: 3 additions & 2 deletions BeMe/BeMe/APIService/MyPage/MyPageProfileService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ struct MyPageProfileService {
let header : HTTPHeaders = [
// "Content-Type":"application/json",
"Content-Type":"multipart/form-data",
// "token":UserDefaults.standard.string(forKey: "token")!
"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNjA5Nzc3ODg2LCJleHAiOjE2MzU2OTc4ODYsImlzcyI6ImJlbWUifQ.34mc263uDc9vYq9N8BVzfqVdsgKzL51Ld03kB0afcSQ"
"token":UserDefaults.standard.string(forKey: "token")!
// "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiaWF0IjoxNjA5Nzc3ODg2LCJleHAiOjE2MzU2OTc4ODYsImlzcyI6ImJlbWUifQ.34mc263uDc9vYq9N8BVzfqVdsgKzL51Ld03kB0afcSQ"
]
AF.upload(multipartFormData: { multiPartFormData in
let imageData = image.jpegData(compressionQuality: 1.0)!
Expand Down Expand Up @@ -100,6 +100,7 @@ struct MyPageProfileService {
case 200..<300:
// print(decodedData.message)
// print(decodedData.data)
print("profile editing")
return .success(decodedData.data)
case 400..<500 :
return .requestErr(decodedData.message)
Expand Down
28 changes: 16 additions & 12 deletions BeMe/BeMe/APIService/MyPage/MyPageScrapService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,30 @@ struct MyPageScrapService {

// getMyAnswer - overLoading Method : 쿼리 개수에 따라서 매개변수 개수가 바뀜
func getMyScrap(availability: String?, category: Int?, query: String?, page: Int, completion : @escaping (NetworkResult<Any>) -> (Void)){

let category = category == nil ? "" : String(category!)
let availability = availability == nil ? "" : String(availability!)
let query = query == nil ? "" : String(query!)


let url = APIConstants.myPageScrapURL

let params: Parameters = [
"public": "\(availability)",
"category": "\(category)",
"page": "\(page)",
"query": "\(query)"
]

let url = APIConstants.myPageScrapURL+"public="+availability!+"&category="+category+"&page="+String(page)+"&query="+query!
print("getMyScrap nURll")
print("getMyScrap URll")
print(url)

let header : HTTPHeaders = [
"Content-Type":"application/json",
"token":UserDefaults.standard.string(forKey: "token")!
// "token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjEwMDk5MjQwLCJleHAiOjE2MzYwMTkyNDAsImlzcyI6ImJlbWUifQ.JeYfzJsg-kdatqhIOqfJ4oXUvUdsiLUaGHwLl1mJRvQ"
]


let dataRequest = AF.request(url,
method: .get,
encoding: JSONEncoding.default,
headers: header)
let dataRequest = AF.request(url, method: .get, parameters: params, headers: header)


dataRequest.responseData{ response in
Expand Down Expand Up @@ -67,8 +73,6 @@ struct MyPageScrapService {
switch status{
case 200..<300:
print("통신 성공")
// print(decodedData.message)
// print(decodedData.data?.answers[0].isScrapped)
return .success(decodedData.data)
case 400..<500 :
return .requestErr(decodedData.message)
Expand Down
Loading

0 comments on commit 71e53ba

Please sign in to comment.