-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] #384 - 마이페이지 알림 뷰 구현
- Loading branch information
Showing
11 changed files
with
426 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Spark-iOS/Spark-iOS/Resource/Storyboards/Mypage/Notification.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> | ||
<device id="retina6_1" orientation="portrait" appearance="light"/> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="System colors in document resources" minToolsVersion="11.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--NotificationVC--> | ||
<scene sceneID="s0d-6b-0kx"> | ||
<objects> | ||
<viewController storyboardIdentifier="NotificationVC" id="Y6W-OH-hqX" customClass="NotificationVC" customModule="Spark_iOS" customModuleProvider="target" sceneMemberID="viewController"> | ||
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc"> | ||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/> | ||
<color key="backgroundColor" systemColor="systemBackgroundColor"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="-23" y="116"/> | ||
</scene> | ||
</scenes> | ||
<resources> | ||
<systemColor name="systemBackgroundColor"> | ||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
</systemColor> | ||
</resources> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 125 additions & 0 deletions
125
Spark-iOS/Spark-iOS/Source/Cells/Mypage/NotificationTVC.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
// | ||
// NotificationTVC.swift | ||
// Spark-iOS | ||
// | ||
// Created by kimhyungyu on 2022/03/27. | ||
// | ||
|
||
import UIKit | ||
|
||
class NotificationTVC: UITableViewCell { | ||
|
||
// MARK: - Properties | ||
|
||
private let titleLabel = UILabel() | ||
private let subtitleLabel = UILabel() | ||
private let notificationSwitch = UISwitch() | ||
private let lineView = UIView() | ||
|
||
// MARK: - View Life Cycle | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
|
||
setUI() | ||
setAddTargets() | ||
setLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func prepareForReuse() { | ||
super.prepareForReuse() | ||
|
||
titleLabel.text = "" | ||
subtitleLabel.text = "" | ||
notificationSwitch.isOn = false | ||
lineView.isHidden = false | ||
} | ||
} | ||
|
||
extension NotificationTVC { | ||
private func setUI() { | ||
titleLabel.font = .p1Title | ||
titleLabel.textColor = .sparkBlack | ||
|
||
subtitleLabel.font = .caption | ||
subtitleLabel.textColor = .sparkDarkGray | ||
|
||
notificationSwitch.isOn = false | ||
|
||
lineView.backgroundColor = .sparkGray | ||
} | ||
|
||
// cell initializer. | ||
public func initCell(with type: NotificationTableRow, isOn: Bool) { | ||
notificationSwitch.isOn = isOn | ||
|
||
switch type { | ||
case .roomStart: | ||
titleLabel.text = "습관방 시작" | ||
subtitleLabel.text = "대기 중이었던 방이 시작되면 바로 알 수 있어요." | ||
lineView.isHidden = false | ||
case .spark: | ||
titleLabel.text = "스파크 보내기" | ||
subtitleLabel.text = "받은 스파크를 확인할 수 있어요." | ||
lineView.isHidden = true | ||
case .consider: | ||
titleLabel.text = "고민중" | ||
subtitleLabel.text = "다른 스파커가 고민중인 경우 바로 알 수 있어요." | ||
lineView.isHidden = true | ||
case .certification: | ||
titleLabel.text = "인증 완료" | ||
subtitleLabel.text = "스파커들의 인증 사진을 바로 확인할 수 있어요." | ||
lineView.isHidden = false | ||
case .remind: | ||
titleLabel.text = "미완료 습관방" | ||
subtitleLabel.text = "21:00에 미완료된 방이 있을 경우 알 수 있어요." | ||
lineView.isHidden = true | ||
} | ||
} | ||
|
||
private func setAddTargets() { | ||
notificationSwitch.addTarget(self, action: #selector(touchNotificationSwitch), for: .touchUpInside) | ||
} | ||
|
||
// MARK: - @objc Methods | ||
|
||
@objc | ||
private func touchNotificationSwitch() { | ||
// TODO: - network | ||
} | ||
} | ||
|
||
// MARK: - Layout | ||
|
||
extension NotificationTVC { | ||
private func setLayout() { | ||
self.contentView.addSubviews([titleLabel, subtitleLabel, notificationSwitch, lineView]) | ||
|
||
titleLabel.snp.makeConstraints { | ||
$0.top.equalToSuperview().inset(11) | ||
$0.leading.equalToSuperview().inset(20) | ||
} | ||
|
||
subtitleLabel.snp.makeConstraints { | ||
$0.top.equalTo(titleLabel.snp.bottom).offset(8) | ||
$0.leading.equalTo(titleLabel.snp.leading) | ||
} | ||
|
||
notificationSwitch.snp.makeConstraints { | ||
$0.trailing.equalToSuperview().inset(20) | ||
$0.height.equalTo(30) | ||
$0.width.equalTo(51) | ||
$0.top.equalTo(titleLabel.snp.top).offset(10) | ||
} | ||
|
||
lineView.snp.makeConstraints { | ||
$0.bottom.trailing.equalToSuperview() | ||
$0.height.equalTo(0.5) | ||
$0.leading.equalToSuperview().inset(20) | ||
} | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
Spark-iOS/Spark-iOS/Source/Cells/Mypage/NotificationTableHeaderView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// NotificationHeaderTVC.swift | ||
// Spark-iOS | ||
// | ||
// Created by kimhyungyu on 2022/03/27. | ||
// | ||
|
||
import UIKit | ||
|
||
class NotificationTableHeaderView: UIView { | ||
|
||
// MARK: - Properties | ||
|
||
private let headerTitleLabel = UILabel() | ||
|
||
// MARK: - View Life Cycle | ||
|
||
init(type: NotificationTableSection) { | ||
super.init(frame: .zero) | ||
|
||
switch type { | ||
case .information: | ||
headerTitleLabel.text = "안내" | ||
case .sparkerActivity: | ||
headerTitleLabel.text = "스파커 활동" | ||
case .remind: | ||
headerTitleLabel.text = "리마인드" | ||
} | ||
setUI() | ||
setLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} | ||
|
||
extension NotificationTableHeaderView { | ||
private func setUI() { | ||
headerTitleLabel.font = .p2Subtitle | ||
headerTitleLabel.textColor = .darkGray | ||
} | ||
|
||
private func setLayout() { | ||
self.addSubview(headerTitleLabel) | ||
|
||
headerTitleLabel.snp.makeConstraints { | ||
$0.bottom.equalToSuperview() | ||
$0.leading.equalToSuperview().inset(20) | ||
} | ||
} | ||
} |
Oops, something went wrong.