Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat [#354] 푸시알림 및 건의사항 반영 + 오류 수정 #359

Merged
merged 6 commits into from
Mar 4, 2024

Conversation

Heyjooo
Copy link
Contributor

@Heyjooo Heyjooo commented Mar 3, 2024

⛏ 작업 내용

  • 푸시알림 새로운 타입 추가
  • 다시보지않기 레이블에 탭 제스쳐 추가
  • 포인트 적립 뷰에서의 포인트 오류 해결

📌 PR Point!

  • SceneDelegate와 AppDelegate에 각각 새로운 푸시알림 type을 추가해주었습니다.

    } else if type == StringLiterals.PushAlarm.TypeName.firstRecommend {
    NotificationCenter.default.post(name: Notification.Name("showPage"), object: nil, userInfo: ["index":5]) // 추천인 열람권
    } else if type == StringLiterals.PushAlarm.TypeName.openVote {
    NotificationCenter.default.post(name: Notification.Name("showPage"), object: nil, userInfo: ["index":1]) // 내가 보낸 쪽지 열람
    }

    } else if type == StringLiterals.PushAlarm.TypeName.firstRecommend {
    selectedIndex = 3
    rootViewController.selectedIndex = selectedIndex
    self.window?.rootViewController = navigationController
    self.window?.makeKeyAndVisible()
    if NetworkCheck.shared.isConnected {
    self.checkAndUpdateIfNeeded()
    }
    } else if type == StringLiterals.PushAlarm.TypeName.openVote {
    selectedIndex = 1
    rootViewController.selectedIndex = selectedIndex
    self.window?.rootViewController = navigationController
    self.window?.makeKeyAndVisible()
    DispatchQueue.main.async {
    NotificationCenter.default.post(name: Notification.Name("changeMode"), object: nil, userInfo: nil)
    }

  • 타임라인으로 가는 푸시알림을 누를 시 내가 보낸 쪽지함으로 이동시키기 위하여 isUserSenderVote값을 true로 바꿔주었고 값이 바뀔 때마다 새로 뷰를 호출하도록 didSet을 추가했습니다.

    var isUserSenderVote = false {
    didSet {
    if isUserSenderVote {
    filterButtonLabel.text = StringLiterals.Around.myYello
    filterButtonStackView.spacing = 0
    filterButtonStackView.snp.updateConstraints {
    $0.leading.equalToSuperview().inset(8.adjustedWidth)
    }
    aroundEmptyView.emptyDescriptionLabel.setTextWithLineHeight(
    text: StringLiterals.Recommending.Empty.timeLineMyTitle,
    lineHeight: 24)
    } else {
    filterButtonLabel.text = StringLiterals.Around.allYello
    filterButtonStackView.spacing = 6.adjustedWidth
    filterButtonStackView.snp.updateConstraints {
    $0.leading.equalToSuperview().inset(20.adjustedWidth)
    }
    aroundEmptyView.emptyDescriptionLabel.setTextWithLineHeight(
    text: StringLiterals.Recommending.Empty.timeLineAllTitle,
    lineHeight: 24)
    }
    self.aroundPage = -1
    self.aroundCount = -1
    self.isFinishPaging = false
    self.fetchingMore = false
    self.aroundTableView.reloadData()
    self.aroundModelDummy = []
    self.around()
    self.updateView()
    }
    }

  • PointViewController로 넘어갈 때 포인트를 더하는 부분과 포인트를 해당 뷰컨에 적용시키는 부분이 동시에 실행되어 마지막 투표의 포인트를 더하는 코드 실행이 누락되어 발생한� 문제를 메인스레드에서 0.1초 뒤에 실행시킴으로써 해결했습니다.

    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1) {
    let viewController = VotingPointViewController()
    let myPlusPoint = UserDefaults.standard.integer(forKey: "UserPlusPoint")
    viewController.myPoint = self.myPoint + myPlusPoint
    viewController.votingPlusPoint = myPlusPoint
    let status = self.votingList[0].subscribe
    if status == "CANCELED" || status == "ACTIVE" {
    viewController.multiplyByTwoImageView.isHidden = false
    UserDefaults.standard.set(true, forKey: "isYelloPlus")
    viewController.adButtonStackView.isHidden = true
    viewController.originView.yellowButton.isHidden = false
    viewController.myPoint += myPlusPoint
    viewController.votingPlusPoint *= 2
    } else {
    viewController.multiplyByTwoImageView.isHidden = true
    UserDefaults.standard.set(false, forKey: "isYelloPlus")
    viewController.adButtonStackView.isHidden = false
    viewController.originView.yellowButton.isHidden = true
    }
    UserDefaults.standard.set(viewController.myPoint, forKey: "UserPoint")
    UserDefaults.standard.set(viewController.votingPlusPoint, forKey: "UserPlusPointNotPost")
    UIView.transition(with: self.navigationController?.view ?? UIView(), duration: 0.1, options: .transitionCrossDissolve, animations: {
    self.navigationController?.pushViewController(viewController, animated: false)
    })
    }

  • 다시보지 않기 label에도 tapGesture를 추가하였습니다.

    doNotSeeAgainLabel.do {
    $0.text = StringLiterals.Notification.doNotSeeAgainLabel
    $0.textColor = .white
    $0.font = .uiBody02
    $0.isUserInteractionEnabled = true
    let tapGesture = UITapGestureRecognizer(target: self, action: #selector(doNotSeeLabelTapped))
    $0.addGestureRecognizer(tapGesture)
    }

    @objc
    private func doNotSeeLabelTapped() {
    isTapped.toggle()
    doNotSeeAgainButton.setImage(UIImage(imageLiteralResourceName: isTapped ? "btnCheckBox" : "btnNotCheckBox"), for: .normal)
    UserDefaults.standard.set(isTapped, forKey: "isTapped")
    }

📸 스크린샷

구현 내용 스크린샷
화면종류 X

✅ Issue

Resolved #354

@Heyjooo Heyjooo added feat🪄 기능 구현 fix⚙️ 오류 고치는 것 희주🍀 labels Mar 3, 2024
@Heyjooo Heyjooo self-assigned this Mar 3, 2024
Copy link
Member

@Zoe0929 Zoe0929 left a comment

Choose a reason for hiding this comment

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

P4 고생하셨습니다 진짜 짱짱!!!!

@@ -190,6 +221,10 @@ final class AroundView: BaseView {
}
}

private func setAroundViewMode() {
Copy link
Member

Choose a reason for hiding this comment

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

P4 여기 이 빈 함수는 나중에 사용되는걸까요?! 아니라면 없애도 좋을 것 같아용!

Copy link
Collaborator

@chaentopia chaentopia left a comment

Choose a reason for hiding this comment

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

P4
고생하셨습니당!!

self.around()
self.updateView()
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

이거 어제 말했던 것처럼 didSet 안의 내용을 최소화 하기 위해서 따로 함수로 만들어서 불러주면 좋을 것 같아요!!

@Heyjooo Heyjooo merged commit 3da1e58 into develop Mar 4, 2024
@Heyjooo Heyjooo deleted the feat/#354 branch March 4, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat🪄 기능 구현 fix⚙️ 오류 고치는 것 희주🍀
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] 출시 이후 발견한 오류 해결 및 푸시알림 구현
3 participants