mirror of
https://github.com/wahyd4/Yep.git
synced 2026-08-16 16:28:45 +10:00
add DoNotDisturbPeriodCell
This commit is contained in:
@@ -181,6 +181,8 @@
|
||||
50A640E01B6F38CF0050E4A3 /* NotificationsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A640DF1B6F38CF0050E4A3 /* NotificationsViewController.swift */; };
|
||||
50A640E51B6F41E00050E4A3 /* DoNotDisturbSwitchCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A640E31B6F41E00050E4A3 /* DoNotDisturbSwitchCell.swift */; };
|
||||
50A640E61B6F41E00050E4A3 /* DoNotDisturbSwitchCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A640E41B6F41E00050E4A3 /* DoNotDisturbSwitchCell.xib */; };
|
||||
50A640E91B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A640E71B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.swift */; };
|
||||
50A640EA1B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */; };
|
||||
50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */; };
|
||||
50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */; };
|
||||
50A9D4511ACD383E000B2599 /* NSDate+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */; };
|
||||
@@ -413,6 +415,8 @@
|
||||
50A640DF1B6F38CF0050E4A3 /* NotificationsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NotificationsViewController.swift; path = ViewControllers/Notifications/NotificationsViewController.swift; sourceTree = "<group>"; };
|
||||
50A640E31B6F41E00050E4A3 /* DoNotDisturbSwitchCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DoNotDisturbSwitchCell.swift; path = Views/Cells/DoNotDisturb/DoNotDisturbSwitchCell.swift; sourceTree = "<group>"; };
|
||||
50A640E41B6F41E00050E4A3 /* DoNotDisturbSwitchCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = DoNotDisturbSwitchCell.xib; path = Views/Cells/DoNotDisturb/DoNotDisturbSwitchCell.xib; sourceTree = "<group>"; };
|
||||
50A640E71B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DoNotDisturbPeriodCell.swift; path = Views/Cells/DoNotDisturb/DoNotDisturbPeriodCell.swift; sourceTree = "<group>"; };
|
||||
50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = DoNotDisturbPeriodCell.xib; path = Views/Cells/DoNotDisturb/DoNotDisturbPeriodCell.xib; sourceTree = "<group>"; };
|
||||
50A9D44A1ACD37A8000B2599 /* NSFileManager+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSFileManager+Yep.swift"; path = "Extensions/NSFileManager+Yep.swift"; sourceTree = "<group>"; };
|
||||
50A9D44C1ACD382B000B2599 /* NSDateTimeAgo.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = NSDateTimeAgo.bundle; path = Extensions/NSDateTimeAgo.bundle; sourceTree = "<group>"; };
|
||||
50A9D4501ACD383E000B2599 /* NSDate+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSDate+Extension.swift"; path = "Extensions/NSDate+Extension.swift"; sourceTree = "<group>"; };
|
||||
@@ -1369,6 +1373,8 @@
|
||||
children = (
|
||||
50A640E31B6F41E00050E4A3 /* DoNotDisturbSwitchCell.swift */,
|
||||
50A640E41B6F41E00050E4A3 /* DoNotDisturbSwitchCell.xib */,
|
||||
50A640E71B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.swift */,
|
||||
50A640E81B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib */,
|
||||
);
|
||||
name = DoNotDisturb;
|
||||
sourceTree = "<group>";
|
||||
@@ -1657,6 +1663,7 @@
|
||||
508F8FDF1B049ACF00461B0B /* InstagramMediaCell.xib in Resources */,
|
||||
50E114FD1ABC549300F13000 /* ContactsCell.xib in Resources */,
|
||||
502AE54F1AB93175005BD199 /* ProfileHeaderCell.xib in Resources */,
|
||||
50A640EA1B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.xib in Resources */,
|
||||
0A8F54BB1AB67D11004AD60E /* LaunchScreen.xib in Resources */,
|
||||
5053AD511AF82A1700B3CBFA /* PickLocationCell.xib in Resources */,
|
||||
5053AD5B1AF83B4200B3CBFA /* ChatLeftLocationCell.xib in Resources */,
|
||||
@@ -1890,6 +1897,7 @@
|
||||
0A90187E1B01152800AE4B7F /* ProfileSocialAccountCell.swift in Sources */,
|
||||
50894CF51AEA4A01000981AF /* SettingsUserCell.swift in Sources */,
|
||||
5053AD5A1AF83B4200B3CBFA /* ChatLeftLocationCell.swift in Sources */,
|
||||
50A640E91B6F45FA0050E4A3 /* DoNotDisturbPeriodCell.swift in Sources */,
|
||||
508F8FD01B01D04400461B0B /* GithubRepoCell.swift in Sources */,
|
||||
50F2B97B1B2EEAF800F840CC /* NavigationTitleLabel.swift in Sources */,
|
||||
504F415A1AD5028200FBB19A /* SkillCell.swift in Sources */,
|
||||
|
||||
@@ -15,13 +15,14 @@ class NotificationsViewController: UIViewController {
|
||||
|
||||
struct DoNotDisturbPeriod {
|
||||
var isOn: Bool = false
|
||||
var start: String = "22:00"
|
||||
var end: String = "07:00"
|
||||
var from: String = "22:00"
|
||||
var to: String = "07:00"
|
||||
}
|
||||
|
||||
var doNotDisturbPeriod = DoNotDisturbPeriod()
|
||||
|
||||
let DoNotDisturbSwitchCellID = "DoNotDisturbSwitchCell"
|
||||
let DoNotDisturbPeriodCellID = "DoNotDisturbPeriodCell"
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@@ -29,6 +30,7 @@ class NotificationsViewController: UIViewController {
|
||||
title = NSLocalizedString("Notifications", comment: "")
|
||||
|
||||
tableView.registerNib(UINib(nibName: DoNotDisturbSwitchCellID, bundle: nil), forCellReuseIdentifier: DoNotDisturbSwitchCellID)
|
||||
tableView.registerNib(UINib(nibName: DoNotDisturbPeriodCellID, bundle: nil), forCellReuseIdentifier: DoNotDisturbPeriodCellID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,21 +38,59 @@ class NotificationsViewController: UIViewController {
|
||||
|
||||
extension NotificationsViewController: UITableViewDataSource, UITableViewDelegate {
|
||||
|
||||
enum DoNotDisturbPeriodRow: Int {
|
||||
case Switch
|
||||
case Period
|
||||
}
|
||||
|
||||
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return doNotDisturbPeriod.isOn ? 2 : 1
|
||||
return 2
|
||||
// return doNotDisturbPeriod.isOn ? 2 : 1
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
||||
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(DoNotDisturbSwitchCellID) as! DoNotDisturbSwitchCell
|
||||
cell.promptLabel.text = NSLocalizedString("Do Not Disturb", comment: "")
|
||||
cell.toggleSwitch.on = doNotDisturbPeriod.isOn
|
||||
switch indexPath.row {
|
||||
|
||||
return cell
|
||||
case DoNotDisturbPeriodRow.Switch.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(DoNotDisturbSwitchCellID) as! DoNotDisturbSwitchCell
|
||||
cell.promptLabel.text = NSLocalizedString("Do Not Disturb", comment: "")
|
||||
cell.toggleSwitch.on = doNotDisturbPeriod.isOn
|
||||
|
||||
return cell
|
||||
|
||||
case DoNotDisturbPeriodRow.Period.rawValue:
|
||||
let cell = tableView.dequeueReusableCellWithIdentifier(DoNotDisturbPeriodCellID) as! DoNotDisturbPeriodCell
|
||||
cell.fromPromptLabel.text = NSLocalizedString("From", comment: "")
|
||||
cell.toPromptLabel.text = NSLocalizedString("To", comment: "")
|
||||
|
||||
cell.fromLabel.text = doNotDisturbPeriod.from
|
||||
cell.toLabel.text = doNotDisturbPeriod.to
|
||||
|
||||
return cell
|
||||
|
||||
default:
|
||||
return UITableViewCell()
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
||||
|
||||
switch indexPath.row {
|
||||
|
||||
case DoNotDisturbPeriodRow.Switch.rawValue:
|
||||
return 44
|
||||
|
||||
case DoNotDisturbPeriodRow.Period.rawValue:
|
||||
return 60
|
||||
|
||||
default:
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// DoNotDisturbPeriodCell.swift
|
||||
//
|
||||
//
|
||||
// Created by NIX on 15/8/3.
|
||||
//
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class DoNotDisturbPeriodCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var fromPromptLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var toPromptLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var fromLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var toLabel: UILabel!
|
||||
|
||||
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
override func setSelected(selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="15A235d" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" rowHeight="79" id="KGk-i7-Jjw" customClass="DoNotDisturbPeriodCell" customModule="Yep" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="79"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="From" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Enb-xl-VLt">
|
||||
<rect key="frame" x="15" y="18" width="40" height="21"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="To" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GaZ-e1-aRj">
|
||||
<rect key="frame" x="15" y="39" width="18" height="21"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="22:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Un-Ye-CSh">
|
||||
<rect key="frame" x="244" y="18" width="43" height="21"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="07:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TZm-zG-HSh">
|
||||
<rect key="frame" x="244" y="39" width="43" height="21"/>
|
||||
<animations/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.50196081400000003" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<constraints>
|
||||
<constraint firstItem="Enb-xl-VLt" firstAttribute="leading" secondItem="GaZ-e1-aRj" secondAttribute="leading" id="02r-h2-ffI"/>
|
||||
<constraint firstItem="TZm-zG-HSh" firstAttribute="trailing" secondItem="8Un-Ye-CSh" secondAttribute="trailing" id="8bU-Hm-gh7"/>
|
||||
<constraint firstItem="Enb-xl-VLt" firstAttribute="centerY" secondItem="8Un-Ye-CSh" secondAttribute="centerY" id="axI-py-6Ex"/>
|
||||
<constraint firstAttribute="trailing" secondItem="8Un-Ye-CSh" secondAttribute="trailing" id="cQB-qM-l3R"/>
|
||||
<constraint firstAttribute="centerY" secondItem="GaZ-e1-aRj" secondAttribute="top" id="gzs-Uo-ohM"/>
|
||||
<constraint firstItem="TZm-zG-HSh" firstAttribute="centerY" secondItem="GaZ-e1-aRj" secondAttribute="centerY" id="hZf-of-d16"/>
|
||||
<constraint firstItem="Enb-xl-VLt" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="yHj-HR-kCP"/>
|
||||
<constraint firstAttribute="centerY" secondItem="Enb-xl-VLt" secondAttribute="bottom" id="yPA-ih-z0o"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<animations/>
|
||||
<connections>
|
||||
<outlet property="fromLabel" destination="8Un-Ye-CSh" id="lxl-dE-1rP"/>
|
||||
<outlet property="fromPromptLabel" destination="Enb-xl-VLt" id="WDj-gB-qJ1"/>
|
||||
<outlet property="toLabel" destination="TZm-zG-HSh" id="ylH-xY-3sN"/>
|
||||
<outlet property="toPromptLabel" destination="GaZ-e1-aRj" id="iqM-PU-72W"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="419" y="397.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user