Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursAddClosedTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
#import "MWMOpeningHoursAddClosedTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursAddClosedTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton * addClosedButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursAddClosedTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 44.0;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
self.addClosedButton.enabled = self.section.canAddClosedTime;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)addClosedTap
|
||||
{
|
||||
if (self.isVisible)
|
||||
[self.section addClosedTime];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMOpeningHoursAddClosedTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<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="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DPW-UE-5UN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="42.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="Add Hours Closed"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatNormalTransButtonBig"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_time_add_closed"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="addClosedTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="HxR-3Y-SiG"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="6P1-ZO-JMA">
|
||||
<rect key="frame" x="0.0" y="43.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="ckb-Sc-MTJ"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="DPW-UE-5UN" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="4Li-Xr-b3S"/>
|
||||
<constraint firstItem="DPW-UE-5UN" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Ng6-qX-haA"/>
|
||||
<constraint firstItem="6P1-ZO-JMA" firstAttribute="top" secondItem="DPW-UE-5UN" secondAttribute="bottom" constant="1" id="b8H-yj-uLc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DPW-UE-5UN" secondAttribute="trailing" id="bAd-QF-f1s"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6P1-ZO-JMA" secondAttribute="bottom" constant="-0.5" id="edX-pE-hpk"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6P1-ZO-JMA" secondAttribute="trailing" id="uJU-yO-Xeh"/>
|
||||
<constraint firstItem="6P1-ZO-JMA" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="yxQ-et-0D2"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="nLi-ui-Rk2"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="addClosedButton" destination="DPW-UE-5UN" id="Z5D-1Z-Hxa"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#import "MWMOpeningHoursModel.h"
|
||||
|
||||
@interface MWMOpeningHoursAddScheduleTableViewCell : UITableViewCell
|
||||
|
||||
+ (CGFloat)height;
|
||||
|
||||
@property (weak, nonatomic) MWMOpeningHoursModel * model;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
#import "MWMOpeningHoursAddScheduleTableViewCell.h"
|
||||
#import <CoreApi/MWMOpeningHoursCommon.h>
|
||||
|
||||
@interface MWMOpeningHoursAddScheduleTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton * addScheduleButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursAddScheduleTableViewCell
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
}
|
||||
|
||||
+ (CGFloat)height
|
||||
{
|
||||
return 84.0;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
NSString * title = [NSString stringWithFormat:@"%@ %@", L(@"editor_time_add"),
|
||||
stringFromOpeningDays([self.model unhandledDays])];
|
||||
[self.addScheduleButton setTitle:title forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)addScheduleTap
|
||||
{
|
||||
[self.model addSchedule];
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setModel:(MWMOpeningHoursModel *)model
|
||||
{
|
||||
_model = model;
|
||||
[self refresh];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="84" id="KGk-i7-Jjw" customClass="MWMOpeningHoursAddScheduleTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
|
||||
<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="84"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rja-9J-5hA">
|
||||
<rect key="frame" x="40" y="6" width="240" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="32" id="hCp-vK-2rD"/>
|
||||
<constraint firstAttribute="width" constant="240" id="xAy-7R-cxW"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<state key="normal" title="Another Schedule">
|
||||
<color key="titleColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="EditButton"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="addScheduleTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="u6e-fL-daC"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Rja-9J-5hA" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="fcS-KP-VSI"/>
|
||||
<constraint firstItem="Rja-9J-5hA" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="6" id="i23-52-8oh"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<outlet property="addScheduleButton" destination="Rja-9J-5hA" id="Ubq-Fn-Zg0"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursAllDayTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
#import "MWMOpeningHoursAllDayTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursAllDayTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UISwitch * switcher;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * label;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursAllDayTableViewCell
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
[self setupLabelColor];
|
||||
}
|
||||
|
||||
- (void)setupLabelColor
|
||||
{
|
||||
self.label.textColor = self.switcher.on ? [UIColor blackPrimaryText] : [UIColor blackHintText];
|
||||
}
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 44.0;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
self.switcher.on = self.section.allDay;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)onSwitch
|
||||
{
|
||||
self.section.allDay = self.switcher.on;
|
||||
[self setupLabelColor];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMOpeningHoursAllDayTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<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="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="All Day (24 hours)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="223" translatesAutoresizingMaskIntoConstraints="NO" id="0Ni-TD-6Ia">
|
||||
<rect key="frame" x="16" y="12" width="223" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_time_allday"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0BP-HJ-Tdq">
|
||||
<rect key="frame" x="255" y="7.5" width="51" height="29"/>
|
||||
<connections>
|
||||
<action selector="onSwitch" destination="KGk-i7-Jjw" eventType="valueChanged" id="qZA-HV-PB6"/>
|
||||
</connections>
|
||||
</switch>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="lbK-kB-c4p">
|
||||
<rect key="frame" x="0.0" y="43.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="JvF-ZU-maq"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="0BP-HJ-Tdq" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerYWithinMargins" id="1kG-H0-QmS"/>
|
||||
<constraint firstItem="0Ni-TD-6Ia" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="4y2-py-cgM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lbK-kB-c4p" secondAttribute="trailing" id="797-Uf-0Jb"/>
|
||||
<constraint firstItem="lbK-kB-c4p" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Dv4-Kj-kii"/>
|
||||
<constraint firstAttribute="trailing" secondItem="0BP-HJ-Tdq" secondAttribute="trailing" constant="16" id="Ejw-wu-5pE"/>
|
||||
<constraint firstItem="lbK-kB-c4p" firstAttribute="top" secondItem="0BP-HJ-Tdq" secondAttribute="bottom" constant="7" id="KIL-OP-roj"/>
|
||||
<constraint firstItem="0BP-HJ-Tdq" firstAttribute="leading" secondItem="0Ni-TD-6Ia" secondAttribute="trailing" constant="16" id="cgf-7m-Kki"/>
|
||||
<constraint firstItem="0Ni-TD-6Ia" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="gZM-Zt-RId"/>
|
||||
<constraint firstAttribute="bottom" secondItem="lbK-kB-c4p" secondAttribute="bottom" constant="-0.5" id="jbG-hH-bln"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="label" destination="0Ni-TD-6Ia" id="zLO-3p-8E4"/>
|
||||
<outlet property="switcher" destination="0BP-HJ-Tdq" id="mHZ-4O-ve2"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursClosedSpanTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
#import "MWMOpeningHoursClosedSpanTableViewCell.h"
|
||||
|
||||
#import "CoreApi/CoreApi-Swift.h"
|
||||
|
||||
static NSString * const kLabelText = L(@"editor_hours_closed");
|
||||
|
||||
CGFloat labelWidth()
|
||||
{
|
||||
UILabel * label = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
label.font = [UIFont regular17];
|
||||
label.text = kLabelText;
|
||||
[label sizeToFit];
|
||||
return label.width;
|
||||
}
|
||||
|
||||
BOOL isCompactForCellWidth(CGFloat width)
|
||||
{
|
||||
static CGFloat const kLabelWidth = labelWidth();
|
||||
CGFloat constexpr widthOfAllElementsWithoutLabel = 234.0;
|
||||
CGFloat const maxLabelWidthForCompactCell = width - widthOfAllElementsWithoutLabel;
|
||||
return kLabelWidth < maxLabelWidthForCompactCell;
|
||||
}
|
||||
|
||||
@interface MWMOpeningHoursClosedSpanTableViewCell ()
|
||||
|
||||
@property(weak, nonatomic) IBOutlet UILabel * hoursClosedLabel;
|
||||
@property(weak, nonatomic) IBOutlet UILabel * timeSpanLabel;
|
||||
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanHorizontalAlignment;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * timeSpanVerticalAlignment;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * hoursClosedTrailing;
|
||||
|
||||
@property(nonatomic) BOOL isCompact;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursClosedSpanTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width { return isCompactForCellWidth(width) ? 44.0 : 64.0; }
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
self.hoursClosedLabel.text = kLabelText;
|
||||
self.isCompact = YES;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
if (self.isCompact != isCompactForCellWidth(self.width))
|
||||
{
|
||||
self.isCompact = !self.isCompact;
|
||||
if (self.isCompact)
|
||||
{
|
||||
self.hoursClosedLabel.font = [UIFont regular17];
|
||||
self.timeSpanLabel.textAlignment = NSTextAlignmentRight;
|
||||
self.timeSpanHorizontalAlignment.priority = UILayoutPriorityDefaultLow;
|
||||
self.timeSpanVerticalAlignment.priority = UILayoutPriorityDefaultLow;
|
||||
self.hoursClosedTrailing.priority = UILayoutPriorityDefaultLow;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.hoursClosedLabel.font = [UIFont regular14];
|
||||
self.timeSpanLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.timeSpanHorizontalAlignment.priority = UILayoutPriorityDefaultHigh;
|
||||
self.timeSpanVerticalAlignment.priority = UILayoutPriorityDefaultHigh;
|
||||
self.hoursClosedTrailing.priority = UILayoutPriorityDefaultHigh;
|
||||
}
|
||||
}
|
||||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
NSCalendar * calendar = NSCalendar.currentCalendar;
|
||||
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
NSUInteger const row = self.row;
|
||||
NSDate * openDate = [calendar dateFromComponents:[section timeForRow:row isStart:YES]];
|
||||
NSDate * closeDate = [calendar dateFromComponents:[section timeForRow:row isStart:NO]];
|
||||
|
||||
NSDateFormatterStyle timeStyle = NSDateFormatterShortStyle;
|
||||
NSDateFormatterStyle dateStyle = NSDateFormatterNoStyle;
|
||||
NSString * openString = [DateTimeFormatter dateStringFrom:openDate dateStyle:dateStyle timeStyle:timeStyle];
|
||||
NSString * closeString = [DateTimeFormatter dateStringFrom:closeDate dateStyle:dateStyle timeStyle:timeStyle];
|
||||
|
||||
self.timeSpanLabel.text = [NSString stringWithFormat:@"%@-%@", openString, closeString];
|
||||
|
||||
BOOL const isRowSelected = [section isRowSelected:row];
|
||||
self.timeSpanLabel.textColor = isRowSelected ? [UIColor linkBlue] : [UIColor blackSecondaryText];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)cancelTap { [self.section removeClosedTime:self.row]; }
|
||||
- (IBAction)expandTap
|
||||
{
|
||||
if (!self.isVisible)
|
||||
return;
|
||||
NSUInteger const row = self.row;
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
section.selectedRow = [section isRowSelected:row] ? nil : @(row);
|
||||
[section refresh:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMOpeningHoursClosedSpanTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<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="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eHW-h6-k3U" userLabel="Cancel Button" customClass="MWMButton">
|
||||
<rect key="frame" x="0.0" y="0.0" width="44" height="44"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="6T7-Ur-RWl"/>
|
||||
</constraints>
|
||||
<state key="normal" image="ic_clear_sys"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlack"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="cancelTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="UKS-mG-ZJG"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Closed" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="86" translatesAutoresizingMaskIntoConstraints="NO" id="lia-DA-sOa">
|
||||
<rect key="frame" x="44" y="12" width="86" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackPrimaryText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="14:00-15:00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="170" translatesAutoresizingMaskIntoConstraints="NO" id="hOg-Ps-YH4">
|
||||
<rect key="frame" x="134" y="11.5" width="170" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="170" id="lQt-Xw-FNV"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.49803921569999998" green="0.49803921569999998" blue="0.49803921569999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:blackHintText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3cC-7h-Nyb" userLabel="Expand Button">
|
||||
<rect key="frame" x="44" y="0.0" width="276" height="44"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<action selector="expandTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Fva-H8-Hgd"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="fZN-J3-A1c">
|
||||
<rect key="frame" x="0.0" y="43.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="Vyg-vJ-QBa"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="fZN-J3-A1c" secondAttribute="trailing" id="4ix-Pa-jem"/>
|
||||
<constraint firstAttribute="bottom" secondItem="3cC-7h-Nyb" secondAttribute="bottom" id="8WG-92-rMW"/>
|
||||
<constraint firstItem="3cC-7h-Nyb" firstAttribute="leading" secondItem="eHW-h6-k3U" secondAttribute="trailing" id="9Bn-Ln-6Kp"/>
|
||||
<constraint firstItem="lia-DA-sOa" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="9iu-Vt-ehV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="eHW-h6-k3U" secondAttribute="bottom" id="EBf-Wx-e3F"/>
|
||||
<constraint firstItem="eHW-h6-k3U" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="F0P-mc-NEh"/>
|
||||
<constraint firstItem="eHW-h6-k3U" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="Plg-3V-wwv"/>
|
||||
<constraint firstItem="fZN-J3-A1c" firstAttribute="top" secondItem="hOg-Ps-YH4" secondAttribute="bottom" constant="12" id="Pyv-5m-MMc"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fZN-J3-A1c" secondAttribute="bottom" constant="-0.5" id="Yi4-tf-i9O"/>
|
||||
<constraint firstItem="3cC-7h-Nyb" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="ZM1-oj-Ttu"/>
|
||||
<constraint firstItem="hOg-Ps-YH4" firstAttribute="leading" secondItem="lia-DA-sOa" secondAttribute="trailing" priority="500" constant="4" id="bUD-vp-CsK"/>
|
||||
<constraint firstAttribute="trailing" secondItem="3cC-7h-Nyb" secondAttribute="trailing" id="dwl-rT-xgr"/>
|
||||
<constraint firstAttribute="trailing" secondItem="hOg-Ps-YH4" secondAttribute="trailing" priority="500" constant="16" id="jzD-AQ-ZIp"/>
|
||||
<constraint firstItem="hOg-Ps-YH4" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" priority="500" id="kba-LF-TBE"/>
|
||||
<constraint firstItem="hOg-Ps-YH4" firstAttribute="leading" secondItem="lia-DA-sOa" secondAttribute="leading" priority="250" id="mU9-yf-vga"/>
|
||||
<constraint firstItem="fZN-J3-A1c" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="nVn-y5-wFx"/>
|
||||
<constraint firstItem="hOg-Ps-YH4" firstAttribute="top" secondItem="lia-DA-sOa" secondAttribute="bottom" priority="250" constant="4" id="ne6-qS-gOV"/>
|
||||
<constraint firstItem="lia-DA-sOa" firstAttribute="leading" secondItem="eHW-h6-k3U" secondAttribute="trailing" id="sEk-K9-5ox"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lia-DA-sOa" secondAttribute="trailing" priority="250" constant="8" id="zjM-Hg-INM"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="hoursClosedLabel" destination="lia-DA-sOa" id="tUx-Cy-R9r"/>
|
||||
<outlet property="hoursClosedTrailing" destination="zjM-Hg-INM" id="QKd-Py-tbi"/>
|
||||
<outlet property="timeSpanHorizontalAlignment" destination="mU9-yf-vga" id="k7T-pi-YAP"/>
|
||||
<outlet property="timeSpanLabel" destination="hOg-Ps-YH4" id="dyB-M5-ePt"/>
|
||||
<outlet property="timeSpanVerticalAlignment" destination="ne6-qS-gOV" id="i2Q-La-wrT"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="ic_clear_sys" width="28" height="28"/>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursDaysSelectorTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
#import "MWMOpeningHoursDaysSelectorTableViewCell.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
@interface MWMOpeningHoursDaysSelectorTableViewCell ()
|
||||
|
||||
@property (nonatomic) IBOutletCollection(UIButton) NSArray * buttons;
|
||||
@property (nonatomic) IBOutletCollection(UILabel) NSArray * labels;
|
||||
@property (nonatomic) IBOutletCollection(UIImageView) NSArray * images;
|
||||
|
||||
@property (nonatomic) NSUInteger firstWeekday;
|
||||
|
||||
@end
|
||||
|
||||
using namespace osmoh;
|
||||
|
||||
@implementation MWMOpeningHoursDaysSelectorTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 76.0;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
NSCalendar * cal = NSCalendar.currentCalendar;
|
||||
cal.locale = NSLocale.currentLocale;
|
||||
self.firstWeekday = cal.firstWeekday;
|
||||
NSArray<NSString *> * weekdaySymbols = cal.shortStandaloneWeekdaySymbols;
|
||||
for (UILabel * label in self.labels)
|
||||
{
|
||||
label.text = weekdaySymbols[[self tag2SymbolIndex:label.tag]];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSUInteger)tag2SymbolIndex:(NSUInteger)tag
|
||||
{
|
||||
NSUInteger idx = tag + self.firstWeekday - 1;
|
||||
NSUInteger const weekDaysCount = 7;
|
||||
if (idx >= weekDaysCount)
|
||||
idx -= weekDaysCount;
|
||||
return idx;
|
||||
}
|
||||
|
||||
- (Weekday)tag2Weekday:(NSUInteger)tag
|
||||
{
|
||||
return static_cast<Weekday>([self tag2SymbolIndex:tag] + 1);
|
||||
}
|
||||
|
||||
- (void)makeDay:(NSUInteger)tag selected:(BOOL)selected refresh:(BOOL)refresh
|
||||
{
|
||||
if (refresh)
|
||||
{
|
||||
Weekday const wd = [self tag2Weekday:tag];
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
if (selected)
|
||||
[section addSelectedDay:wd];
|
||||
else
|
||||
[section removeSelectedDay:wd];
|
||||
}
|
||||
for (UIButton * btn in self.buttons)
|
||||
{
|
||||
if (btn.tag == tag)
|
||||
btn.selected = selected;
|
||||
}
|
||||
for (UILabel * label in self.labels)
|
||||
{
|
||||
if (label.tag == tag)
|
||||
label.textColor = (selected ? [UIColor blackPrimaryText] : [UIColor blackHintText]);
|
||||
}
|
||||
for (UIImageView * image in self.images)
|
||||
{
|
||||
if (image.tag == tag)
|
||||
{
|
||||
image.image = [UIImage imageNamed:selected ? @"radioBtnOn" : @"radioBtnOff"];
|
||||
[image setStyleNameAndApply: selected ? @"MWMBlue" : @"MWMGray"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
for (UILabel * label in self.labels)
|
||||
{
|
||||
NSUInteger const tag = label.tag;
|
||||
BOOL const selected = [self.section containsSelectedDay:[self tag2Weekday:tag]];
|
||||
[self makeDay:tag selected:selected refresh:NO];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)selectDay:(UIButton *)sender
|
||||
{
|
||||
[self makeDay:sender.tag selected:!sender.isSelected refresh:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,427 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="76" id="KGk-i7-Jjw" customClass="MWMOpeningHoursDaysSelectorTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="76"/>
|
||||
<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="76"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CCr-vZ-lZV" userLabel="Day#1">
|
||||
<rect key="frame" x="16" y="0.0" width="41" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tQj-bk-oM9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="9i4-jY-OM3"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="brZ-af-NfP">
|
||||
<rect key="frame" x="0.0" y="12" width="41" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="eN6-Is-HP5">
|
||||
<rect key="frame" x="9.5" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="6PM-WV-5ha"/>
|
||||
<constraint firstAttribute="width" constant="22" id="Wid-uC-2rb"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="brZ-af-NfP" firstAttribute="top" secondItem="CCr-vZ-lZV" secondAttribute="top" constant="12" id="4Tb-B7-xF1"/>
|
||||
<constraint firstItem="tQj-bk-oM9" firstAttribute="leading" secondItem="CCr-vZ-lZV" secondAttribute="leading" id="5sp-pU-VqX"/>
|
||||
<constraint firstAttribute="bottom" secondItem="tQj-bk-oM9" secondAttribute="bottom" id="Flv-li-zyy"/>
|
||||
<constraint firstItem="brZ-af-NfP" firstAttribute="leading" secondItem="CCr-vZ-lZV" secondAttribute="leading" id="b0u-K1-vTb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="tQj-bk-oM9" secondAttribute="trailing" id="hDV-MS-mRl"/>
|
||||
<constraint firstAttribute="trailing" secondItem="brZ-af-NfP" secondAttribute="trailing" id="i2d-9N-WXl"/>
|
||||
<constraint firstItem="eN6-Is-HP5" firstAttribute="centerX" secondItem="CCr-vZ-lZV" secondAttribute="centerX" id="iez-0J-YL1"/>
|
||||
<constraint firstItem="eN6-Is-HP5" firstAttribute="top" secondItem="brZ-af-NfP" secondAttribute="bottom" constant="8" id="rZo-zS-ly1"/>
|
||||
<constraint firstItem="tQj-bk-oM9" firstAttribute="top" secondItem="CCr-vZ-lZV" secondAttribute="top" id="z4X-lt-MRQ"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d7U-Vz-ZXn" userLabel="Day#2">
|
||||
<rect key="frame" x="57" y="0.0" width="41.5" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7fE-x8-2Vl">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41.5" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="zPb-wt-0Cz"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" tag="1" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="TX4-wv-r7d">
|
||||
<rect key="frame" x="0.0" y="12" width="41.5" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" tag="1" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="PA6-gY-SsH">
|
||||
<rect key="frame" x="9.5" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="ACp-b4-BbL"/>
|
||||
<constraint firstAttribute="width" constant="22" id="PHS-nj-MJ1"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="TX4-wv-r7d" firstAttribute="top" secondItem="d7U-Vz-ZXn" secondAttribute="top" constant="12" id="3Os-r4-IV4"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7fE-x8-2Vl" secondAttribute="trailing" id="9kd-YQ-iqd"/>
|
||||
<constraint firstItem="7fE-x8-2Vl" firstAttribute="leading" secondItem="d7U-Vz-ZXn" secondAttribute="leading" id="EE7-5x-SsE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="TX4-wv-r7d" secondAttribute="trailing" id="FzE-0n-OB0"/>
|
||||
<constraint firstItem="PA6-gY-SsH" firstAttribute="top" secondItem="TX4-wv-r7d" secondAttribute="bottom" constant="8" id="LZb-fg-8V8"/>
|
||||
<constraint firstAttribute="bottom" secondItem="7fE-x8-2Vl" secondAttribute="bottom" id="Rwg-cY-7Rp"/>
|
||||
<constraint firstItem="7fE-x8-2Vl" firstAttribute="top" secondItem="d7U-Vz-ZXn" secondAttribute="top" id="dmg-IY-kyu"/>
|
||||
<constraint firstItem="PA6-gY-SsH" firstAttribute="centerX" secondItem="d7U-Vz-ZXn" secondAttribute="centerX" id="nuB-5g-8P7"/>
|
||||
<constraint firstItem="TX4-wv-r7d" firstAttribute="leading" secondItem="d7U-Vz-ZXn" secondAttribute="leading" id="uIH-NW-Yob"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="J8L-sr-yWu" userLabel="Day#3">
|
||||
<rect key="frame" x="98.5" y="0.0" width="41" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ocy-4H-ZwH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Nab-Ud-zim"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" tag="2" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="6IK-aQ-W8x">
|
||||
<rect key="frame" x="0.0" y="12" width="41" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" tag="2" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="eLh-R1-Lvc">
|
||||
<rect key="frame" x="9.5" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="0ck-A4-4EU"/>
|
||||
<constraint firstAttribute="width" constant="22" id="OuD-FL-tq0"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Ocy-4H-ZwH" firstAttribute="top" secondItem="J8L-sr-yWu" secondAttribute="top" id="0sk-ua-zdd"/>
|
||||
<constraint firstItem="eLh-R1-Lvc" firstAttribute="top" secondItem="6IK-aQ-W8x" secondAttribute="bottom" constant="8" id="2fp-13-n6h"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6IK-aQ-W8x" secondAttribute="trailing" id="BHD-Pp-LW4"/>
|
||||
<constraint firstItem="6IK-aQ-W8x" firstAttribute="top" secondItem="J8L-sr-yWu" secondAttribute="top" constant="12" id="JQl-98-UDe"/>
|
||||
<constraint firstItem="6IK-aQ-W8x" firstAttribute="leading" secondItem="J8L-sr-yWu" secondAttribute="leading" id="RvV-4c-Mev"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Ocy-4H-ZwH" secondAttribute="bottom" id="gPh-zG-ajh"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Ocy-4H-ZwH" secondAttribute="trailing" id="mZP-f1-Frz"/>
|
||||
<constraint firstItem="Ocy-4H-ZwH" firstAttribute="leading" secondItem="J8L-sr-yWu" secondAttribute="leading" id="qxq-5J-8be"/>
|
||||
<constraint firstItem="eLh-R1-Lvc" firstAttribute="centerX" secondItem="J8L-sr-yWu" secondAttribute="centerX" id="vJl-bp-Rdn"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8q8-c5-QBM" userLabel="Day#4">
|
||||
<rect key="frame" x="139.5" y="0.0" width="41" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Pmq-0T-6ND">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="PZT-nD-iid"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" tag="3" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="gSE-qV-osv">
|
||||
<rect key="frame" x="0.0" y="12" width="41" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="IVB-FW-ULI">
|
||||
<rect key="frame" x="9.5" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="rkz-jd-7Vx"/>
|
||||
<constraint firstAttribute="width" constant="22" id="zeP-ls-q95"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="Pmq-0T-6ND" secondAttribute="trailing" id="FKK-TY-xSz"/>
|
||||
<constraint firstItem="IVB-FW-ULI" firstAttribute="centerX" secondItem="8q8-c5-QBM" secondAttribute="centerX" id="Jgi-xs-3J6"/>
|
||||
<constraint firstItem="IVB-FW-ULI" firstAttribute="top" secondItem="gSE-qV-osv" secondAttribute="bottom" constant="8" id="OQT-Tr-My1"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gSE-qV-osv" secondAttribute="trailing" id="RH3-SD-kbf"/>
|
||||
<constraint firstItem="Pmq-0T-6ND" firstAttribute="top" secondItem="8q8-c5-QBM" secondAttribute="top" id="aYK-b7-hF0"/>
|
||||
<constraint firstItem="Pmq-0T-6ND" firstAttribute="leading" secondItem="8q8-c5-QBM" secondAttribute="leading" id="diE-wI-FSD"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Pmq-0T-6ND" secondAttribute="bottom" id="hpD-TJ-qGT"/>
|
||||
<constraint firstItem="gSE-qV-osv" firstAttribute="leading" secondItem="8q8-c5-QBM" secondAttribute="leading" id="hxl-Gc-Ey0"/>
|
||||
<constraint firstItem="gSE-qV-osv" firstAttribute="top" secondItem="8q8-c5-QBM" secondAttribute="top" constant="12" id="lfH-66-upM"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="15A-tH-C45" userLabel="Day#5">
|
||||
<rect key="frame" x="180.5" y="0.0" width="41" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Otc-DJ-XJQ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Fgx-45-oKW"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" tag="4" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="JHH-2W-e7Q">
|
||||
<rect key="frame" x="0.0" y="12" width="41" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" tag="4" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="WaR-h2-4mE">
|
||||
<rect key="frame" x="9.5" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="22" id="2WN-hW-NfA"/>
|
||||
<constraint firstAttribute="height" constant="22" id="paI-VA-gTy"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="Otc-DJ-XJQ" secondAttribute="bottom" id="8rG-g5-oib"/>
|
||||
<constraint firstItem="WaR-h2-4mE" firstAttribute="top" secondItem="JHH-2W-e7Q" secondAttribute="bottom" constant="8" id="EUf-Hh-CZk"/>
|
||||
<constraint firstItem="JHH-2W-e7Q" firstAttribute="leading" secondItem="15A-tH-C45" secondAttribute="leading" id="HJ5-tT-Z3E"/>
|
||||
<constraint firstItem="JHH-2W-e7Q" firstAttribute="top" secondItem="15A-tH-C45" secondAttribute="top" constant="12" id="Qmm-tS-5nK"/>
|
||||
<constraint firstItem="Otc-DJ-XJQ" firstAttribute="leading" secondItem="15A-tH-C45" secondAttribute="leading" id="TMg-gA-iyJ"/>
|
||||
<constraint firstItem="WaR-h2-4mE" firstAttribute="centerX" secondItem="15A-tH-C45" secondAttribute="centerX" id="Ub0-7c-gNn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Otc-DJ-XJQ" secondAttribute="trailing" id="X8Z-eo-2rO"/>
|
||||
<constraint firstItem="Otc-DJ-XJQ" firstAttribute="top" secondItem="15A-tH-C45" secondAttribute="top" id="jmD-7s-O2V"/>
|
||||
<constraint firstAttribute="trailing" secondItem="JHH-2W-e7Q" secondAttribute="trailing" id="ns8-PY-dck"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tqf-QU-RCZ" userLabel="Day#6">
|
||||
<rect key="frame" x="221.5" y="0.0" width="41.5" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kid-OJ-nOc">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41.5" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Viw-8h-SMl"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" tag="5" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="F0Z-Fk-0s9">
|
||||
<rect key="frame" x="0.0" y="12" width="41.5" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" tag="5" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="Qo3-ii-YnF">
|
||||
<rect key="frame" x="10" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="22" id="9Ya-Qr-OeU"/>
|
||||
<constraint firstAttribute="height" constant="22" id="jS5-JM-9BC"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Kid-OJ-nOc" firstAttribute="leading" secondItem="Tqf-QU-RCZ" secondAttribute="leading" id="4op-ZK-yva"/>
|
||||
<constraint firstItem="F0Z-Fk-0s9" firstAttribute="leading" secondItem="Tqf-QU-RCZ" secondAttribute="leading" id="H7T-aM-96w"/>
|
||||
<constraint firstItem="F0Z-Fk-0s9" firstAttribute="top" secondItem="Tqf-QU-RCZ" secondAttribute="top" constant="12" id="R78-3k-Sfz"/>
|
||||
<constraint firstItem="Qo3-ii-YnF" firstAttribute="centerX" secondItem="Tqf-QU-RCZ" secondAttribute="centerX" id="YGK-VR-Te1"/>
|
||||
<constraint firstItem="Qo3-ii-YnF" firstAttribute="top" secondItem="F0Z-Fk-0s9" secondAttribute="bottom" constant="8" id="ZHq-Ok-ieq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="F0Z-Fk-0s9" secondAttribute="trailing" id="cCr-SP-3Ab"/>
|
||||
<constraint firstItem="Kid-OJ-nOc" firstAttribute="top" secondItem="Tqf-QU-RCZ" secondAttribute="top" id="d6T-9c-FKV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Kid-OJ-nOc" secondAttribute="bottom" id="ff1-SR-Ci6"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Kid-OJ-nOc" secondAttribute="trailing" id="tHe-1w-a4t"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lBL-06-25g" userLabel="Day#7">
|
||||
<rect key="frame" x="263" y="0.0" width="41" height="76"/>
|
||||
<subviews>
|
||||
<button opaque="NO" tag="6" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="l5X-og-86Q">
|
||||
<rect key="frame" x="0.0" y="0.0" width="41" height="76"/>
|
||||
<connections>
|
||||
<action selector="selectDay:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="xnf-pU-Pv9"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" tag="6" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Su" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="40" translatesAutoresizingMaskIntoConstraints="NO" id="Nzo-2k-zUZ">
|
||||
<rect key="frame" x="0.0" y="12" width="41" height="20"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" tag="6" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="radioBtnOff" highlightedImage="radioBtnOn" translatesAutoresizingMaskIntoConstraints="NO" id="vIl-li-8uM">
|
||||
<rect key="frame" x="9.5" y="40" width="22" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="D4F-jl-d8J"/>
|
||||
<constraint firstAttribute="width" constant="22" id="nOA-Kh-nx9"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMBlue"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="vIl-li-8uM" firstAttribute="top" secondItem="Nzo-2k-zUZ" secondAttribute="bottom" constant="8" id="5Md-vp-o0X"/>
|
||||
<constraint firstAttribute="bottom" secondItem="l5X-og-86Q" secondAttribute="bottom" id="CGB-N7-ce6"/>
|
||||
<constraint firstItem="vIl-li-8uM" firstAttribute="centerX" secondItem="lBL-06-25g" secondAttribute="centerX" id="Jjk-zY-3C6"/>
|
||||
<constraint firstItem="Nzo-2k-zUZ" firstAttribute="leading" secondItem="lBL-06-25g" secondAttribute="leading" id="LHL-ac-W2r"/>
|
||||
<constraint firstItem="Nzo-2k-zUZ" firstAttribute="top" secondItem="lBL-06-25g" secondAttribute="top" constant="12" id="cAw-kT-cSs"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Nzo-2k-zUZ" secondAttribute="trailing" id="cau-Ip-qka"/>
|
||||
<constraint firstAttribute="trailing" secondItem="l5X-og-86Q" secondAttribute="trailing" id="ftk-0P-Eda"/>
|
||||
<constraint firstItem="l5X-og-86Q" firstAttribute="leading" secondItem="lBL-06-25g" secondAttribute="leading" id="xfC-RT-CxJ"/>
|
||||
<constraint firstItem="l5X-og-86Q" firstAttribute="top" secondItem="lBL-06-25g" secondAttribute="top" id="yir-ep-anV"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="i4V-yS-NEg">
|
||||
<rect key="frame" x="0.0" y="75.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="ebA-bw-LdR"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="131-Pr-FGS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="qnM-sM-4SM"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Tqf-QU-RCZ" firstAttribute="leading" secondItem="15A-tH-C45" secondAttribute="trailing" id="1zj-Fh-hEJ"/>
|
||||
<constraint firstItem="Tqf-QU-RCZ" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="2wt-Fw-elF"/>
|
||||
<constraint firstItem="CCr-vZ-lZV" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="4yI-Y2-fGK"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lBL-06-25g" secondAttribute="trailing" constant="16" id="684-Mj-MPT"/>
|
||||
<constraint firstItem="d7U-Vz-ZXn" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="7Kd-9C-rrI"/>
|
||||
<constraint firstItem="d7U-Vz-ZXn" firstAttribute="leading" secondItem="CCr-vZ-lZV" secondAttribute="trailing" id="9BW-il-aHi"/>
|
||||
<constraint firstAttribute="bottom" secondItem="i4V-yS-NEg" secondAttribute="bottom" constant="-0.5" id="Ai5-Rm-yCG"/>
|
||||
<constraint firstItem="8q8-c5-QBM" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="Bc6-d7-0np"/>
|
||||
<constraint firstItem="lBL-06-25g" firstAttribute="leading" secondItem="Tqf-QU-RCZ" secondAttribute="trailing" id="Cjw-Ap-AU1"/>
|
||||
<constraint firstItem="Tqf-QU-RCZ" firstAttribute="width" secondItem="lBL-06-25g" secondAttribute="width" id="EOh-Xy-asn"/>
|
||||
<constraint firstAttribute="bottom" secondItem="8q8-c5-QBM" secondAttribute="bottom" id="FeI-Xq-7qp"/>
|
||||
<constraint firstItem="CCr-vZ-lZV" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="LMf-O6-0za"/>
|
||||
<constraint firstItem="131-Pr-FGS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="MWV-1b-VBO"/>
|
||||
<constraint firstAttribute="bottom" secondItem="lBL-06-25g" secondAttribute="bottom" id="Mif-uK-Glu"/>
|
||||
<constraint firstItem="8q8-c5-QBM" firstAttribute="leading" secondItem="J8L-sr-yWu" secondAttribute="trailing" id="OhY-sz-5EG"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Tqf-QU-RCZ" secondAttribute="bottom" id="PLc-Et-DgL"/>
|
||||
<constraint firstAttribute="trailing" secondItem="i4V-yS-NEg" secondAttribute="trailing" id="QQ4-vc-HVH"/>
|
||||
<constraint firstItem="lBL-06-25g" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="Qst-JA-vhN"/>
|
||||
<constraint firstAttribute="bottom" secondItem="15A-tH-C45" secondAttribute="bottom" id="Rt0-jf-VSs"/>
|
||||
<constraint firstItem="15A-tH-C45" firstAttribute="width" secondItem="Tqf-QU-RCZ" secondAttribute="width" id="StI-Qm-Vr2"/>
|
||||
<constraint firstItem="J8L-sr-yWu" firstAttribute="width" secondItem="8q8-c5-QBM" secondAttribute="width" id="Y8q-0K-tpN"/>
|
||||
<constraint firstItem="i4V-yS-NEg" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="dCf-tV-y5Z"/>
|
||||
<constraint firstAttribute="bottom" secondItem="J8L-sr-yWu" secondAttribute="bottom" id="eO5-aC-qFU"/>
|
||||
<constraint firstItem="15A-tH-C45" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="gOd-8i-R7q"/>
|
||||
<constraint firstAttribute="trailing" secondItem="131-Pr-FGS" secondAttribute="trailing" id="gne-P8-mu2"/>
|
||||
<constraint firstItem="15A-tH-C45" firstAttribute="leading" secondItem="8q8-c5-QBM" secondAttribute="trailing" id="hBC-FV-co6"/>
|
||||
<constraint firstItem="CCr-vZ-lZV" firstAttribute="width" secondItem="d7U-Vz-ZXn" secondAttribute="width" id="hnc-hx-D5T"/>
|
||||
<constraint firstItem="J8L-sr-yWu" firstAttribute="leading" secondItem="d7U-Vz-ZXn" secondAttribute="trailing" id="jbs-xW-KED"/>
|
||||
<constraint firstItem="d7U-Vz-ZXn" firstAttribute="width" secondItem="J8L-sr-yWu" secondAttribute="width" id="n3E-ch-hIY"/>
|
||||
<constraint firstAttribute="bottom" secondItem="d7U-Vz-ZXn" secondAttribute="bottom" id="r4p-8g-HHw"/>
|
||||
<constraint firstItem="8q8-c5-QBM" firstAttribute="width" secondItem="15A-tH-C45" secondAttribute="width" id="tLl-N7-MHZ"/>
|
||||
<constraint firstItem="131-Pr-FGS" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="wM0-sy-1Sy"/>
|
||||
<constraint firstItem="J8L-sr-yWu" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="y7s-Ip-YCm"/>
|
||||
<constraint firstAttribute="bottom" secondItem="CCr-vZ-lZV" secondAttribute="bottom" id="zPu-9q-ZMS"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outletCollection property="buttons" destination="tQj-bk-oM9" id="pbb-m3-HUd"/>
|
||||
<outletCollection property="buttons" destination="7fE-x8-2Vl" id="TmQ-vt-r6l"/>
|
||||
<outletCollection property="buttons" destination="Ocy-4H-ZwH" id="2bS-QH-S0k"/>
|
||||
<outletCollection property="buttons" destination="Pmq-0T-6ND" id="nnb-lP-2YI"/>
|
||||
<outletCollection property="buttons" destination="Otc-DJ-XJQ" id="LRt-yc-uL5"/>
|
||||
<outletCollection property="buttons" destination="Kid-OJ-nOc" id="35j-cH-m6c"/>
|
||||
<outletCollection property="buttons" destination="l5X-og-86Q" id="WuX-FB-cM4"/>
|
||||
<outletCollection property="labels" destination="brZ-af-NfP" id="fcY-bQ-CtM"/>
|
||||
<outletCollection property="labels" destination="TX4-wv-r7d" id="13b-5d-3SZ"/>
|
||||
<outletCollection property="labels" destination="6IK-aQ-W8x" id="SBl-jh-pr8"/>
|
||||
<outletCollection property="labels" destination="gSE-qV-osv" id="Arl-Nm-RJF"/>
|
||||
<outletCollection property="labels" destination="JHH-2W-e7Q" id="MjO-dj-2Sh"/>
|
||||
<outletCollection property="labels" destination="F0Z-Fk-0s9" id="Bdy-1N-ZAu"/>
|
||||
<outletCollection property="labels" destination="Nzo-2k-zUZ" id="4Le-5S-4MH"/>
|
||||
<outletCollection property="images" destination="eN6-Is-HP5" id="7X9-ac-EXy"/>
|
||||
<outletCollection property="images" destination="PA6-gY-SsH" id="zQC-LG-juN"/>
|
||||
<outletCollection property="images" destination="eLh-R1-Lvc" id="7JR-kO-NXC"/>
|
||||
<outletCollection property="images" destination="IVB-FW-ULI" id="2hg-XH-3ij"/>
|
||||
<outletCollection property="images" destination="WaR-h2-4mE" id="ipy-v0-dHA"/>
|
||||
<outletCollection property="images" destination="Qo3-ii-YnF" id="gtk-HH-8Z7"/>
|
||||
<outletCollection property="images" destination="vIl-li-8uM" id="tE0-YJ-8Rh"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="radioBtnOff" width="22" height="22"/>
|
||||
<image name="radioBtnOn" width="22" height="22"/>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursDeleteScheduleTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
#import "MWMOpeningHoursDeleteScheduleTableViewCell.h"
|
||||
|
||||
@implementation MWMOpeningHoursDeleteScheduleTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 44.0;
|
||||
}
|
||||
|
||||
- (IBAction)deleteScheduleTap
|
||||
{
|
||||
[self.section deleteSchedule];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="MWMOpeningHoursDeleteScheduleTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<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="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6sA-sN-4Dk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<state key="normal" title="Delete Schedule">
|
||||
<color key="titleColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="FlatRedTransButtonBig"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_time_delete"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="deleteScheduleTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Wrd-G9-gDM"/>
|
||||
</connections>
|
||||
</button>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="pwt-wM-TFm">
|
||||
<rect key="frame" x="0.0" y="43.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="uj7-UU-MSZ"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="6sA-sN-4Dk" secondAttribute="bottom" id="HqD-nd-D5C"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6sA-sN-4Dk" secondAttribute="trailing" id="ajb-sy-7f6"/>
|
||||
<constraint firstItem="6sA-sN-4Dk" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="fyt-5F-eSU"/>
|
||||
<constraint firstItem="pwt-wM-TFm" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="jD1-ee-pdn"/>
|
||||
<constraint firstAttribute="bottom" secondItem="pwt-wM-TFm" secondAttribute="bottom" constant="-0.5" id="jr1-UN-iiO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="pwt-wM-TFm" secondAttribute="trailing" id="uAP-Dw-Gir"/>
|
||||
<constraint firstItem="6sA-sN-4Dk" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="ywG-MR-eI2"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#import "MWMOpeningHoursSection.h"
|
||||
#import "MWMTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursTableViewCell : MWMTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width;
|
||||
|
||||
@property (nonatomic, readonly) NSUInteger row;
|
||||
@property (weak, nonatomic) MWMOpeningHoursSection * section;
|
||||
@property (nonatomic) NSIndexPath * indexPathAtInit;
|
||||
@property (nonatomic, readonly) BOOL isVisible;
|
||||
|
||||
- (void)hide;
|
||||
|
||||
- (void)refresh;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@implementation MWMOpeningHoursTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
|
||||
{
|
||||
}
|
||||
|
||||
- (void)hide
|
||||
{
|
||||
self.alpha = 0.0;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
self.alpha = 1.0;
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setSection:(MWMOpeningHoursSection *)section
|
||||
{
|
||||
_section = section;
|
||||
[self refresh];
|
||||
}
|
||||
|
||||
- (NSUInteger)row
|
||||
{
|
||||
UITableView * tableView = self.section.delegate.tableView;
|
||||
NSIndexPath * indexPath = [tableView indexPathForCell:self];
|
||||
if (!indexPath)
|
||||
indexPath = self.indexPathAtInit;
|
||||
return indexPath.row;
|
||||
}
|
||||
|
||||
- (BOOL)isVisible
|
||||
{
|
||||
UITableView * tableView = self.section.delegate.tableView;
|
||||
return [tableView indexPathForCell:self] != nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursTimeSelectorTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
#import "MWMOpeningHoursTimeSelectorTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursTimeSelectorTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIDatePicker * openTimePicker;
|
||||
@property (weak, nonatomic) IBOutlet UIDatePicker * closeTimePicker;
|
||||
|
||||
@property (nonatomic) NSCalendar * calendar;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursTimeSelectorTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 180.0;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
self.calendar = NSCalendar.currentCalendar;
|
||||
self.calendar.locale = NSLocale.currentLocale;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
NSUInteger const row = section.selectedRow.unsignedIntegerValue;
|
||||
NSDate * openDate = [self.calendar dateFromComponents:[section timeForRow:row isStart:YES]];
|
||||
NSDate * closeDate = [self.calendar dateFromComponents:[section timeForRow:row isStart:NO]];
|
||||
|
||||
[self.openTimePicker setDate:openDate animated:NO];
|
||||
[self.closeTimePicker setDate:closeDate animated:NO];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)openValueChanged
|
||||
{
|
||||
NSDate * date = self.openTimePicker.date;
|
||||
NSCalendarUnit const components = NSCalendarUnitHour | NSCalendarUnitMinute;
|
||||
self.section.cachedStartTime = [self.calendar components:components fromDate:date];
|
||||
}
|
||||
|
||||
- (IBAction)closeValueChanged
|
||||
{
|
||||
NSDate * date = self.closeTimePicker.date;
|
||||
NSCalendarUnit const components = NSCalendarUnitHour | NSCalendarUnitMinute;
|
||||
self.section.cachedEndTime = [self.calendar components:components fromDate:date];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="180" id="KGk-i7-Jjw" customClass="MWMOpeningHoursTimeSelectorTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="180"/>
|
||||
<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="180"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<datePicker contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" datePickerMode="time" minuteInterval="5" style="wheels" translatesAutoresizingMaskIntoConstraints="NO" id="GQP-ns-cE1">
|
||||
<rect key="frame" x="16" y="0.0" width="128" height="180"/>
|
||||
<locale key="locale" localeIdentifier="ru"/>
|
||||
<connections>
|
||||
<action selector="openValueChanged" destination="KGk-i7-Jjw" eventType="valueChanged" id="abn-DQ-iYH"/>
|
||||
</connections>
|
||||
</datePicker>
|
||||
<datePicker contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" datePickerMode="time" minuteInterval="5" style="wheels" translatesAutoresizingMaskIntoConstraints="NO" id="w7f-Rh-vzg">
|
||||
<rect key="frame" x="176" y="0.0" width="128" height="180"/>
|
||||
<locale key="locale" localeIdentifier="ru"/>
|
||||
<connections>
|
||||
<action selector="closeValueChanged" destination="KGk-i7-Jjw" eventType="valueChanged" id="dwu-wx-oRQ"/>
|
||||
</connections>
|
||||
</datePicker>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=":" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="8" translatesAutoresizingMaskIntoConstraints="NO" id="6b2-fN-HrU">
|
||||
<rect key="frame" x="72" y="79.5" width="8" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="CFL-td-w0X"/>
|
||||
<constraint firstAttribute="width" constant="8" id="YVE-JC-Z8n"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="21"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="—" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="24" translatesAutoresizingMaskIntoConstraints="NO" id="ArA-iX-w8F">
|
||||
<rect key="frame" x="148" y="79.5" width="24" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="24" id="CeN-3u-tRz"/>
|
||||
<constraint firstAttribute="height" constant="21" id="oBr-Rr-mKP"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="21"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=":" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="8" translatesAutoresizingMaskIntoConstraints="NO" id="MQr-gL-ImO">
|
||||
<rect key="frame" x="232" y="79.5" width="8" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="8" id="KIB-6H-1UD"/>
|
||||
<constraint firstAttribute="height" constant="21" id="Xad-ok-Mz7"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="21"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="rOS-aO-0gb">
|
||||
<rect key="frame" x="0.0" y="179.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="etc-9t-7gU"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="MQr-gL-ImO" firstAttribute="centerX" secondItem="w7f-Rh-vzg" secondAttribute="centerX" constant="-4" id="1aM-UN-taw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="rOS-aO-0gb" secondAttribute="bottom" constant="-0.5" id="48x-fh-WrH"/>
|
||||
<constraint firstItem="6b2-fN-HrU" firstAttribute="centerY" secondItem="GQP-ns-cE1" secondAttribute="centerY" id="CFO-NC-K5i"/>
|
||||
<constraint firstItem="MQr-gL-ImO" firstAttribute="centerY" secondItem="w7f-Rh-vzg" secondAttribute="centerY" id="IAa-cP-AKa"/>
|
||||
<constraint firstItem="ArA-iX-w8F" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="Jwt-Hj-rB5"/>
|
||||
<constraint firstAttribute="bottom" secondItem="GQP-ns-cE1" secondAttribute="bottom" id="MD6-2s-qbb"/>
|
||||
<constraint firstItem="GQP-ns-cE1" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" multiplier="1:2" id="TAR-AD-a1X"/>
|
||||
<constraint firstItem="GQP-ns-cE1" firstAttribute="width" secondItem="H2p-sc-9uM" secondAttribute="width" multiplier="0.4" id="TeT-Yf-UeO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="rOS-aO-0gb" secondAttribute="trailing" id="W3v-cq-ONy"/>
|
||||
<constraint firstItem="w7f-Rh-vzg" firstAttribute="width" secondItem="H2p-sc-9uM" secondAttribute="width" multiplier="0.4" id="fYI-wR-woS"/>
|
||||
<constraint firstAttribute="bottom" secondItem="w7f-Rh-vzg" secondAttribute="bottom" id="hf6-7a-fuy"/>
|
||||
<constraint firstItem="GQP-ns-cE1" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="jAC-6F-GVz"/>
|
||||
<constraint firstItem="w7f-Rh-vzg" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" multiplier="3:2" id="kaE-sT-Ycx"/>
|
||||
<constraint firstItem="w7f-Rh-vzg" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="ke4-wU-x0k"/>
|
||||
<constraint firstItem="6b2-fN-HrU" firstAttribute="centerX" secondItem="GQP-ns-cE1" secondAttribute="centerX" constant="-4" id="nzt-Rr-b0u"/>
|
||||
<constraint firstItem="rOS-aO-0gb" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="t8r-sp-fRg"/>
|
||||
<constraint firstItem="ArA-iX-w8F" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="zKO-lN-XyI"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="closeTimePicker" destination="w7f-Rh-vzg" id="jdP-dK-pwF"/>
|
||||
<outlet property="openTimePicker" destination="GQP-ns-cE1" id="qnP-We-WvA"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursTimeSpanTableViewCell : MWMOpeningHoursTableViewCell
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
#import "MWMOpeningHoursTimeSpanTableViewCell.h"
|
||||
|
||||
@interface MWMOpeningHoursTimeSpanTableViewCell ()
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel * openTimeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel * closeTimeLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursTimeSpanTableViewCell
|
||||
|
||||
+ (CGFloat)heightForWidth:(CGFloat)width
|
||||
{
|
||||
return 64.0;
|
||||
}
|
||||
|
||||
- (void)refresh
|
||||
{
|
||||
[super refresh];
|
||||
NSCalendar * calendar = NSCalendar.currentCalendar;
|
||||
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
NSUInteger const row = self.row;
|
||||
NSDate * openDate = [calendar dateFromComponents:[section timeForRow:row isStart:YES]];
|
||||
NSDate * closeDate = [calendar dateFromComponents:[section timeForRow:row isStart:NO]];
|
||||
|
||||
NSDateFormatterStyle timeStyle = NSDateFormatterShortStyle;
|
||||
NSDateFormatterStyle dateStyle = NSDateFormatterNoStyle;
|
||||
self.openTimeLabel.text = [DateTimeFormatter dateStringFrom:openDate dateStyle:dateStyle timeStyle:timeStyle];
|
||||
self.closeTimeLabel.text = [DateTimeFormatter dateStringFrom:closeDate dateStyle:dateStyle timeStyle:timeStyle];
|
||||
|
||||
UIColor * clr = [section isRowSelected:row] ? [UIColor linkBlue] : [UIColor blackSecondaryText];
|
||||
self.openTimeLabel.textColor = clr;
|
||||
self.closeTimeLabel.textColor = clr;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)expandTap
|
||||
{
|
||||
if (self.isVisible)
|
||||
{
|
||||
MWMOpeningHoursSection * section = self.section;
|
||||
NSUInteger const row = self.row;
|
||||
section.selectedRow = [section isRowSelected:row] ? nil : @(row);
|
||||
[section refresh:NO];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="64" id="KGk-i7-Jjw" customClass="MWMOpeningHoursTimeSpanTableViewCell" propertyAccessControl="none">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="64"/>
|
||||
<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="64"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Open time" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="128" translatesAutoresizingMaskIntoConstraints="NO" id="CgC-lU-buo">
|
||||
<rect key="frame" x="16" y="12" width="131.5" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackPrimaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_time_open"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="8:00" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="128" translatesAutoresizingMaskIntoConstraints="NO" id="CuG-0G-4pB">
|
||||
<rect key="frame" x="16" y="32" width="131.5" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.1176470588" green="0.58823529409999997" blue="0.94117647059999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:linkBlueText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="oux-nC-xpk" userLabel="VerticalSeparator">
|
||||
<rect key="frame" x="159.5" y="0.0" width="1" height="64"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.12" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="1" id="1m4-5Q-ym8"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Divider"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Close time" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="127" translatesAutoresizingMaskIntoConstraints="NO" id="cGX-Q7-Ddh">
|
||||
<rect key="frame" x="176.5" y="12" width="127.5" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular14:blackPrimaryText"/>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="localizedText" value="editor_time_close"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="20:30" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="127" translatesAutoresizingMaskIntoConstraints="NO" id="o59-Hp-LIf">
|
||||
<rect key="frame" x="176.5" y="32" width="127.5" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="regular17:linkBlueText"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="separator_image" translatesAutoresizingMaskIntoConstraints="NO" id="qsf-WG-QJW">
|
||||
<rect key="frame" x="0.0" y="63.5" width="320" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="Pfd-8E-gxy"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="MWMSeparator"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jNP-mE-elz" userLabel="Expand Button">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="64"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<action selector="expandTap" destination="KGk-i7-Jjw" eventType="touchUpInside" id="La8-XF-Fnv"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="oux-nC-xpk" secondAttribute="bottom" id="5IL-Ia-kot"/>
|
||||
<constraint firstItem="oux-nC-xpk" firstAttribute="leading" secondItem="CgC-lU-buo" secondAttribute="trailing" constant="12" id="6mt-ZU-wDQ"/>
|
||||
<constraint firstItem="o59-Hp-LIf" firstAttribute="top" secondItem="cGX-Q7-Ddh" secondAttribute="bottom" constant="4" id="9lg-5H-iWb"/>
|
||||
<constraint firstItem="qsf-WG-QJW" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="AD8-yB-pdV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="jNP-mE-elz" secondAttribute="bottom" id="FLC-q7-gpV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jNP-mE-elz" secondAttribute="trailing" id="HAn-uc-gIX"/>
|
||||
<constraint firstItem="jNP-mE-elz" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Jaw-Pm-p8E"/>
|
||||
<constraint firstItem="CgC-lU-buo" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="Ji6-6i-Iuz"/>
|
||||
<constraint firstItem="CuG-0G-4pB" firstAttribute="top" secondItem="CgC-lU-buo" secondAttribute="bottom" constant="4" id="NbX-uq-7HO"/>
|
||||
<constraint firstItem="oux-nC-xpk" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="OIR-lX-7FF"/>
|
||||
<constraint firstItem="oux-nC-xpk" firstAttribute="leading" secondItem="CuG-0G-4pB" secondAttribute="trailing" constant="12" id="T0l-Xe-jBq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="cGX-Q7-Ddh" secondAttribute="trailing" constant="16" id="UPX-QC-I2L"/>
|
||||
<constraint firstItem="CuG-0G-4pB" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="VZc-gy-4dr"/>
|
||||
<constraint firstItem="jNP-mE-elz" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="Y32-SZ-Ap1"/>
|
||||
<constraint firstItem="o59-Hp-LIf" firstAttribute="leading" secondItem="oux-nC-xpk" secondAttribute="trailing" constant="16" id="cvy-Bd-TWo"/>
|
||||
<constraint firstAttribute="bottom" secondItem="qsf-WG-QJW" secondAttribute="bottom" constant="-0.5" id="fwf-rw-9k6"/>
|
||||
<constraint firstItem="cGX-Q7-Ddh" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="jXv-Nx-MES"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qsf-WG-QJW" secondAttribute="trailing" id="mle-r1-uUX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="o59-Hp-LIf" secondAttribute="trailing" constant="16" id="oYK-KJ-Asi"/>
|
||||
<constraint firstItem="oux-nC-xpk" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="qpb-DW-pu0"/>
|
||||
<constraint firstItem="CgC-lU-buo" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="rji-cJ-629"/>
|
||||
<constraint firstItem="cGX-Q7-Ddh" firstAttribute="leading" secondItem="oux-nC-xpk" secondAttribute="trailing" constant="16" id="xCE-ly-lub"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</tableViewCellContentView>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="string" keyPath="styleName" value="Background"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="closeTimeLabel" destination="o59-Hp-LIf" id="U3D-MI-UR4"/>
|
||||
<outlet property="openTimeLabel" destination="CuG-0G-4pB" id="aDq-t8-Eag"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="139" y="155"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="separator_image" width="1" height="1"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
typedef NS_ENUM (NSUInteger, MWMOpeningHoursEditorCells)
|
||||
{
|
||||
MWMOpeningHoursEditorDaysSelectorCell,
|
||||
MWMOpeningHoursEditorAllDayCell,
|
||||
MWMOpeningHoursEditorTimeSpanCell,
|
||||
MWMOpeningHoursEditorTimeSelectorCell,
|
||||
MWMOpeningHoursEditorClosedSpanCell,
|
||||
MWMOpeningHoursEditorAddClosedCell,
|
||||
MWMOpeningHoursEditorDeleteScheduleCell,
|
||||
MWMOpeningHoursEditorAddScheduleCell
|
||||
};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#import "MWMViewController.h"
|
||||
|
||||
@protocol MWMOpeningHoursEditorProtocol <NSObject>
|
||||
|
||||
- (void)setOpeningHours:(NSString *)openingHours;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMOpeningHoursEditorViewController : MWMViewController
|
||||
|
||||
@property (copy, nonatomic) NSString * openingHours;
|
||||
@property (weak, nonatomic) id<MWMOpeningHoursEditorProtocol> delegate;
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
#import "MWMOpeningHoursEditorViewController.h"
|
||||
#import "MWMOpeningHoursAddClosedTableViewCell.h"
|
||||
#import "MWMOpeningHoursAddScheduleTableViewCell.h"
|
||||
#import "MWMOpeningHoursAllDayTableViewCell.h"
|
||||
#import "MWMOpeningHoursClosedSpanTableViewCell.h"
|
||||
#import "MWMOpeningHoursDaysSelectorTableViewCell.h"
|
||||
#import "MWMOpeningHoursDeleteScheduleTableViewCell.h"
|
||||
#import "MWMOpeningHoursTimeSelectorTableViewCell.h"
|
||||
#import "MWMOpeningHoursTimeSpanTableViewCell.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
extern NSDictionary * const kMWMOpeningHoursEditorTableCells = @{
|
||||
@(MWMOpeningHoursEditorDaysSelectorCell) : [MWMOpeningHoursDaysSelectorTableViewCell class],
|
||||
@(MWMOpeningHoursEditorAllDayCell) : [MWMOpeningHoursAllDayTableViewCell class],
|
||||
@(MWMOpeningHoursEditorTimeSpanCell) : [MWMOpeningHoursTimeSpanTableViewCell class],
|
||||
@(MWMOpeningHoursEditorTimeSelectorCell) : [MWMOpeningHoursTimeSelectorTableViewCell class],
|
||||
@(MWMOpeningHoursEditorClosedSpanCell) : [MWMOpeningHoursClosedSpanTableViewCell class],
|
||||
@(MWMOpeningHoursEditorAddClosedCell) : [MWMOpeningHoursAddClosedTableViewCell class],
|
||||
@(MWMOpeningHoursEditorDeleteScheduleCell) : [MWMOpeningHoursDeleteScheduleTableViewCell class],
|
||||
@(MWMOpeningHoursEditorAddScheduleCell) : [MWMOpeningHoursAddScheduleTableViewCell class],
|
||||
};
|
||||
|
||||
@interface MWMOpeningHoursEditorViewController ()<UITableViewDelegate, UITableViewDataSource,
|
||||
UITextViewDelegate, MWMOpeningHoursModelProtocol>
|
||||
|
||||
@property(weak, nonatomic, readwrite) IBOutlet UITableView * tableView;
|
||||
@property(weak, nonatomic, readwrite) IBOutlet UIView * advancedEditor;
|
||||
@property(weak, nonatomic, readwrite) IBOutlet MWMTextView * editorView;
|
||||
@property(weak, nonatomic) IBOutlet UIView * helpView;
|
||||
@property(weak, nonatomic) IBOutlet WKWebView * help;
|
||||
@property(weak, nonatomic, readwrite) IBOutlet NSLayoutConstraint * ohTextViewHeight;
|
||||
@property(weak, nonatomic) IBOutlet UIView * exampleValuesSeparator;
|
||||
@property(weak, nonatomic) IBOutlet UIImageView * exampleValuesExpandView;
|
||||
@property(weak, nonatomic) IBOutlet NSLayoutConstraint * examplesButtonBottomOffset;
|
||||
@property(weak, nonatomic, readwrite) IBOutlet UIButton * toggleModeButton;
|
||||
|
||||
@property(nonatomic) BOOL exampleExpanded;
|
||||
@property(nonatomic) BOOL isSimpleMode;
|
||||
|
||||
@property(nonatomic) MWMOpeningHoursModel * model;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMOpeningHoursEditorViewController
|
||||
|
||||
- (void)viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
[self configNavBar];
|
||||
[self configTable];
|
||||
[self configAdvancedEditor];
|
||||
[self configData];
|
||||
}
|
||||
|
||||
#pragma mark - Configuration
|
||||
|
||||
- (void)configNavBar
|
||||
{
|
||||
self.title = L(@"editor_time_title");
|
||||
self.navigationItem.rightBarButtonItem =
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
|
||||
target:self
|
||||
action:@selector(onDone)];
|
||||
}
|
||||
|
||||
- (void)configTable
|
||||
{
|
||||
[kMWMOpeningHoursEditorTableCells
|
||||
enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, Class cls, BOOL * _Nonnull stop) {
|
||||
[self.tableView registerNibWithCellClass:cls];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)configAdvancedEditor
|
||||
{
|
||||
[self.editorView setTextContainerInset:{.top = 12, .left = 10, .bottom = 12, .right = 10}];
|
||||
self.editorView.keyboardAppearance =
|
||||
[UIColor isNightMode] ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault;
|
||||
NSString * path =
|
||||
[NSBundle.mainBundle pathForResource:@"opening_hours_how_to_edit" ofType:@"html"];
|
||||
NSString * html =
|
||||
[[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
||||
NSURL * baseURL = [NSURL fileURLWithPath:path];
|
||||
[self.help loadHTMLString:html baseURL:baseURL];
|
||||
}
|
||||
|
||||
- (void)configData
|
||||
{
|
||||
self.model = [[MWMOpeningHoursModel alloc] initWithDelegate:self];
|
||||
self.isSimpleMode = self.model.isSimpleModeCapable;
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (void)onCancel { [self.navigationController popViewControllerAnimated:YES]; }
|
||||
- (void)onDone
|
||||
{
|
||||
[self.model storeCachedData];
|
||||
[self.model updateOpeningHours];
|
||||
[self.delegate setOpeningHours:self.openingHours];
|
||||
[self onCancel];
|
||||
}
|
||||
|
||||
#pragma mark - Table
|
||||
|
||||
- (MWMOpeningHoursEditorCells)cellKeyForIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
if (indexPath.section < self.model.count)
|
||||
return [self.model cellKeyForIndexPath:indexPath];
|
||||
else
|
||||
return MWMOpeningHoursEditorAddScheduleCell;
|
||||
}
|
||||
|
||||
- (CGFloat)heightForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
CGFloat const width = self.view.width;
|
||||
if (indexPath.section < self.model.count)
|
||||
return [self.model heightForIndexPath:indexPath withWidth:width];
|
||||
else
|
||||
return [MWMOpeningHoursAddScheduleTableViewCell height];
|
||||
}
|
||||
|
||||
#pragma mark - Fill cells with data
|
||||
|
||||
- (void)fillCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell
|
||||
atIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
if (!self.parentViewController)
|
||||
return;
|
||||
if (indexPath.section < self.model.count)
|
||||
[self.model fillCell:cell atIndexPath:indexPath];
|
||||
else if ([cell isKindOfClass:[MWMOpeningHoursAddScheduleTableViewCell class]])
|
||||
((MWMOpeningHoursAddScheduleTableViewCell *)cell).model = self.model;
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDataSource
|
||||
|
||||
- (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView
|
||||
cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
Class cls = kMWMOpeningHoursEditorTableCells[@([self cellKeyForIndexPath:indexPath])];
|
||||
auto cell = [tableView dequeueReusableCellWithCellClass:cls indexPath:indexPath];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView * _Nonnull)tableView
|
||||
{
|
||||
if (!self.model.isSimpleMode)
|
||||
return 0;
|
||||
return self.model.count + (self.model.canAddSection ? 1 : 0);
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView * _Nonnull)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return (section < self.model.count ? [self.model numberOfRowsInSection:section] : 1);
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate
|
||||
|
||||
- (CGFloat)tableView:(UITableView * _Nonnull)tableView
|
||||
heightForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
return [self heightForRowAtIndexPath:indexPath];
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView * _Nonnull)tableView
|
||||
estimatedHeightForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
return [self heightForRowAtIndexPath:indexPath];
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView * _Nonnull)tableView
|
||||
willDisplayCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell
|
||||
forRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
[self fillCell:cell atIndexPath:indexPath];
|
||||
}
|
||||
|
||||
#pragma mark - Advanced mode
|
||||
|
||||
- (void)setExampleExpanded:(BOOL)exampleExpanded
|
||||
{
|
||||
_exampleExpanded = exampleExpanded;
|
||||
self.help.hidden = !exampleExpanded;
|
||||
self.examplesButtonBottomOffset.priority =
|
||||
exampleExpanded ? UILayoutPriorityDefaultLow : UILayoutPriorityDefaultHigh;
|
||||
self.exampleValuesSeparator.hidden = !exampleExpanded;
|
||||
self.exampleValuesExpandView.image =
|
||||
[UIImage imageNamed:exampleExpanded ? @"ic_arrow_gray_up" : @"ic_arrow_gray_down"];
|
||||
if (exampleExpanded)
|
||||
[self.editorView resignFirstResponder];
|
||||
else
|
||||
[self.editorView becomeFirstResponder];
|
||||
}
|
||||
|
||||
- (IBAction)toggleExample { self.exampleExpanded = !self.exampleExpanded; }
|
||||
- (IBAction)toggleMode { self.isSimpleMode = !self.isSimpleMode; }
|
||||
#pragma mark - UITextViewDelegate
|
||||
|
||||
- (void)textViewDidChange:(UITextView *)textView
|
||||
{
|
||||
self.openingHours = textView.text;
|
||||
self.navigationItem.rightBarButtonItem.enabled = self.model.isValid;
|
||||
self.toggleModeButton.enabled = self.model.isSimpleModeCapable;
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (void)setIsSimpleMode:(BOOL)isSimpleMode
|
||||
{
|
||||
self.model.isSimpleMode = isSimpleMode;
|
||||
if (!isSimpleMode)
|
||||
self.exampleExpanded = NO;
|
||||
self.toggleModeButton.enabled = self.model.isSimpleModeCapable;
|
||||
}
|
||||
|
||||
- (BOOL)isSimpleMode { return self.model.isSimpleMode; }
|
||||
@end
|
||||
39
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h
Normal file
39
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#import "MWMOpeningHoursEditorCells.h"
|
||||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
#import "MWMTextView.h"
|
||||
|
||||
@protocol MWMOpeningHoursModelProtocol <NSObject>
|
||||
|
||||
@property(nonnull, copy, nonatomic) NSString * openingHours;
|
||||
@property(nullable, weak, nonatomic, readonly) UITableView * tableView;
|
||||
@property(nullable, weak, nonatomic, readonly) UIView * advancedEditor;
|
||||
@property(nullable, weak, nonatomic, readonly) MWMTextView * editorView;
|
||||
@property(nullable, weak, nonatomic, readonly) UIButton * toggleModeButton;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMOpeningHoursModel : NSObject
|
||||
|
||||
@property(nonatomic, readonly) NSUInteger count;
|
||||
@property(nonatomic, readonly) BOOL canAddSection;
|
||||
|
||||
@property(nonatomic, readonly) BOOL isValid;
|
||||
@property(nonatomic) BOOL isSimpleMode;
|
||||
@property(nonatomic, readonly) BOOL isSimpleModeCapable;
|
||||
|
||||
- (instancetype _Nullable)initWithDelegate:(id<MWMOpeningHoursModelProtocol> _Nonnull)delegate;
|
||||
|
||||
- (void)addSchedule;
|
||||
- (void)deleteSchedule:(NSUInteger)index;
|
||||
|
||||
- (MWMOpeningHoursEditorCells)cellKeyForIndexPath:(NSIndexPath * _Nonnull)indexPath;
|
||||
|
||||
- (CGFloat)heightForIndexPath:(NSIndexPath * _Nonnull)indexPath withWidth:(CGFloat)width;
|
||||
- (void)fillCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell atIndexPath:(NSIndexPath * _Nonnull)indexPath;
|
||||
- (NSUInteger)numberOfRowsInSection:(NSUInteger)section;
|
||||
- (editor::ui::OpeningDays)unhandledDays;
|
||||
|
||||
- (void)storeCachedData;
|
||||
- (void)updateOpeningHours;
|
||||
|
||||
@end
|
||||
214
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.mm
Normal file
214
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursModel.mm
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
#import <CoreApi/MWMOpeningHoursCommon.h>
|
||||
#import "MWMOpeningHoursModel.h"
|
||||
|
||||
#include "editor/ui2oh.hpp"
|
||||
|
||||
extern UITableViewRowAnimation const kMWMOpeningHoursEditorRowAnimation = UITableViewRowAnimationFade;
|
||||
|
||||
@interface MWMOpeningHoursModel () <MWMOpeningHoursSectionProtocol>
|
||||
|
||||
@property (weak, nonatomic) id<MWMOpeningHoursModelProtocol> delegate;
|
||||
|
||||
@property (nonatomic) NSMutableArray<MWMOpeningHoursSection *> * sections;
|
||||
|
||||
@end
|
||||
|
||||
using namespace editor;
|
||||
using namespace osmoh;
|
||||
|
||||
@implementation MWMOpeningHoursModel
|
||||
{
|
||||
ui::TimeTableSet timeTableSet;
|
||||
}
|
||||
|
||||
- (instancetype _Nullable)initWithDelegate:(id<MWMOpeningHoursModelProtocol> _Nonnull)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
_delegate = delegate;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addSection
|
||||
{
|
||||
[self.sections addObject:[[MWMOpeningHoursSection alloc] initWithDelegate:self]];
|
||||
[self refreshSectionsIndexes];
|
||||
}
|
||||
|
||||
- (void)refreshSectionsIndexes
|
||||
{
|
||||
[self.sections enumerateObjectsUsingBlock:^(MWMOpeningHoursSection * _Nonnull section,
|
||||
NSUInteger idx, BOOL * _Nonnull stop)
|
||||
{
|
||||
[section refreshIndex:idx];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)addSchedule
|
||||
{
|
||||
NSAssert(self.canAddSection, @"Can not add schedule");
|
||||
timeTableSet.Append(timeTableSet.GetComplementTimeTable());
|
||||
[self addSection];
|
||||
[self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:self.sections.count - 1]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
NSAssert(timeTableSet.Size() == self.sections.count, @"Inconsistent state");
|
||||
[self.sections[self.sections.count - 1] scrollIntoView];
|
||||
}
|
||||
|
||||
- (void)deleteSchedule:(NSUInteger)index
|
||||
{
|
||||
NSAssert(index < self.count, @"Invalid section index");
|
||||
BOOL const needRealDelete = self.canAddSection;
|
||||
timeTableSet.Remove(index);
|
||||
[self.sections removeObjectAtIndex:index];
|
||||
[self refreshSectionsIndexes];
|
||||
UITableView * tableView = self.tableView;
|
||||
if (needRealDelete)
|
||||
{
|
||||
[tableView deleteSections:[[NSIndexSet alloc] initWithIndex:index]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
[tableView reloadSections:[[NSIndexSet alloc] initWithIndex:self.count]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSRange reloadRange = {index, self.count - index + 1};
|
||||
[tableView reloadSections:[[NSIndexSet alloc] initWithIndexesInRange:reloadRange]
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateActiveSection:(NSUInteger)index
|
||||
{
|
||||
for (MWMOpeningHoursSection * section in self.sections)
|
||||
{
|
||||
if (section.index != index)
|
||||
section.selectedRow = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (ui::TimeTableSet::Proxy)timeTableProxy:(NSUInteger)index
|
||||
{
|
||||
NSAssert(index < self.count, @"Invalid section index");
|
||||
return timeTableSet.Get(index);
|
||||
}
|
||||
|
||||
- (MWMOpeningHoursEditorCells)cellKeyForIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
NSUInteger const section = indexPath.section;
|
||||
NSAssert(section < self.count, @"Invalid section index");
|
||||
return [self.sections[section] cellKeyForRow:indexPath.row];
|
||||
}
|
||||
|
||||
- (CGFloat)heightForIndexPath:(NSIndexPath * _Nonnull)indexPath withWidth:(CGFloat)width
|
||||
{
|
||||
NSUInteger const section = indexPath.section;
|
||||
NSAssert(section < self.count, @"Invalid section index");
|
||||
return [self.sections[section] heightForRow:indexPath.row withWidth:width];
|
||||
}
|
||||
|
||||
- (void)fillCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell atIndexPath:(NSIndexPath * _Nonnull)indexPath
|
||||
{
|
||||
NSUInteger const section = indexPath.section;
|
||||
NSAssert(section < self.count, @"Invalid section index");
|
||||
cell.indexPathAtInit = indexPath;
|
||||
cell.section = self.sections[section];
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfRowsInSection:(NSUInteger)section
|
||||
{
|
||||
NSAssert(section < self.count, @"Invalid section index");
|
||||
return self.sections[section].numberOfRows;
|
||||
}
|
||||
|
||||
- (ui::OpeningDays)unhandledDays
|
||||
{
|
||||
return timeTableSet.GetUnhandledDays();
|
||||
}
|
||||
|
||||
- (void)storeCachedData
|
||||
{
|
||||
for (MWMOpeningHoursModel * m in self.sections)
|
||||
[m storeCachedData];
|
||||
}
|
||||
|
||||
- (void)updateOpeningHours
|
||||
{
|
||||
if (!self.isSimpleMode)
|
||||
return;
|
||||
std::stringstream sstr;
|
||||
sstr << MakeOpeningHours(timeTableSet).GetRule();
|
||||
self.delegate.openingHours = @(sstr.str().c_str());
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (NSUInteger)count
|
||||
{
|
||||
NSAssert(timeTableSet.Size() == self.sections.count, @"Inconsistent state");
|
||||
return self.sections.count;
|
||||
}
|
||||
|
||||
- (BOOL)canAddSection
|
||||
{
|
||||
return !timeTableSet.GetUnhandledDays().empty();
|
||||
}
|
||||
|
||||
- (UITableView *)tableView
|
||||
{
|
||||
return self.delegate.tableView;
|
||||
}
|
||||
|
||||
- (BOOL)isValid
|
||||
{
|
||||
return osmoh::OpeningHours(self.delegate.openingHours.UTF8String).IsValid();
|
||||
}
|
||||
|
||||
- (void)setIsSimpleMode:(BOOL)isSimpleMode
|
||||
{
|
||||
id<MWMOpeningHoursModelProtocol> delegate = self.delegate;
|
||||
NSString * oh = delegate.openingHours;
|
||||
|
||||
auto isSimple = isSimpleMode;
|
||||
if (isSimple && oh && oh.length)
|
||||
isSimple = MakeTimeTableSet(osmoh::OpeningHours(oh.UTF8String), timeTableSet);
|
||||
|
||||
delegate.advancedEditor.hidden = isSimple;
|
||||
UITableView * tv = delegate.tableView;
|
||||
UIButton * toggleModeButton = delegate.toggleModeButton;
|
||||
|
||||
if (isSimple)
|
||||
{
|
||||
_isSimpleMode = YES;
|
||||
tv.hidden = NO;
|
||||
[toggleModeButton setTitle:L(@"editor_time_advanced") forState:UIControlStateNormal];
|
||||
_sections = [NSMutableArray arrayWithCapacity:timeTableSet.Size()];
|
||||
while (self.sections.count < timeTableSet.Size())
|
||||
[self addSection];
|
||||
[tv reloadData];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isSimpleMode)
|
||||
{
|
||||
[self updateOpeningHours];
|
||||
_isSimpleMode = NO;
|
||||
}
|
||||
tv.hidden = YES;
|
||||
[toggleModeButton setTitle:L(@"editor_time_simple") forState:UIControlStateNormal];
|
||||
MWMTextView * ev = delegate.editorView;
|
||||
ev.text = delegate.openingHours;
|
||||
[ev becomeFirstResponder];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isSimpleModeCapable
|
||||
{
|
||||
NSString * oh = self.delegate.openingHours;
|
||||
if (!oh || !oh.length)
|
||||
return YES;
|
||||
ui::TimeTableSet tts;
|
||||
return MakeTimeTableSet(osmoh::OpeningHours(oh.UTF8String), tts);
|
||||
}
|
||||
|
||||
@end
|
||||
59
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.h
Normal file
59
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.h
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#import "MWMOpeningHoursEditorCells.h"
|
||||
|
||||
#include "editor/opening_hours_ui.hpp"
|
||||
|
||||
@class MWMOpeningHoursTableViewCell;
|
||||
|
||||
@protocol MWMOpeningHoursSectionProtocol <NSObject>
|
||||
|
||||
@property(nullable, weak, nonatomic, readonly) UITableView * tableView;
|
||||
|
||||
- (void)updateActiveSection:(NSUInteger)index;
|
||||
|
||||
- (editor::ui::TimeTableSet::Proxy)timeTableProxy:(NSUInteger)index;
|
||||
- (void)deleteSchedule:(NSUInteger)index;
|
||||
|
||||
@end
|
||||
|
||||
@interface MWMOpeningHoursSection : NSObject
|
||||
|
||||
@property(nonatomic) BOOL allDay;
|
||||
|
||||
@property(nonatomic, readonly) NSUInteger index;
|
||||
@property(nullable, nonatomic) NSNumber * selectedRow;
|
||||
@property(nonatomic, readonly) NSUInteger numberOfRows;
|
||||
|
||||
@property(nullable, nonatomic) NSDateComponents * cachedStartTime;
|
||||
@property(nullable, nonatomic) NSDateComponents * cachedEndTime;
|
||||
|
||||
@property(nonatomic, readonly) BOOL canAddClosedTime;
|
||||
|
||||
@property(nullable, weak, nonatomic, readonly) id<MWMOpeningHoursSectionProtocol> delegate;
|
||||
|
||||
- (instancetype _Nonnull)initWithDelegate:(id<MWMOpeningHoursSectionProtocol> _Nonnull)delegate;
|
||||
|
||||
- (void)refreshIndex:(NSUInteger)index;
|
||||
|
||||
- (MWMOpeningHoursEditorCells)cellKeyForRow:(NSUInteger)row;
|
||||
|
||||
- (CGFloat)heightForRow:(NSUInteger)row withWidth:(CGFloat)width;
|
||||
|
||||
- (NSDateComponents * _Nonnull)timeForRow:(NSUInteger)row isStart:(BOOL)isStart;
|
||||
|
||||
- (void)addSelectedDay:(osmoh::Weekday)day;
|
||||
- (void)removeSelectedDay:(osmoh::Weekday)day;
|
||||
- (BOOL)containsSelectedDay:(osmoh::Weekday)day;
|
||||
|
||||
- (void)addClosedTime;
|
||||
- (void)removeClosedTime:(NSUInteger)row;
|
||||
|
||||
- (void)deleteSchedule;
|
||||
|
||||
- (void)refresh:(BOOL)force;
|
||||
|
||||
- (void)scrollIntoView;
|
||||
- (void)storeCachedData;
|
||||
|
||||
- (BOOL)isRowSelected:(NSUInteger)row;
|
||||
|
||||
@end
|
||||
481
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.mm
Normal file
481
iphone/Maps/UI/Editor/OpeningHours/MWMOpeningHoursSection.mm
Normal file
|
|
@ -0,0 +1,481 @@
|
|||
#import "MWMOpeningHoursSection.h"
|
||||
#import <CoreApi/MWMOpeningHoursCommon.h>
|
||||
#import "MWMOpeningHoursTableViewCell.h"
|
||||
#import "SwiftBridge.h"
|
||||
|
||||
extern NSDictionary * const kMWMOpeningHoursEditorTableCells;
|
||||
|
||||
extern UITableViewRowAnimation const kMWMOpeningHoursEditorRowAnimation;
|
||||
|
||||
@interface MWMOpeningHoursSection ()
|
||||
|
||||
@property (nonatomic, readonly) NSUInteger excludeTimeCount;
|
||||
|
||||
@property (nonatomic) BOOL skipStoreCachedData;
|
||||
|
||||
@property (nonatomic) BOOL removeBrokenExcludeTime;
|
||||
|
||||
@end
|
||||
|
||||
using namespace editor::ui;
|
||||
using namespace osmoh;
|
||||
|
||||
@implementation MWMOpeningHoursSection
|
||||
|
||||
- (instancetype _Nonnull)initWithDelegate:(id<MWMOpeningHoursSectionProtocol> _Nonnull)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
_delegate = delegate;
|
||||
_selectedRow = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)refreshIndex:(NSUInteger)index
|
||||
{
|
||||
_index = index;
|
||||
}
|
||||
|
||||
#pragma mark - Rows
|
||||
|
||||
- (NSUInteger)firstRowForKey:(MWMOpeningHoursEditorCells)key
|
||||
{
|
||||
NSUInteger const numberOfRows = self.numberOfRows;
|
||||
for (NSUInteger row = 0; row != numberOfRows; ++row)
|
||||
{
|
||||
if ([self cellKeyForRow:row] == key)
|
||||
return row;
|
||||
}
|
||||
return numberOfRows;
|
||||
}
|
||||
|
||||
- (MWMOpeningHoursEditorCells)cellKeyForRow:(NSUInteger)row
|
||||
{
|
||||
if (row == 0)
|
||||
return MWMOpeningHoursEditorDaysSelectorCell;
|
||||
if (row == 1)
|
||||
return MWMOpeningHoursEditorAllDayCell;
|
||||
|
||||
NSUInteger const numberOfRows = self.numberOfRows;
|
||||
BOOL const firstSection = (self.index == 0);
|
||||
|
||||
if (firstSection && row == numberOfRows - 1)
|
||||
return MWMOpeningHoursEditorAddClosedCell;
|
||||
else if (!firstSection && row == numberOfRows - 1)
|
||||
return MWMOpeningHoursEditorDeleteScheduleCell;
|
||||
else if (!firstSection && row == numberOfRows - 2)
|
||||
return MWMOpeningHoursEditorAddClosedCell;
|
||||
else if (row == 2)
|
||||
return MWMOpeningHoursEditorTimeSpanCell;
|
||||
|
||||
if ([self.selectedRow isEqualToNumber:@(row - 1)])
|
||||
return MWMOpeningHoursEditorTimeSelectorCell;
|
||||
|
||||
return MWMOpeningHoursEditorClosedSpanCell;
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfRowsForAllDay:(BOOL)allDay
|
||||
{
|
||||
NSUInteger rowsCount = 2; // MWMOpeningHoursDaysSelectorTableViewCell, MWMOpeningHoursAllDayTableViewCell
|
||||
if (!allDay)
|
||||
{
|
||||
rowsCount += 2; // MWMOpeningHoursTimeSpanTableViewCell, MWMOpeningHoursAddClosedTableViewCell
|
||||
rowsCount += [self closedTimesCount]; // MWMOpeningHoursClosedSpanTableViewCell
|
||||
if (self.selectedRow)
|
||||
rowsCount++; // MWMOpeningHoursTimeSelectorTableViewCell
|
||||
}
|
||||
if (self.index != 0)
|
||||
rowsCount++; // MWMOpeningHoursDeleteScheduleTableViewCell
|
||||
return rowsCount;
|
||||
}
|
||||
|
||||
- (CGFloat)heightForRow:(NSUInteger)row withWidth:(CGFloat)width
|
||||
{
|
||||
Class cls = kMWMOpeningHoursEditorTableCells[@([self cellKeyForRow:row])];
|
||||
return [cls heightForWidth:width];
|
||||
}
|
||||
|
||||
- (void)fillCell:(MWMOpeningHoursTableViewCell * _Nonnull)cell
|
||||
{
|
||||
cell.section = self;
|
||||
}
|
||||
|
||||
#pragma mark - Row time
|
||||
|
||||
- (NSDateComponents * _Nonnull)timeForRow:(NSUInteger)row isStart:(BOOL)isStart
|
||||
{
|
||||
NSDateComponents * cachedTime = isStart ? self.cachedStartTime : self.cachedEndTime;
|
||||
if (cachedTime && [self isRowSelected:row])
|
||||
return cachedTime;
|
||||
|
||||
BOOL const isClosed = [self cellKeyForRow:row] != MWMOpeningHoursEditorTimeSpanCell;
|
||||
auto tt = [self timeTableProxy];
|
||||
NSUInteger const index = isClosed ? [self closedTimeIndex:row] : 0;
|
||||
Timespan span = isClosed ? tt.GetExcludeTime()[index] : tt.GetOpeningTime();
|
||||
return dateComponentsFromTime(isStart ? span.GetStart() : span.GetEnd());
|
||||
}
|
||||
|
||||
- (void)setStartTime:(NSDateComponents *)startTime endTime:(NSDateComponents *)endTime isClosed:(BOOL)isClosed
|
||||
{
|
||||
if (!startTime && !endTime)
|
||||
return;
|
||||
|
||||
auto tt = [self timeTableProxy];
|
||||
NSUInteger const row = self.selectedRow.unsignedIntegerValue;
|
||||
NSUInteger const index = isClosed ? [self closedTimeIndex:row] : 0;
|
||||
Timespan span = isClosed ? tt.GetExcludeTime()[index] : tt.GetOpeningTime();
|
||||
|
||||
if (startTime)
|
||||
{
|
||||
HourMinutes startHM;
|
||||
startHM.SetHours(HourMinutes::THours(startTime.hour));
|
||||
startHM.SetMinutes(HourMinutes::TMinutes(startTime.minute));
|
||||
span.SetStart(startHM);
|
||||
}
|
||||
if (endTime)
|
||||
{
|
||||
HourMinutes endHM;
|
||||
endHM.SetHours(HourMinutes::THours(endTime.hour));
|
||||
endHM.SetMinutes(HourMinutes::TMinutes(endTime.minute));
|
||||
span.SetEnd(endHM);
|
||||
}
|
||||
|
||||
NSUInteger const closedTimesCountBeforeUpdate = [self closedTimesCount];
|
||||
|
||||
if (isClosed)
|
||||
{
|
||||
if (!tt.ReplaceExcludeTime(span, index) && self.removeBrokenExcludeTime)
|
||||
tt.RemoveExcludeTime(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
tt.SetOpeningTime(span);
|
||||
}
|
||||
tt.Commit();
|
||||
|
||||
[self refresh:closedTimesCountBeforeUpdate != [self closedTimesCount]];
|
||||
}
|
||||
|
||||
#pragma mark - Closed Time
|
||||
|
||||
- (NSUInteger)closedTimesCount
|
||||
{
|
||||
return [self timeTableProxy].GetExcludeTime().size();
|
||||
}
|
||||
|
||||
- (NSUInteger)closedTimeIndex:(NSUInteger)row
|
||||
{
|
||||
NSUInteger indexShift = [self firstRowForKey:MWMOpeningHoursEditorTimeSpanCell] + 1;
|
||||
if (self.selectedRow && self.selectedRow.unsignedIntegerValue + 1 < row)
|
||||
indexShift++;
|
||||
NSAssert(row >= indexShift, @"Invalid row index");
|
||||
NSAssert(row - indexShift < [self closedTimesCount], @"Invalid row index");
|
||||
return row - indexShift;
|
||||
}
|
||||
|
||||
- (void)addClosedTime
|
||||
{
|
||||
self.removeBrokenExcludeTime = YES;
|
||||
self.selectedRow = nil;
|
||||
|
||||
NSUInteger const row = [self firstRowForKey:MWMOpeningHoursEditorAddClosedCell];
|
||||
|
||||
auto timeTable = [self timeTableProxy];
|
||||
|
||||
NSUInteger const closedTimesCountBeforeUpdate = [self closedTimesCount];
|
||||
|
||||
Timespan timeSpan = timeTable.GetPredefinedExcludeTime();
|
||||
timeTable.AddExcludeTime(timeSpan);
|
||||
timeTable.Commit();
|
||||
|
||||
NSUInteger const closedTimesCountAfterUpdate = [self closedTimesCount];
|
||||
if (closedTimesCountAfterUpdate < closedTimesCountBeforeUpdate)
|
||||
{
|
||||
[self refresh:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
if (closedTimesCountAfterUpdate > closedTimesCountBeforeUpdate)
|
||||
{
|
||||
[self.delegate.tableView update:^{
|
||||
[self insertRow:row];
|
||||
self.selectedRow = @(row);
|
||||
}];
|
||||
}
|
||||
[self refresh:NO];
|
||||
}
|
||||
|
||||
- (void)removeClosedTime:(NSUInteger)row
|
||||
{
|
||||
NSUInteger const closedTimesCountBeforeUpdate = [self closedTimesCount];
|
||||
self.skipStoreCachedData = [self isRowSelected:row];
|
||||
if (closedTimesCountBeforeUpdate == [self closedTimesCount])
|
||||
{
|
||||
[self.delegate.tableView update:^{
|
||||
auto timeTable = [self timeTableProxy];
|
||||
timeTable.RemoveExcludeTime([self closedTimeIndex:row]);
|
||||
timeTable.Commit();
|
||||
|
||||
self.selectedRow = nil;
|
||||
[self deleteRow:row];
|
||||
}];
|
||||
}
|
||||
[self refresh:NO];
|
||||
}
|
||||
|
||||
#pragma mark - Selected days
|
||||
|
||||
- (void)addSelectedDay:(Weekday)day
|
||||
{
|
||||
auto timeTable = [self timeTableProxy];
|
||||
auto openingDays(timeTable.GetOpeningDays());
|
||||
openingDays.insert(day);
|
||||
timeTable.SetOpeningDays(openingDays);
|
||||
timeTable.Commit();
|
||||
[self refresh:YES];
|
||||
}
|
||||
|
||||
- (void)removeSelectedDay:(Weekday)day
|
||||
{
|
||||
auto timeTable = [self timeTableProxy];
|
||||
auto openingDays(timeTable.GetOpeningDays());
|
||||
openingDays.erase(day);
|
||||
timeTable.SetOpeningDays(openingDays);
|
||||
timeTable.Commit();
|
||||
[self refresh:YES];
|
||||
}
|
||||
|
||||
- (BOOL)containsSelectedDay:(Weekday)day
|
||||
{
|
||||
auto timeTable = [self timeTableProxy];
|
||||
auto const & openingDays = timeTable.GetOpeningDays();
|
||||
return openingDays.find(day) != openingDays.end();
|
||||
}
|
||||
|
||||
#pragma mark - Table
|
||||
|
||||
- (void)refresh:(BOOL)force
|
||||
{
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
if (force)
|
||||
{
|
||||
[tableView reloadData];
|
||||
return;
|
||||
}
|
||||
for (MWMOpeningHoursTableViewCell * cell in tableView.visibleCells)
|
||||
{
|
||||
[cell refresh];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)refreshForNewRowCount:(NSUInteger)newRowCount oldRowCount:(NSUInteger)oldRowCount
|
||||
{
|
||||
NSAssert(newRowCount != oldRowCount, @"Invalid rows change");
|
||||
BOOL const addRows = newRowCount > oldRowCount;
|
||||
NSUInteger const minRows = MIN(newRowCount, oldRowCount);
|
||||
NSUInteger const maxRows = MAX(newRowCount, oldRowCount);
|
||||
NSMutableArray<NSIndexPath *> * indexes = [NSMutableArray arrayWithCapacity:maxRows - minRows];
|
||||
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
[tableView update:^{
|
||||
for (NSUInteger row = minRows; row < maxRows; ++row)
|
||||
[indexes addObject:[NSIndexPath indexPathForRow:row inSection:self.index]];
|
||||
|
||||
if (addRows)
|
||||
[tableView insertRowsAtIndexPaths:indexes
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
else
|
||||
[tableView deleteRowsAtIndexPaths:indexes
|
||||
withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}];
|
||||
[self refresh:NO];
|
||||
}
|
||||
|
||||
- (void)insertRow:(NSUInteger)row
|
||||
{
|
||||
NSIndexPath * path = [NSIndexPath indexPathForRow:row inSection:self.index];
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
[tableView insertRowsAtIndexPaths:@[ path ] withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}
|
||||
|
||||
- (void)deleteRow:(NSUInteger)row
|
||||
{
|
||||
NSIndexPath * path = [NSIndexPath indexPathForRow:row inSection:self.index];
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
[tableView deleteRowsAtIndexPaths:@[ path ] withRowAnimation:kMWMOpeningHoursEditorRowAnimation];
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
- (TimeTableSet::Proxy)timeTableProxy
|
||||
{
|
||||
return [self.delegate timeTableProxy:self.index];
|
||||
}
|
||||
|
||||
- (void)deleteSchedule
|
||||
{
|
||||
[self.delegate deleteSchedule:self.index];
|
||||
}
|
||||
|
||||
#pragma mark - Selected row
|
||||
|
||||
- (void)setSelectedRow:(NSNumber *)selectedRow
|
||||
{
|
||||
if ((!_selectedRow && !selectedRow) || _selectedRow.unsignedIntegerValue == selectedRow.unsignedIntegerValue)
|
||||
return;
|
||||
NSUInteger const closedTimesCountBeforeUpdate = [self closedTimesCount];
|
||||
[self storeCachedData];
|
||||
if (closedTimesCountBeforeUpdate != [self closedTimesCount])
|
||||
{
|
||||
_selectedRow = nil;
|
||||
[self refresh:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
NSNumber * oldSelectedRow = _selectedRow;
|
||||
NSUInteger const newInd = selectedRow.unsignedIntegerValue;
|
||||
NSUInteger const oldInd = oldSelectedRow.unsignedIntegerValue;
|
||||
|
||||
id<MWMOpeningHoursSectionProtocol> delegate = self.delegate;
|
||||
UITableView * tableView = delegate.tableView;
|
||||
[tableView update:^{
|
||||
if (!oldSelectedRow)
|
||||
{
|
||||
self->_selectedRow = selectedRow;
|
||||
[self insertRow:newInd + 1];
|
||||
[delegate updateActiveSection:self.index];
|
||||
}
|
||||
else if (selectedRow)
|
||||
{
|
||||
if (newInd < oldInd)
|
||||
{
|
||||
self->_selectedRow = selectedRow;
|
||||
[self insertRow:newInd + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
self->_selectedRow = @(newInd - 1);
|
||||
[self insertRow:newInd];
|
||||
}
|
||||
|
||||
[self deleteRow:oldInd + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
self->_selectedRow = selectedRow;
|
||||
[self deleteRow:oldInd + 1];
|
||||
}
|
||||
}];
|
||||
[self scrollToSelection];
|
||||
}
|
||||
|
||||
- (BOOL)isRowSelected:(NSUInteger)row
|
||||
{
|
||||
return self.selectedRow && self.selectedRow.unsignedIntegerValue == row;
|
||||
}
|
||||
|
||||
- (void)storeCachedData
|
||||
{
|
||||
if (!self.selectedRow)
|
||||
return;
|
||||
if (!self.skipStoreCachedData)
|
||||
{
|
||||
switch ([self cellKeyForRow:self.selectedRow.unsignedIntegerValue])
|
||||
{
|
||||
case MWMOpeningHoursEditorTimeSpanCell:
|
||||
[self setStartTime:self.cachedStartTime endTime:self.cachedEndTime isClosed:NO];
|
||||
break;
|
||||
case MWMOpeningHoursEditorClosedSpanCell:
|
||||
[self setStartTime:self.cachedStartTime endTime:self.cachedEndTime isClosed:YES];
|
||||
break;
|
||||
default:
|
||||
NSAssert(false, @"Invalid case");
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.cachedStartTime = nil;
|
||||
self.cachedEndTime = nil;
|
||||
self.skipStoreCachedData = NO;
|
||||
self.removeBrokenExcludeTime = NO;
|
||||
}
|
||||
|
||||
#pragma mark - Scrolling
|
||||
|
||||
- (void)scrollIntoView
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^
|
||||
{
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
NSUInteger const lastRow = self.numberOfRows - 1;
|
||||
NSIndexPath * path = [NSIndexPath indexPathForRow:lastRow inSection:self.index];
|
||||
[tableView scrollToRowAtIndexPath:path
|
||||
atScrollPosition:UITableViewScrollPositionNone
|
||||
animated:YES];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)scrollToSelection
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^
|
||||
{
|
||||
if (!self.selectedRow)
|
||||
return;
|
||||
UITableView * tableView = self.delegate.tableView;
|
||||
NSUInteger const timeSelectorRow = self.selectedRow.unsignedIntegerValue + 1;
|
||||
NSIndexPath * path = [NSIndexPath indexPathForRow:timeSelectorRow inSection:self.index];
|
||||
[tableView scrollToRowAtIndexPath:path
|
||||
atScrollPosition:UITableViewScrollPositionNone
|
||||
animated:YES];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (BOOL)allDay
|
||||
{
|
||||
return [self timeTableProxy].IsTwentyFourHours();
|
||||
}
|
||||
|
||||
- (void)setAllDay:(BOOL)allDay
|
||||
{
|
||||
BOOL const currentAllDay = self.allDay;
|
||||
if (currentAllDay == allDay)
|
||||
return;
|
||||
self.selectedRow = nil;
|
||||
NSUInteger const deleteScheduleCellShift = self.index != 0 ? 1 : 0;
|
||||
NSUInteger const oldRowCount = [self numberOfRowsForAllDay:currentAllDay] - deleteScheduleCellShift;
|
||||
NSUInteger const newRowCount = [self numberOfRowsForAllDay:allDay] - deleteScheduleCellShift;
|
||||
auto timeTable = [self timeTableProxy];
|
||||
timeTable.SetTwentyFourHours(allDay);
|
||||
timeTable.Commit();
|
||||
[self refreshForNewRowCount:newRowCount oldRowCount:oldRowCount];
|
||||
[self scrollIntoView];
|
||||
}
|
||||
|
||||
- (NSUInteger)numberOfRows
|
||||
{
|
||||
return [self numberOfRowsForAllDay:self.allDay];
|
||||
}
|
||||
|
||||
- (void)setCachedStartTime:(NSDateComponents *)cachedStartTime
|
||||
{
|
||||
_cachedStartTime = cachedStartTime;
|
||||
if (cachedStartTime)
|
||||
[self refresh:NO];
|
||||
}
|
||||
|
||||
- (void)setCachedEndTime:(NSDateComponents *)cachedEndTime
|
||||
{
|
||||
_cachedEndTime = cachedEndTime;
|
||||
if (cachedEndTime)
|
||||
[self refresh:NO];
|
||||
}
|
||||
|
||||
- (BOOL)canAddClosedTime
|
||||
{
|
||||
return [self timeTableProxy].CanAddExcludeTime();
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Add table
Add a link
Reference in a new issue