Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
96ed632
a
Alta302 Jun 1, 2021
1dee711
Create : Project
Alta302 Jun 1, 2021
46c3892
Update : Files
jangseoyoung Jun 2, 2021
37459a7
Update : VC
Alta302 Jun 3, 2021
2499427
Update : API
Alta302 Jun 5, 2021
9f157ef
Update : GRAMO
jangseoyoung Jun 6, 2021
6ce3b4e
Update : Networking Functions
jangseoyoung Jun 7, 2021
1509e20
Create : Auth
Alta302 Jun 12, 2021
d48f14c
Update : Calendar
Alta302 Jun 12, 2021
7a63afb
Update : API
Alta302 Jun 12, 2021
510eb00
Update : GRAMO
Alta302 Jun 12, 2021
3f4baa3
Update : Auth Profile
jangseoyoung Jun 13, 2021
5c0866e
Update : Storyboard reference
jangseoyoung Jun 13, 2021
688633b
Update : GRAMO
jangseoyoung Jun 13, 2021
db0e821
Update : GRAMO
Alta302 Jun 13, 2021
7186a87
Update : VC
jangseoyoung Jun 14, 2021
54e7eac
Update : Storyboard
jangseoyoung Jun 14, 2021
8f4309c
Update : GRAMO
jangseoyoung Jun 14, 2021
5e4e245
Update : GRAMO
Alta302 Jun 15, 2021
bc585c8
Update : VC
jangseoyoung Jun 17, 2021
02e2648
Update : Cell
jangseoyoung Jun 17, 2021
c108c04
Update : GRAMO
jangseoyoung Jun 17, 2021
fe473f0
Update : Model
jangseoyoung Jun 17, 2021
b4ff1b4
Update : storyboard
jangseoyoung Jun 17, 2021
96f2a6a
Update : ViewController Extension
jangseoyoung Jun 18, 2021
09b5882
Update : VC
jangseoyoung Jun 18, 2021
015960c
Update : StoryBoard
jangseoyoung Jun 18, 2021
9fa380c
Update : API
jangseoyoung Jun 18, 2021
4080cc3
Update : GRAMO
jangseoyoung Jun 18, 2021
fda06a0
Auto stash before merge of "develop" and "origin/develop"
Alta302 Jun 18, 2021
cd27866
Delete : Files
Alta302 Jun 20, 2021
db22e94
Update : Calendar
Alta302 Jun 20, 2021
bbef632
Update : Auth
Alta302 Jun 20, 2021
dad6b76
Update : homework
Alta302 Jun 20, 2021
436e986
Update : Info
Alta302 Jun 20, 2021
53c149a
Update : Sidemenu
Alta302 Jun 20, 2021
2f1ae3b
Update : GRAMO
Alta302 Jun 20, 2021
efd3d4c
Update : Extension
jangseoyoung Jun 21, 2021
d4d7aff
Update : VC
jangseoyoung Jun 21, 2021
dd5dcd4
Update : GRAMO
jangseoyoung Jun 21, 2021
893dfb6
Delete : Networking
jangseoyoung Jun 22, 2021
1df41df
Update : VC
jangseoyoung Jun 22, 2021
1537003
Update : GRAMO
jangseoyoung Jun 22, 2021
270d382
Update : GRAMO
Alta302 Jun 30, 2021
a3e0f39
Update : final & private
Alta302 Jul 1, 2021
ce94173
Update : Asset & Launch
Alta302 Jul 2, 2021
6f49769
Update : GRAMO
Alta302 Jul 2, 2021
95b30f0
Update : Launch Screen
Alta302 Jul 2, 2021
5caa161
Update : GRAMO
Alta302 Jul 2, 2021
c91082f
Update : VC
jangseoyoung Jul 2, 2021
7a4243c
Update : GRAMO
jangseoyoung Jul 2, 2021
001d804
Update : Storyboard
jangseoyoung Jul 2, 2021
04745de
Update : HTTPClient
jangseoyoung Jul 2, 2021
63e8422
Update : GRAMO
Alta302 Jul 9, 2021
c8bbd35
Update : Firebase
jangseoyoung Jul 9, 2021
54cd96f
Merge remote-tracking branch 'origin/develop' into develop
jangseoyoung Jul 9, 2021
b158d14
Update : UserInterfaceState
Alta302 Jul 9, 2021
9733b03
Merge remote-tracking branch 'origin/develop' into develop
Alta302 Jul 9, 2021
0965b70
Update : Auto Login
Alta302 Jul 13, 2021
dc407be
Auto stash before merge of "develop" and "origin/develop"
jangseoyoung Jul 14, 2021
ad09a8c
Update : Auto Login
Alta302 Jul 15, 2021
a8b8897
Merge remote-tracking branch 'origin/develop' into develop
Alta302 Jul 15, 2021
26c9e3a
Update : FCM
jangseoyoung Jul 28, 2021
d9c6714
Update : GRAMO
Alta302 Sep 2, 2021
d52cb6c
Update: 성과전시회
jangseoyoung Nov 22, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>GRAMO.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
filePath = "GRAMO/VC/info/InfoListViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "125"
endingLineNumber = "125"
startingLineNumber = "97"
endingLineNumber = "97"
landmarkName = "secondGetList()"
landmarkType = "7">
</BreakpointContent>
Expand Down
17 changes: 1 addition & 16 deletions GRAMO/GRAMO/VC/SideMenu/SideMenuNavigationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,13 @@
import UIKit
import SideMenu

class SideMenuNav: SideMenuNavigationController {
final class SideMenuNav: SideMenuNavigationController {

override func viewDidLoad() {
super.viewDidLoad()

self.presentationStyle = .menuSlideIn
self.leftSide = true
self.menuWidth = self.view.frame.width * 0.45
// Do any additional setup after loading the view.
}




/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}
28 changes: 10 additions & 18 deletions GRAMO/GRAMO/VC/SideMenu/SideMenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import UIKit

class SideMenuViewController: UIViewController {
final class SideMenuViewController: UIViewController {

@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var majorLabel: UILabel!
@IBOutlet weak private var nameLabel: UILabel!
@IBOutlet weak private var majorLabel: UILabel!

override func viewDidLoad() {
super.viewDidLoad()
Expand Down Expand Up @@ -39,48 +39,40 @@ class SideMenuViewController: UIViewController {
}

@IBAction func logOut(_ sender: UIButton){
let alert = UIAlertController(title: "로그아웃 하시겠습니까?", message: nil, preferredStyle: .alert)
let cancelAction = UIAlertAction(title: "아니오", style: .cancel, handler: nil)
let deleteAction = UIAlertAction(title: "예", style: .destructive){ (action) in
self.logout() }

alert.addAction(cancelAction)
alert.addAction(deleteAction)

self.present(alert, animated: true, completion: nil)
showDeleteAlert(title: "로그아웃 하시겠습니까?", action: { [self](action) in logout() }, message: nil)
}

@IBAction func withdrawal(_ sender: UIButton){
HTTPClient().delete(url: AuthAPI.withDrawel.path(), params: nil, header: Header.token.header()).responseJSON(completionHandler: { res in
switch res.response?.statusCode {
case 204 : print("OK")
case 204 :
let sub = UIStoryboard(name: "Auth", bundle: nil)
let calendar = sub.instantiateViewController(withIdentifier: "LoginVC")
self.navigationController?.pushViewController(calendar, animated: false)

case 401: print("401 - could not find token user")
self.showAlert(title: "허가되지 않은 요청입니다.")
self.showAlert(title: "허가되지 않은 요청입니다.",message: nil)

default:
print(res.response?.statusCode ?? "default")
self.showAlert(title: "오류가 발생했습니다.")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
}
})
}

func logout() {
HTTPClient().delete(url: AuthAPI.logout.path(), params: nil, header: Header.token.header()).responseJSON(completionHandler: { res in
switch res.response?.statusCode {
case 204 : print("OK")
case 204 :
let sub = UIStoryboard(name: "Auth", bundle: nil)
let calendar = sub.instantiateViewController(withIdentifier: "LoginVC")
self.navigationController?.pushViewController(calendar, animated: false)

case 401: print("401 - could not find token user")
self.showAlert(title: "허가되지 않은 요청입니다.")
self.showAlert(title: "허가되지 않은 요청입니다.", message: nil)
default:
print(res.response?.statusCode ?? "default")
self.showAlert(title: "오류가 발생했습니다.")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
}
})
}
Expand Down
13 changes: 11 additions & 2 deletions GRAMO/GRAMO/VC/UIextiention.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,20 @@ extension UIViewController {
bar.backgroundColor = UIColor.clear
}

func showAlert(title : String) {
let alert = UIAlertController(title: title, message: nil, preferredStyle: UIAlertController.Style.alert)
func showAlert(title : String, message: String?) {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
let cancelAction = UIAlertAction(title: "확인", style: .cancel, handler: nil)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)
}

func showDeleteAlert(title: String, action: ((UIAlertAction) -> Void)?, message: String?) {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
let cancelAction = UIAlertAction(title: "아니오", style: .cancel, handler: nil)
let deleteAction = UIAlertAction(title: "예", style: .destructive, handler: action)
alert.addAction(cancelAction)
alert.addAction(deleteAction)
self.present(alert, animated: true, completion: nil)
}

}
84 changes: 28 additions & 56 deletions GRAMO/GRAMO/VC/homework/HomeworkAddViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import UIKit
import DropDown
import Alamofire

class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFieldDelegate {
final class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFieldDelegate {

@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var selectMajorButton: UIButton!
@IBOutlet weak var deadLinetTextField: UITextField!
@IBOutlet weak var allocatorButton: UIButton!
@IBOutlet weak var titleTextField: UITextField!
@IBOutlet weak var detailTextView: UITextView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak private var dateLabel: UILabel!
@IBOutlet weak private var selectMajorButton: UIButton!
@IBOutlet weak private var deadLinetTextField: UITextField!
@IBOutlet weak private var allocatorButton: UIButton!
@IBOutlet weak private var titleTextField: UITextField!
@IBOutlet weak private var detailTextView: UITextView!
@IBOutlet weak private var nameLabel: UILabel!

let datePicker = UIDatePicker()

Expand Down Expand Up @@ -57,8 +57,6 @@ class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFie
setNavigationBar()

NotificationCenter.default.addObserver(self, selector: #selector(textDidChange(_ :)), name: UITextField.textDidChangeNotification, object: titleTextField)

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

@IBAction func cancelButton(_ sender: UIBarButtonItem){
Expand All @@ -67,10 +65,7 @@ class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFie

@IBAction func addButton(_ sender: UIBarButtonItem) {
if titleTextField.textColor == UIColor.lightGray || detailTextView.textColor == UIColor.lightGray {
let alert = UIAlertController(title: "제목 또는 내용을 입력해주세요.", message: nil, preferredStyle: UIAlertController.Style.alert)
let cancelAction = UIAlertAction(title: "확인", style: .cancel, handler: nil)
alert.addAction(cancelAction)
self.present(alert, animated: true, completion: nil)
showAlert(title: "제목 또는 내용을 입력해주세요.", message: nil)
}
addHomework(major: requestMajor, endDate: requestDate, studentEmail: studentEmail, description: detailTextView.text!, title: titleTextField.text!)
}
Expand All @@ -94,12 +89,10 @@ class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFie
case "서버" : requestMajor = "BACKEND"
case "디자인" : requestMajor = "DESIGN"
default:
print("TTI YONG")
print("error")
}
}

dropdown.anchorView = selectMajorButton

}

@IBAction func selectAllocator(_ sender: UIButton){
Expand Down Expand Up @@ -130,20 +123,34 @@ class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFie
allocatorButton.setTitle("\(item)", for: .normal)
self.studentEmail = model.userInfoResponses[index].email
}

dropDown.anchorView = allocatorButton

}
catch {
print(error)
}
case 401 : print("401 - Unauthorized")
self.showAlert(title: "허가되지 않은 요청입니다.",message: nil)
default : print(res.response?.statusCode ?? "default")
}
}


}

func addHomework(major: String, endDate: String, studentEmail: String, description: String, title: String) {
httpclient.post(url: HomeworkAPI.createHomework.path(), params: ["major":major, "endDate":endDate, "studentEmail":studentEmail, "description":description, "title":title], header: Header.token.header()).responseJSON{(res) in
switch res.response?.statusCode{
case 201 :
self.navigationController?.popViewController(animated: true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

response 받을 때 self를 사용하지 않지 않으면 오류가 나서 안고친것같은데 오류나는게 당연한거에용 근데 이렇게 하면 강한참조순환이 올 수 있기 때문에 저번 코드리뷰에서 알려줬던 [unowned self]를 이용해서 self에 접근할 수 있어요 self를 쓰게되면 가독성이 떨어지기도 쉽습니다 ㅜ


case 400 : print("400 - BAD REQUEST")
self.showAlert(title: "잘못된 요청입니다.", message: nil)
case 404 : print("404 - NOT FOUND createHw")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
default : print(res.response?.statusCode ?? "default")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
}
}
}

func placeholderSetting() {
detailTextView.delegate = self
detailTextView.text = "내용을 입력하세요"
Expand Down Expand Up @@ -202,29 +209,6 @@ class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFie
self.view.endEditing(true)
}


func addHomework(major: String, endDate: String, studentEmail: String, description: String, title: String) {
httpclient.post(url: HomeworkAPI.createHomework.path(), params: ["major":major, "endDate":endDate, "studentEmail":studentEmail, "description":description, "title":title], header: Header.token.header()).responseJSON{(res) in
switch res.response?.statusCode{
case 201 :
do{
print(res.response?.statusCode ?? "default")
self.navigationController?.popViewController(animated: true)
}
catch {
print("error: \(error)")
}
case 400 : print("400 - BAD REQUEST")
self.showAlert(title: "잘못된 요청입니다.")
case 404 : print("404 - NOT FOUND createHw")
self.showAlert(title: "오류가 발생했습니다.")
default : print(res.response?.statusCode ?? "default")
self.showAlert(title: "오류가 발생했습니다.")
}
}
}


func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
let currentText = textView.text ?? ""
guard let stringRange = Range(range, in: currentText) else { return false }
Expand All @@ -250,16 +234,4 @@ class HomeworkAddViewController: UIViewController, UITextViewDelegate, UITextFie
}
}
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}
59 changes: 23 additions & 36 deletions GRAMO/GRAMO/VC/homework/HomeworkAssignedViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

import UIKit

class HomeworkAssignedViewController: UIViewController {
final class HomeworkAssignedViewController: UIViewController {

@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var majorButton: UIButton!
@IBOutlet weak var selectDeadLineTextField: UITextField!
@IBOutlet weak var titleTextField: UITextField!
@IBOutlet weak var contentTextView: UITextView!
@IBOutlet weak var submitButton: UIButton!
@IBOutlet weak private var nameLabel: UILabel!
@IBOutlet weak private var dateLabel: UILabel!
@IBOutlet weak private var majorButton: UIButton!
@IBOutlet weak private var selectDeadLineTextField: UITextField!
@IBOutlet weak private var titleTextField: UITextField!
@IBOutlet weak private var contentTextView: UITextView!
@IBOutlet weak private var submitButton: UIButton!

var httpClient = HTTPClient()
var model : [HwContent] = [HwContent]()
Expand All @@ -25,7 +25,6 @@ class HomeworkAssignedViewController: UIViewController {
super.viewDidLoad()
setNavigationBar()
getContent(id: id)
// Do any additional setup after loading the view.
}

@IBAction func backButton1(_ sender: UIBarButtonItem){
Expand All @@ -42,32 +41,32 @@ class HomeworkAssignedViewController: UIViewController {
}

func getContent(id: Int) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

함수도 외부의 접근이 필요하지 않다면 private로 설정해주세요 :) 이외에도 다른 프로퍼티들도 마찬가지입니당!

httpClient.get(url: HomeworkAPI.getHomeworkContent(id).path(), params: nil, header: Header.token.header()).responseJSON {(res) in
httpClient.get(url: HomeworkAPI.getHomeworkContent(id).path(), params: nil, header: Header.token.header()).responseJSON { [self](res) in
switch res.response?.statusCode {
case 200 :
do{
let data = res.data
let model = try JSONDecoder().decode(HwContent.self, from: data!)

self.selectDeadLineTextField.text = self.formatEndDate(model.endDate)
self.dateLabel.text = self.formatStartDate(model.startDate)
self.nameLabel.text = model.teacherName
self.majorButton.setTitle(self.setMajor(model.major), for: .normal)
self.titleTextField.text = model.title
self.contentTextView.text = model.description
selectDeadLineTextField.text = formatEndDate(model.endDate)
dateLabel.text = formatStartDate(model.startDate)
nameLabel.text = model.teacherName
majorButton.setTitle(setMajor(model.major), for: .normal)
titleTextField.text = model.title
contentTextView.text = model.description
}
catch{
print("error: \(error)")
}

case 400 : print("400 - BAD REQUEST")
self.showAlert(title: "잘못된 요청입니다.")
self.showAlert(title: "잘못된 요청입니다.", message: nil)
case 401 : print("401 - Unauthorized")
self.showAlert(title: "허가되지 않았습니다.")
self.showAlert(title: "허가되지 않았습니다.", message: nil)
case 404 : print("404 - NOT FOUND")
self.showAlert(title: "오류가 발생했습니다.")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
default : print(res.response?.statusCode ?? "default")
self.showAlert(title: "오류가 발생했습니다.")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
}
}

Expand All @@ -79,26 +78,14 @@ class HomeworkAssignedViewController: UIViewController {
case 201 :
self.navigationController?.popViewController(animated: true)
case 400 : print("400 - BAD REQUEST")
self.showAlert(title: "잘못된 요청입니다.")
self.showAlert(title: "잘못된 요청입니다.", message: nil)
case 401 : print("401 - Unauthorized")
self.showAlert(title: "허가되지 않았습니다.")
self.showAlert(title: "허가되지 않았습니다.", message: nil)
case 404 : print("404 - NOT FOUND")
self.showAlert(title: "오류가 발생했습니다.")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
default : print(res.response?.statusCode ?? "default")
self.showAlert(title: "오류가 발생했습니다.")
self.showAlert(title: "오류가 발생했습니다.", message: nil)
}
}
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/

}
Loading