Skip to content

Commit

Permalink
feat: 반려동물 삭제 api 연동 -> 데이터 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
heejinnn committed Mar 14, 2024
1 parent 375a7c7 commit eca7593
Show file tree
Hide file tree
Showing 22 changed files with 96 additions and 38 deletions.
Binary file not shown.
54 changes: 27 additions & 27 deletions fit-a-pet-client/fit-a-pet-client/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,33 +114,33 @@ extension AppDelegate: MessagingDelegate {
// TODO: - 디바이스 토큰을 보내는 서버통신 구현
print("APNs fcm Token: \(String(describing: fcmToken!))")
// sendDeviceTokenWithAPI(fcmToken: fcmToken ?? "")

AuthorizationAlamofire.shared.registDeviceToken(String(describing: fcmToken!), device.systemVersion, modelName) {result in
switch result {
case .success(let data):
if let responseData = data,
let jsonObject = try? JSONSerialization.jsonObject(with: responseData, options: []) as? [String: Any] {
print("response jsonData: \(jsonObject)")

AuthorizationAlamofire.shared.pushNotificationAPI{result in
switch result {
case .success(let data):
if let responseData = data,
let jsonObject = try? JSONSerialization.jsonObject(with: responseData, options: []) as? [String: Any] {
print("response jsonData: \(jsonObject)")
}

case .failure(let error):
print("Error: \(error)")
}
}
}

case .failure(let error):
print("Error: \(error)")
}
}

//
// AuthorizationAlamofire.shared.registDeviceToken(String(describing: fcmToken!), device.systemVersion, modelName) {result in
// switch result {
// case .success(let data):
// if let responseData = data,
// let jsonObject = try? JSONSerialization.jsonObject(with: responseData, options: []) as? [String: Any] {
// print("response jsonData: \(jsonObject)")
//
// AuthorizationAlamofire.shared.pushNotificationAPI{result in
// switch result {
// case .success(let data):
// if let responseData = data,
// let jsonObject = try? JSONSerialization.jsonObject(with: responseData, options: []) as? [String: Any] {
// print("response jsonData: \(jsonObject)")
// }
//
// case .failure(let error):
// print("Error: \(error)")
// }
// }
// }
//
// case .failure(let error):
// print("Error: \(error)")
// }
// }
//


}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Close.png",
"filename" : "icon_add.svg",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "calendar_left.png",
"filename" : "icon_arrow_left.svg",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "calendar_right.png",
"filename" : "icon_arrow_right.svg",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "calendar_add.png",
"filename" : "icon_close.svg",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class CustomNavigationBar: UIViewController {
private func setupNavigationBar(title: String) {
// X button
closeButton = UIButton(type: .system)
closeButton.setImage(UIImage(named: "close_icon"), for: .normal)
closeButton.setImage(UIImage(named: "icon_close"), for: .normal)
closeButton.addTarget(self, action: #selector(closeButtonTapped), for: .touchUpInside)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: closeButton)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class CalendarStackView: UIStackView {
weak var delegate: CalendarStackViewDelegate?
let prevButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "calendar_left"), for: .normal)
button.setImage(UIImage(named: "icon_arrow_left"), for: .normal)
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
button.setTitleColor(.black, for: .normal)
return button
Expand All @@ -26,7 +26,7 @@ class CalendarStackView: UIStackView {

let nextButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(named: "calendar_right"), for: .normal)
button.setImage(UIImage(named: "icon_arrow_right"), for: .normal)
button.titleLabel?.font = UIFont.boldSystemFont(ofSize: 18)
button.setTitleColor(.black, for: .normal)
return button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CustomPanModalView: UIView {

private let closeButton: UIButton = {
let button = UIButton()
button.setImage(UIImage(named: "close_icon"), for: .normal)
button.setImage(UIImage(named: "icon_close"), for: .normal)
return button
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CalendarRegistrationVC: UIViewController, CalendarDateViewDelegate {

navigationItem.titleView = titleView

closeBtn.setImage(UIImage(named: "close_icon"), for: .normal)
closeBtn.setImage(UIImage(named: "icon_close"), for: .normal)
closeBtn.addTarget(self, action: #selector(closeBtnTapped), for: .touchUpInside)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: closeBtn)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class InviteMemberVC: UIViewController{

navigationItem.titleView = titleView

closeBtn.setImage(UIImage(named: "close_icon"), for: .normal)
closeBtn.setImage(UIImage(named: "icon_close"), for: .normal)
closeBtn.addTarget(self, action: #selector(closeBtnTapped), for: .touchUpInside)
navigationItem.rightBarButtonItem = UIBarButtonItem(customView: closeBtn)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class PetProfileEditVC: CustomNavigationBar{
birthTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(datePickerViewTapped))
basicUserInofoView.birthdayView.birthdayStackView.addGestureRecognizer(birthTapGestureRecognizer)
editButton.addTarget(self, action: #selector(editButtonTapped), for: .touchUpInside)
deleteButton.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside)
}

private func petTotalInfoCheckAPI() {
Expand Down Expand Up @@ -260,6 +261,21 @@ class PetProfileEditVC: CustomNavigationBar{
}
}

@objc func deleteButtonTapped(){
AuthorizationAlamofire.shared.petDelete(SelectedPetId.petId){ result in
switch result {
case .success(let data):
if let responseData = data,
let jsonObject = try? JSONSerialization.jsonObject(with: responseData, options: []) as? [String: Any] {
print("response jsonData: \(jsonObject)")
self.navigationController?.popToRootViewController(animated: true)
}

case .failure(let error):
print("Error: \(error)")
}
}
}
}
extension PetProfileEditVC: UITextFieldDelegate{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class CalendarVC: UIViewController {
let leftItem = UIBarButtonItem(customView: leftLabel)
navigationItem.leftBarButtonItem = leftItem

let addButton = UIBarButtonItem(image: UIImage(named: "calendar_add"), style: .plain, target: self, action: #selector(didTapAddButton))
let addButton = UIBarButtonItem(image: UIImage(named: "icon_add"), style: .plain, target: self, action: #selector(didTapAddButton))
addButton.tintColor = UIColor(named: "PrimaryColor")
navigationItem.rightBarButtonItem = addButton
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class PetVC: UIViewController{
switch result {
case .success(let data):
if let responseData = data {

PetDataManager.pets.removeAll()
PetDataManager.updatePets(with: responseData)

self.petListCollectionView.reloadData()
Expand Down

0 comments on commit eca7593

Please sign in to comment.