-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#115
- Loading branch information
Showing
82 changed files
with
2,136 additions
and
128 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
Mongle/Mongle/Resource/APIService/SignUpDuplicateService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// SignUpDuplicateService.swift | ||
// Mongle | ||
// | ||
// Created by Yunjae Kim on 2020/11/12. | ||
// Copyright © 2020 이주혁. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Alamofire | ||
|
||
|
||
struct SignUpDuplicateService { | ||
static let shared = SignUpDuplicateService() | ||
|
||
private func makeParameter(_ email : String,_ name : String)-> Parameters{ | ||
return ["email" : email, "name" : name] | ||
} | ||
|
||
func checkDuplicate(email : String, name : String, completion : @escaping (NetworkResult<Any>) -> Void){ | ||
let header : HTTPHeaders = ["Content-Type" : "application/json"] | ||
|
||
let dataRequest = Alamofire.request(APIConstants.signupDuplicateURL, | ||
method: .post, | ||
parameters: makeParameter(email,name), | ||
encoding: JSONEncoding.default, | ||
headers: header) | ||
|
||
|
||
dataRequest.responseData { dataResponse in | ||
switch dataResponse.result { | ||
case .success : | ||
print("succccceeesss") | ||
guard let statusCode = dataResponse.response?.statusCode else {return} | ||
guard let data = dataResponse.value else {return} | ||
let networkResult = self.judge(by: statusCode, data) | ||
completion(networkResult) | ||
|
||
case .failure : | ||
|
||
completion(.networkFail) | ||
|
||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} | ||
|
||
private func judge(by statusCode : Int , _ data : Data) -> NetworkResult<Any> { | ||
switch statusCode{ | ||
case 200 : | ||
return succeed(by: data) | ||
case 400 : | ||
print("400__") | ||
return .pathErr | ||
case 600 : | ||
print("600__") | ||
return .serverErr | ||
default : | ||
print("other__") | ||
return .networkFail | ||
|
||
} | ||
|
||
} | ||
|
||
private func succeed(by data : Data) -> NetworkResult<Any> { | ||
let decoder = JSONDecoder() | ||
guard let decodedData = try? decoder.decode(GenericResponse<DataClass>.self, from: data) else { return .serverErr } | ||
guard let tokenData = decodedData.data else { return .requestErr(decodedData.message) } | ||
return .success(tokenData.duplicate) | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
70 changes: 70 additions & 0 deletions
70
Mongle/Mongle/Resource/APIService/SignUpEmailService.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// SignUpEmail.swift | ||
// Mongle | ||
// | ||
// Created by Yunjae Kim on 2020/11/11. | ||
// Copyright © 2020 이주혁. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Alamofire | ||
|
||
struct SignUpEmailService{ | ||
static let shared = SignUpEmailService() | ||
private func makeParameter(_ email : String)-> Parameters{ | ||
return ["email" : email] | ||
} | ||
|
||
func signup(email : String , completion : @escaping (NetworkResult<Any>) -> Void){ | ||
let header : HTTPHeaders = ["Content-Type" : "application/json"] | ||
|
||
let dataRequest = Alamofire.request(APIConstants.signupEmailURL, | ||
method: .post, | ||
parameters: makeParameter(email), | ||
encoding: JSONEncoding.default, | ||
headers: header) | ||
|
||
|
||
dataRequest.responseData { dataResponse in | ||
switch dataResponse.result { | ||
case .success : | ||
guard let statusCode = dataResponse.response?.statusCode else {return} | ||
guard let data = dataResponse.value else {return} | ||
let networkResult = self.judge(by: statusCode, data) | ||
completion(networkResult) | ||
|
||
case .failure : | ||
completion(.networkFail) | ||
|
||
|
||
} | ||
} | ||
} | ||
|
||
private func judge(by statusCode : Int , _ data : Data) -> NetworkResult<Any> { | ||
switch statusCode{ | ||
case 200 : | ||
return isSignUp(by: data) | ||
case 400 : | ||
return .pathErr | ||
case 600 : | ||
return .serverErr | ||
default : | ||
return .networkFail | ||
|
||
} | ||
|
||
} | ||
|
||
private func isSignUp(by data : Data) -> NetworkResult<Any> { | ||
let decoder = JSONDecoder() | ||
guard let decodedData = try? decoder.decode(GenericResponse<SignUpEmailData>.self, from: data) else { return .serverErr } | ||
guard let tokenData = decodedData.data else { return .requestErr(decodedData.message) } | ||
return .success(tokenData.authNum) | ||
|
||
|
||
|
||
} | ||
|
||
|
||
} |
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding1Bg.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "onboarding1Bg.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x", | ||
"filename" : "[email protected]" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+6.72 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding1Bg.imageset/onboarding1Bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding1Bg.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+39.6 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding1Bg.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding1ImgBook.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "onboarding1ImgBook.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"scale" : "2x", | ||
"filename" : "[email protected]", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"scale" : "3x", | ||
"idiom" : "universal", | ||
"filename" : "[email protected]" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+11.6 KB
...gle/Resource/Assets.xcassets/onboarding1ImgBook.imageset/onboarding1ImgBook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+26.7 KB
.../Resource/Assets.xcassets/onboarding1ImgBook.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.8 KB
.../Resource/Assets.xcassets/onboarding1ImgBook.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding1ImgMongle.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "onboarding1ImgMongle.png", | ||
"scale" : "1x", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"scale" : "2x", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"scale" : "3x", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+12.3 KB
...Resource/Assets.xcassets/onboarding1ImgMongle.imageset/onboarding1ImgMongle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+30.8 KB
...ource/Assets.xcassets/onboarding1ImgMongle.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+47.5 KB
...ource/Assets.xcassets/onboarding1ImgMongle.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding1Text.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"scale" : "1x", | ||
"idiom" : "universal", | ||
"filename" : "onboarding1Text.png" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x", | ||
"filename" : "[email protected]" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+8.09 KB
...le/Mongle/Resource/Assets.xcassets/onboarding1Text.imageset/onboarding1Text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.2 KB
...Mongle/Resource/Assets.xcassets/onboarding1Text.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.3 KB
...Mongle/Resource/Assets.xcassets/onboarding1Text.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding2Bg.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"scale" : "1x", | ||
"filename" : "onboarding2Bg.png", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"scale" : "2x", | ||
"idiom" : "universal", | ||
"filename" : "[email protected]" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"scale" : "3x", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+8.73 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding2Bg.imageset/onboarding2Bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding2Bg.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.2 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding2Bg.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding2ImgList.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "onboarding2ImgList.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+12.7 KB
...gle/Resource/Assets.xcassets/onboarding2ImgList.imageset/onboarding2ImgList.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.7 KB
.../Resource/Assets.xcassets/onboarding2ImgList.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+43.2 KB
.../Resource/Assets.xcassets/onboarding2ImgList.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding2ImgMongle.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x", | ||
"filename" : "onboarding2ImgMongle.png" | ||
}, | ||
{ | ||
"scale" : "2x", | ||
"filename" : "[email protected]", | ||
"idiom" : "universal" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+9.31 KB
...Resource/Assets.xcassets/onboarding2ImgMongle.imageset/onboarding2ImgMongle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+22.9 KB
...ource/Assets.xcassets/onboarding2ImgMongle.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.3 KB
...ource/Assets.xcassets/onboarding2ImgMongle.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding2Text.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"scale" : "1x", | ||
"idiom" : "universal", | ||
"filename" : "onboarding2Text.png" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"scale" : "3x", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+5.99 KB
...le/Mongle/Resource/Assets.xcassets/onboarding2Text.imageset/onboarding2Text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.2 KB
...Mongle/Resource/Assets.xcassets/onboarding2Text.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.2 KB
...Mongle/Resource/Assets.xcassets/onboarding2Text.imageset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
Mongle/Mongle/Resource/Assets.xcassets/onboarding3Bg.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"scale" : "1x", | ||
"idiom" : "universal", | ||
"filename" : "onboarding3Bg.png" | ||
}, | ||
{ | ||
"scale" : "2x", | ||
"idiom" : "universal", | ||
"filename" : "[email protected]" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "[email protected]", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+8.68 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding3Bg.imageset/onboarding3Bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.9 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding3Bg.imageset/[email protected]
Oops, something went wrong.
Binary file added
BIN
+57.1 KB
Mongle/Mongle/Resource/Assets.xcassets/onboarding3Bg.imageset/[email protected]
Oops, something went wrong.
Oops, something went wrong.