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

[Fix] #165 - 습관방 멘트, 상태바, 상태 스티커 수정하기 #168

Merged
merged 5 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Spark-iOS/Spark-iOS/Resource/Constants/Notification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ extension Notification.Name {
static let appearFloatingButton = Notification.Name("appearFloatingButton")
static let disappearFloatingButton = Notification.Name("disappearFloatingButton")
static let resetStopWatch = Notification.Name("resetStopWatch")
static let updateHabitRoom = Notification.Name("updateHabitRoom")
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<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="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
<objects>
<viewController storyboardIdentifier="HabitRoomVC" id="Y6W-OH-hqX" customClass="HabitRoomVC" 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"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="suy-dQ-y1I">
<rect key="frame" x="0.0" y="343" width="414" height="553"/>
<rect key="frame" x="0.0" y="499" width="600" height="101"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<collectionViewFlowLayout key="collectionViewLayout" automaticEstimatedItemSize="YES" minimumLineSpacing="10" minimumInteritemSpacing="10" id="nGt-Lp-835">
<size key="itemSize" width="128" height="128"/>
Expand All @@ -45,38 +45,38 @@
</cells>
</collectionView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="INP-rS-JPk">
<rect key="frame" x="0.0" y="0.0" width="414" height="348"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="504"/>
<constraints>
<constraint firstAttribute="width" secondItem="INP-rS-JPk" secondAttribute="height" multiplier="375:315" id="m59-v9-3SR"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mzm-65-lz0">
<rect key="frame" x="20" y="64" width="24" height="24"/>
<rect key="frame" x="20" y="20" width="24" height="24"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="icBackWhite"/>
<connections>
<action selector="popToHomeVC:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="Lgd-v7-Bdb"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ABA-OJ-sFD">
<rect key="frame" x="186.5" y="64" width="41.5" height="20.5"/>
<rect key="frame" x="279.5" y="20" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eB0-bS-UA9">
<rect key="frame" x="370" y="64" width="24" height="24"/>
<rect key="frame" x="556" y="20" width="24" height="24"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="icMoreVerticalWhite"/>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cFf-Os-dsz">
<rect key="frame" x="20" y="117.5" width="41.5" height="20.5"/>
<rect key="frame" x="20" y="73.5" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="9" translatesAutoresizingMaskIntoConstraints="NO" id="Wbn-p4-clp">
<rect key="frame" x="322" y="119" width="72" height="18"/>
<rect key="frame" x="508" y="75" width="72" height="18"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="IXG-na-OT7">
<rect key="frame" x="0.0" y="0.0" width="18" height="18"/>
Expand All @@ -94,43 +94,43 @@
</constraints>
</stackView>
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="pjm-qP-ARe">
<rect key="frame" x="20" y="152" width="374" height="4"/>
<rect key="frame" x="20" y="108" width="560" height="4"/>
</progressView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wy4-Vp-81Z">
<rect key="frame" x="20" y="164" width="41.5" height="20.5"/>
<rect key="frame" x="20" y="120" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="omc-x7-fqu">
<rect key="frame" x="352.5" y="164" width="41.5" height="20.5"/>
<rect key="frame" x="538.5" y="120" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RnB-mU-OUf">
<rect key="frame" x="20" y="212.5" width="374" height="71.5"/>
<rect key="frame" x="20" y="168.5" width="560" height="107"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="시간" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1cf-84-80o">
<rect key="frame" x="8" y="10" width="26" height="20.5"/>
<rect key="frame" x="8" y="10" width="24.5" height="16.5"/>
<fontDescription key="fontDescription" name="NotoSansKR-Bold" family="Noto Sans KR" pointSize="14"/>
<color key="textColor" name="sparkWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="목표" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qSy-7n-MfT">
<rect key="frame" x="8" y="41" width="26" height="20.5"/>
<rect key="frame" x="8" y="80.5" width="24.5" height="16.5"/>
<fontDescription key="fontDescription" name="NotoSansKR-Bold" family="Noto Sans KR" pointSize="14"/>
<color key="textColor" name="sparkWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ngC-dS-4WJ">
<rect key="frame" x="41" y="10" width="41.5" height="20.5"/>
<rect key="frame" x="39.5" y="10" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" name="sparkWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b13-Cp-oOC">
<rect key="frame" x="41" y="41" width="41.5" height="20.5"/>
<rect key="frame" x="39.5" y="80.5" width="41.5" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" name="sparkWhite"/>
<nil key="highlightedColor"/>
Expand All @@ -150,7 +150,7 @@
</constraints>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BjG-wg-ehW">
<rect key="frame" x="112" y="781.5" width="190" height="60.5"/>
<rect key="frame" x="112" y="460.5" width="376" height="119.5"/>
<constraints>
<constraint firstAttribute="width" secondItem="BjG-wg-ehW" secondAttribute="height" multiplier="151:48" id="V4F-gB-9Dm"/>
</constraints>
Expand Down Expand Up @@ -207,7 +207,7 @@
<outlet property="habitTitleLabel" destination="ABA-OJ-sFD" id="tNY-Gf-EIT"/>
<outlet property="mainCollectionView" destination="suy-dQ-y1I" id="24D-in-Qwv"/>
<outlet property="moreButton" destination="eB0-bS-UA9" id="IJL-qg-RtK"/>
<outlet property="progessView" destination="pjm-qP-ARe" id="9PS-3m-BQY"/>
<outlet property="progressView" destination="pjm-qP-ARe" id="9PS-3m-BQY"/>
<outlet property="secondLifeImage" destination="bQZ-4W-DDf" id="tsu-7V-ufP"/>
<outlet property="startDateLabel" destination="wy4-Vp-81Z" id="0LK-yl-snN"/>
<outlet property="thirdLifeImage" destination="1Om-9f-SMR" id="LVB-pd-8fr"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import UIKit

class HabitRoomMemberCVC: UICollectionViewCell {

// MARK: - Properties

var presentToSendSparkVCClosure: (()-> Void)?

// MARK: - @IBOutlet Properties

@IBOutlet weak var profileImage: UIImageView!
Expand All @@ -35,6 +39,7 @@ class HabitRoomMemberCVC: UICollectionViewCell {
sparkCountLabel.text = ""
sparkCountLabel.isHidden = true
sparkImage.image = UIImage()
sparkImage.isUserInteractionEnabled = false
stickerImage.isHidden = true
stickerImage.image = UIImage()
}
Expand Down Expand Up @@ -63,7 +68,8 @@ extension HabitRoomMemberCVC {
profileImg: String,
nickname: String,
status: String,
receivedSpark: Int) {
receivedSpark: Int,
leftDay: Int) {
profileImage.updateImage(profileImg)

nicknameLabel.text = nickname
Expand All @@ -81,8 +87,13 @@ extension HabitRoomMemberCVC {
stickerImage.image = UIImage(named: "stickerRestSmallHavitroom")
stickerImage.isHidden = false
} else {
statusLabel.text = "인증은 내일부터 가능해요."
stickerImage.isHidden = true
if leftDay == 66 {
statusLabel.text = "인증은 내일부터 가능해요."
stickerImage.isHidden = true
} else {
statusLabel.text = "아직 인증하지 않았어요!"
stickerImage.isHidden = true
}
}

tagMeImage.isHidden = false
Expand All @@ -97,7 +108,8 @@ extension HabitRoomMemberCVC {
profileImg: String,
nickname: String,
status: String,
sparkDone: Bool) {
leftDay: Int,
closure: (()->Void)?) {
profileImage.updateImage(profileImg)

nicknameLabel.text = nickname
Expand All @@ -109,15 +121,39 @@ extension HabitRoomMemberCVC {
} else if status == "REST" {
statusLabel.text = "오늘은 쉬어요."
} else {
statusLabel.text = "인증은 내일부터 가능해요."
if leftDay == 66 {
statusLabel.text = "인증은 내일부터 가능해요."
stickerImage.isHidden = true
} else {
statusLabel.text = "아직 인증하지 않았어요!"
stickerImage.isHidden = true
}
}

tagMeImage.isHidden = true
if sparkDone {

if leftDay == 66 {
sparkImage.image = UIImage(named: "icFireInactive")
sparkImage.isUserInteractionEnabled = false
} else {
sparkImage.image = UIImage(named: "icFireDefault")
if status == "DONE" || status == "REST" {
sparkImage.image = UIImage(named: "icFireInactive")
sparkImage.isUserInteractionEnabled = false
} else {
sparkImage.image = UIImage(named: "icFireDefault")
sparkImage.isUserInteractionEnabled = true

presentToSendSparkVCClosure = closure
let tap = UITapGestureRecognizer(target: self, action: #selector(presentToSendSparkVC))
sparkImage.addGestureRecognizer(tap)
}
}

sparkCountLabel.isHidden = true
}

@objc
private func presentToSendSparkVC() {
presentToSendSparkVCClosure?()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class HabitAuthVC: UIViewController {

@IBAction func touchOutsideDismiss(_ sender: Any) {
self.dismiss(animated: true, completion: nil)
NotificationCenter.default.post(name: .updateHabitRoom, object: nil)
}
}

Expand Down Expand Up @@ -165,8 +166,10 @@ extension HabitAuthVC {
func setConsiderRestWithAPI(statusType: String) {
RoomAPI.shared.setConsiderRest(roomID: roomID ?? 0, statusType: statusType) { response in
switch response {
case .success(_):
case .success(let message):
self.dismiss(animated: true, completion: nil)
NotificationCenter.default.post(name: .updateHabitRoom, object: nil)
print("setConsiderRestWithAPI - success: \(message)")
case .requestErr(let message):
print("setConsiderRestWithAPI - requestErr: \(message)")
case .pathErr:
Expand Down
Loading