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 [#51] 스크린 타임 모니터링 앱 삭제 UI 로직 #52

Merged
merged 7 commits into from
Jan 12, 2024

Conversation

Zoe0929
Copy link
Member

@Zoe0929 Zoe0929 commented Jan 10, 2024

👾 작업 내용

  • 나의 챌린지 뷰에서 삭제 버튼을 눌러서 스크린 타임을 모니터링하던 앱을 삭제하는 UI 로직입니다.

🚀 PR Point

  • header를 정의하면서 addTarge을 해주어야해서 이 경우에만 예외적으로 addTarget 함수를 따로 만들지 않았습니다.

    } else if kind == StringLiteral.Challenge.Idetifier.appListHeaderViewId {
    if let header = collectionView.dequeueReusableSupplementaryView(ofKind: StringLiteral.Challenge.Idetifier.appListHeaderViewId, withReuseIdentifier: AppCollectionReusableView.identifier, for: indexPath) as? AppCollectionReusableView {
    header.deleteButton.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside)
    header.isDeleteMode = isDeleteMode
    return header
    }
    else { return UICollectionReusableView() }
    } else if kind == StringLiteral.Challenge.Idetifier.appAddFooterViewID {

  • Property Observer인 didSet을 이용해서 값이 변화하는지 감지 후 collectionViewreload해주었습니다.

    var isDeleteMode: Bool = false {
    didSet {
    challengeCollectionView.reloadData()
    }
    }

  • UICollectionViewDelegate를 사용해서 앱 목록 중 하나를 터치했을 때, 선택 되도록 구현했습니다.

    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    if selectedIndex == [] {
    selectedIndex = [1,0]
    }
    if challengeView.isDeleteMode {
    if let previousSelectedCell = collectionView.cellForItem(at: selectedIndex) as? AppListCollectionViewCell {
    previousSelectedCell.isSelectedCell = false
    }
    if let currentSelectedCell = collectionView.cellForItem(at: indexPath) as? AppListCollectionViewCell {
    currentSelectedCell.isSelectedCell = true
    self.selectedIndex = indexPath
    }
    }
    }

📸 스크린샷

구현 내용 스크린샷
삭제 로직 Simulator Screen Recording - iPhone 13 mini - 2024-01-11 at 06 53 45

🚀 기기 대응

기기명 Iphone 13 mini Iphone 14 Iphone 15 pro Iphone SE(3rd)
스크린샷 Simulator Screenshot - iPhone 13 mini - 2024-01-11 at 06 55 01 image image image

✅ Issue

Resolved #51

@Zoe0929 Zoe0929 added 🐰지희 지희의 issue 🌈 feat 기능 구현 labels Jan 10, 2024
@Zoe0929 Zoe0929 added this to the 🚀1차 스프린트🚀 milestone Jan 10, 2024
@Zoe0929 Zoe0929 self-assigned this Jan 10, 2024
@Zoe0929 Zoe0929 linked an issue Jan 10, 2024 that may be closed by this pull request
Copy link
Member

@kim-seonwoo kim-seonwoo left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 84 to 87
@objc private func deleteButtonTapped() {
isDeleteMode.toggle()
challengeCollectionView.reloadData()
}
Copy link
Member

Choose a reason for hiding this comment

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

p5. deleteMode의 변화가 감지되면 리로드가 되어있게하는데
위의 isDelegateMode didset기능과 중복되지 않나요?

Copy link
Contributor

Choose a reason for hiding this comment

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

그러게욜 두번하는 이유가 잇나,,

Copy link
Member Author

Choose a reason for hiding this comment

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

오, 삭제해도 괜찮을 것 같네요! 삭제하겠습니다

Copy link
Contributor

@boyeon0119 boyeon0119 left a comment

Choose a reason for hiding this comment

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

아주 야무집니다~!!!

return true
}

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
Copy link
Contributor

Choose a reason for hiding this comment

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

이거 마이페이지에서 여정지도랑 상점 셀 눌릴 때 쓰면 되겟군요!!!

Copy link
Member Author

Choose a reason for hiding this comment

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

좋아요 !! Delegate 냐미 ~

Comment on lines 84 to 87
@objc private func deleteButtonTapped() {
isDeleteMode.toggle()
challengeCollectionView.reloadData()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

그러게욜 두번하는 이유가 잇나,,

@Zoe0929 Zoe0929 merged commit 3e949ef into develop Jan 12, 2024
@Zoe0929 Zoe0929 deleted the feat/#51/AppDelete branch January 13, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌈 feat 기능 구현 🐰지희 지희의 issue
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[Feat] 삭제 로직 구현
3 participants