Skip to content

Commit

Permalink
Merge pull request #436 from hyun99999/feature/#384
Browse files Browse the repository at this point in the history
[Feat] #384 - 마이페이지 알림 뷰 구현
  • Loading branch information
hyun99999 authored Mar 29, 2022
2 parents 3228bde + 01a611a commit 99ecab4
Show file tree
Hide file tree
Showing 11 changed files with 426 additions and 21 deletions.
18 changes: 16 additions & 2 deletions Spark-iOS/Spark-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
F8ABAEFD279615DA00C0F774 /* splash_bg_iOS.json in Resources */ = {isa = PBXBuildFile; fileRef = F8ABAEFC279615DA00C0F774 /* splash_bg_iOS.json */; };
F8ABAEFF2796163300C0F774 /* splash_logo.json in Resources */ = {isa = PBXBuildFile; fileRef = F8ABAEFE2796163300C0F774 /* splash_logo.json */; };
F8B18E0327EF9903001A1A7D /* WithdrawalCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0227EF9903001A1A7D /* WithdrawalCellDelegate.swift */; };
F8B18E0527EFA19E001A1A7D /* NotificationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0427EFA19E001A1A7D /* NotificationVC.swift */; };
F8B18E0727EFA1AA001A1A7D /* Notification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8B18E0627EFA1AA001A1A7D /* Notification.storyboard */; };
F8B18E0927EFA43F001A1A7D /* NotificationTableHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0827EFA43F001A1A7D /* NotificationTableHeaderView.swift */; };
F8B18E0B27EFA453001A1A7D /* NotificationTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B18E0A27EFA453001A1A7D /* NotificationTVC.swift */; };
F8C14A9B2795094800498687 /* HomeEmptyCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C14A992795094800498687 /* HomeEmptyCVC.swift */; };
F8C14A9C2795094800498687 /* HomeEmptyCVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = F8C14A9A2795094800498687 /* HomeEmptyCVC.xib */; };
F8C3659527DBB82A000AA9BD /* CompleteFailDialogueVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C3659427DBB82A000AA9BD /* CompleteFailDialogueVC.swift */; };
Expand Down Expand Up @@ -417,6 +421,10 @@
F8ABAEFC279615DA00C0F774 /* splash_bg_iOS.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_bg_iOS.json; sourceTree = "<group>"; };
F8ABAEFE2796163300C0F774 /* splash_logo.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = splash_logo.json; sourceTree = "<group>"; };
F8B18E0227EF9903001A1A7D /* WithdrawalCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithdrawalCellDelegate.swift; sourceTree = "<group>"; };
F8B18E0427EFA19E001A1A7D /* NotificationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationVC.swift; sourceTree = "<group>"; };
F8B18E0627EFA1AA001A1A7D /* Notification.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Notification.storyboard; sourceTree = "<group>"; };
F8B18E0827EFA43F001A1A7D /* NotificationTableHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTableHeaderView.swift; sourceTree = "<group>"; };
F8B18E0A27EFA453001A1A7D /* NotificationTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTVC.swift; sourceTree = "<group>"; };
F8C14A992795094800498687 /* HomeEmptyCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeEmptyCVC.swift; sourceTree = "<group>"; };
F8C14A9A2795094800498687 /* HomeEmptyCVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeEmptyCVC.xib; sourceTree = "<group>"; };
F8C3659427DBB82A000AA9BD /* CompleteFailDialogueVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompleteFailDialogueVC.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1325,6 +1333,7 @@
F8E4DFCF27D0858500128B1F /* MypageVC.swift */,
F8250CF027D238440073FFCA /* EditProfileVC.swift */,
F8902FBC27ED844E0034E8F9 /* WithdrawalVC.swift */,
F8B18E0427EFA19E001A1A7D /* NotificationVC.swift */,
);
path = Mypage;
sourceTree = "<group>";
Expand All @@ -1335,6 +1344,7 @@
F8E4DFD227D0877000128B1F /* Mypage.storyboard */,
F8250CF227D238990073FFCA /* EditProfile.storyboard */,
F8902FB827ED84060034E8F9 /* Withdrawal.storyboard */,
F8B18E0627EFA1AA001A1A7D /* Notification.storyboard */,
);
path = Mypage;
sourceTree = "<group>";
Expand All @@ -1345,6 +1355,8 @@
F8E4DFD527D0918C00128B1F /* MypageProfileTVC.swift */,
F8E4DFD727D09F7A00128B1F /* MypageDefaultTVC.swift */,
F8E4DFD927D0DE3700128B1F /* MypageTableHeaderView.swift */,
F8B18E0827EFA43F001A1A7D /* NotificationTableHeaderView.swift */,
F8B18E0A27EFA453001A1A7D /* NotificationTVC.swift */,
);
path = Mypage;
sourceTree = "<group>";
Expand Down Expand Up @@ -1459,6 +1471,7 @@
files = (
EB625E84278F273200C43DE9 /* FailStorageCVC.xib in Resources */,
EB874AEE2797071C000DD20B /* Dialogue.storyboard in Resources */,
F8B18E0727EFA1AA001A1A7D /* Notification.storyboard in Resources */,
F8C14A9C2795094800498687 /* HomeEmptyCVC.xib in Resources */,
F8C3659727DBB834000AA9BD /* CompleteFailDialogue.storyboard in Resources */,
2B9852092790ACF000CE40A7 /* CreateAuth.storyboard in Resources */,
Expand Down Expand Up @@ -1671,6 +1684,8 @@
F82F57FD2792847D003E4174 /* GenericResponse.swift in Sources */,
F8E4DFD627D0918C00128B1F /* MypageProfileTVC.swift in Sources */,
F821813527DE659E00DDFBF8 /* SparkTabBarController.swift in Sources */,
F8B18E0527EFA19E001A1A7D /* NotificationVC.swift in Sources */,
F8B18E0B27EFA453001A1A7D /* NotificationTVC.swift in Sources */,
F80A3E57278C1C2700728E07 /* FeedVC.swift in Sources */,
EB9C50842792A61D00588155 /* HabitAuthVC.swift in Sources */,
2BC17277278F765C00BA3029 /* WaitingFriendCVC.swift in Sources */,
Expand Down Expand Up @@ -1701,6 +1716,7 @@
F82F5802279287FD003E4174 /* HabitRoom.swift in Sources */,
F82B2E12278F54CD00219628 /* SplashVC.swift in Sources */,
F8E4DFDA27D0DE3700128B1F /* MypageTableHeaderView.swift in Sources */,
F8B18E0927EFA43F001A1A7D /* NotificationTableHeaderView.swift in Sources */,
F8404E8B27AB835F004AEDC3 /* SendSparkButton.swift in Sources */,
F82F580427928975003E4174 /* MoyaLoggerPlugin.swift in Sources */,
F8096F2927841F1E00B71D38 /* Const.swift in Sources */,
Expand Down Expand Up @@ -1900,7 +1916,6 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
DEVELOPMENT_TEAM = T8C9SSEX5G;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Spark-iOS/Resource/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Spark;
Expand Down Expand Up @@ -1939,7 +1954,6 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 11;
DEVELOPMENT_TEAM = T8C9SSEX5G;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Spark-iOS/Resource/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = Spark;
Expand Down
2 changes: 2 additions & 0 deletions Spark-iOS/Spark-iOS/Resource/Constants/Cell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ extension Const {
static let noticeServiceCVC = "NoticeServiceCVC"
static let onboardingCVC = "OnboardingCVC"
static let habitRoomGuideCVC = "HabitRoomGuideCVC"
static let notificationTableHeaderView = "NotificationTableHeaderView"
static let notificationTVC = "NotificationTVC"
}
}
}
1 change: 1 addition & 0 deletions Spark-iOS/Spark-iOS/Resource/Constants/Storyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ extension Const {
static let habitRoomGuide = "HabitRoomGuide"
static let withdrawal = "Withdrawal"
static let lifeDiminishDialogue = "LifeDiminishDialogue"
static let notification = "Notification"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ extension Const {
static let habitRoomGuide = "HabitRoomGuideVC"
static let withdrawal = "WithdrawalVC"
static let lifeDiminishDialogue = "LifeDiminishDialogueVC"
static let notification = "NotificationVC"
}
}
}
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>
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension MypageDefaultTVC {
}

// initializer.
func initCell(type: MypageRow) {
func initCell(type: MypageTableRow) {
switch type {
case .profile:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MypageTableHeaderView: UIView {

// MARK: - View Life Cycle

init(type: MypageTableViewSection) {
init(type: MypageTableSection) {
super.init(frame: .zero)

switch type {
Expand Down
125 changes: 125 additions & 0 deletions Spark-iOS/Spark-iOS/Source/Cells/Mypage/NotificationTVC.swift
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)
}
}
}
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)
}
}
}
Loading

0 comments on commit 99ecab4

Please sign in to comment.