Skip to content

Commit

Permalink
Merge branch 'release1.0/3' into release/TeamNADA#246
Browse files Browse the repository at this point in the history
  • Loading branch information
mini-min committed Dec 28, 2021
2 parents 60911e4 + ce41b46 commit 01aa228
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions NADA-iOS-forRelease/Resouces/Constants/Notification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ extension Notification.Name {
static let presentCardShare = Notification.Name("presentCardShare")
static let passDataToGroup = Notification.Name("passDataToGroup")
static let passDataToDetail = Notification.Name("passDataToDetail")
static let reloadMainCardSwiper = Notification.Name("reloadMainCardSwiper")
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ extension CardService: TargetType {
let instagramIDData = request.frontCard.instagramID.data(using: .utf8) ?? Data()
multiPartData.append(MultipartFormData(provider: .data(instagramIDData), name: "card.instagram"))
let linkURLData = request.frontCard.linkURL.data(using: .utf8) ?? Data()
multiPartData.append(MultipartFormData(provider: .data(linkURLData), name: "card.linkName"))
multiPartData.append(MultipartFormData(provider: .data(linkURLData), name: "card.link"))
let descriptionData = request.frontCard.description.data(using: .utf8) ?? Data()
multiPartData.append(MultipartFormData(provider: .data(descriptionData), name: "card.description"))
let isMinchoData = Bool(request.backCard.isMincho).description.data(using: .utf8) ?? Data()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ extension CardCreationPreviewViewController {

guard let presentingVC = self.presentingViewController else { return }

NotificationCenter.default.post(name: .reloadMainCardSwiper, object: nil)

self.dismiss(animated: true) {
if UserDefaults.standard.object(forKey: Const.UserDefaultsKey.isFirstCard) == nil {
let nextVC = FirstCardAlertBottomSheetViewController()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class CardListViewController: UIViewController {

// MARK: - IBAction Properties
@IBAction func dismissToPreviousView(_ sender: UIButton) {
NotificationCenter.default.post(name: .reloadMainCardSwiper, object: nil)
self.navigationController?.popViewController(animated: true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ class FrontViewController: UIViewController {
setUserID()
setDelegate()
setNotification()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

cardDataList?.removeAll()
offset = 0
cardListFetchWithAPI(userID: userID, isList: false, offset: offset)
}

Expand Down Expand Up @@ -72,6 +65,7 @@ extension FrontViewController {

private func setNotification() {
NotificationCenter.default.addObserver(self, selector: #selector(didRecievePresentCardShare(_:)), name: .presentCardShare, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(setReloadMainCardSwiper), name: .reloadMainCardSwiper, object: nil)
}

private func setUserID() {
Expand All @@ -93,6 +87,14 @@ extension FrontViewController {
nextVC.modalPresentationStyle = .overFullScreen
self.present(nextVC, animated: false, completion: nil)
}

@objc
private func setReloadMainCardSwiper() {
cardDataList?.removeAll()
offset = 0
_ = cardSwiper.scrollToCard(at: 0, animated: false)
cardListFetchWithAPI(userID: userID, isList: false, offset: offset)
}
}

// MARK: - VerticalCardSwiperDelegate
Expand Down

0 comments on commit 01aa228

Please sign in to comment.