Browse Source

Sunset/Sunrise Boundary Check.

v1.2.4
Abhishek Banthia 9 years ago
parent
commit
ef4049fefe
  1. 6
      Clocker/Floating Window/CLFloatingWindowController.m
  2. 5
      Clocker/Floating Window/en.lproj/CLFloatingWindow.xib
  3. 5
      Clocker/Floating Window/ja.lproj/CLFloatingWindow.xib
  4. 5
      Clocker/Floating Window/zh-Hans.lproj/CLFloatingWindow.xib
  5. 5
      Clocker/Floating Window/zh-Hant.lproj/CLFloatingWindow.xib
  6. 11
      Clocker/Model/CLTimezoneData.m
  7. 6
      Clocker/PanelController.m
  8. 17
      Clocker/en.lproj/Panel.xib
  9. 5
      Clocker/zh-Hans.lproj/Panel.xib
  10. 5
      Clocker/zh-Hant.lproj/Panel.xib

6
Clocker/Floating Window/CLFloatingWindowController.m

@ -155,12 +155,14 @@ NSString *const CLTimezoneCellIdentifier = @"timeZoneCell";
NSNumber *displaySunriseSunsetTime = [[NSUserDefaults standardUserDefaults] objectForKey:CLSunriseSunsetTime];
cell.sunriseSetTime.hidden = [displaySunriseSunsetTime isEqualToNumber:@(1)] ? YES : NO;
cell.sunriseSetTime.hidden = ([displaySunriseSunsetTime isEqualToNumber:@(0)] && cell.sunriseSetTime.stringValue.length > 0) ? NO : YES;
cell.sunriseSetImage.hidden = [displaySunriseSunsetTime isEqualToNumber:@(1)] ? YES : NO;
cell.sunriseSetImage.hidden = [displaySunriseSunsetTime isEqualToNumber:@(0)] && cell.sunriseSetTime.stringValue.length > 0 ? NO : YES;
[cell setUpAutoLayoutWithCell:cell];
[cell setAppropriateFont];
return cell;
}

5
Clocker/Floating Window/en.lproj/CLFloatingWindow.xib

@ -63,7 +63,7 @@
<constraint firstAttribute="width" constant="20" id="JLt-So-9GB"/>
<constraint firstAttribute="height" constant="20" id="gQ5-I6-hfW"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="aeR-XC-8J2"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="aeR-XC-8J2"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="w0H-z4-Qmv">
<rect key="frame" x="224" y="7" width="49" height="17"/>
@ -71,7 +71,7 @@
<constraint firstAttribute="width" constant="45" id="v6B-Bv-Ye1"/>
<constraint firstAttribute="height" constant="17" id="zYu-u6-R0W"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="07:00 PM" id="ENI-4b-K6F">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="" id="ENI-4b-K6F">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -290,6 +290,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

5
Clocker/Floating Window/ja.lproj/CLFloatingWindow.xib

@ -63,7 +63,7 @@
<constraint firstAttribute="height" constant="20" id="VIH-zs-bLn"/>
<constraint firstAttribute="width" constant="20" id="XM2-nG-5aU"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="ciN-Xz-hJ0"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="ciN-Xz-hJ0"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xiB-ab-VRH">
<rect key="frame" x="224" y="7" width="49" height="17"/>
@ -71,7 +71,7 @@
<constraint firstAttribute="width" constant="45" id="hMZ-YQ-cjr"/>
<constraint firstAttribute="height" constant="17" id="rcL-hY-BVT"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="07:00 PM" id="7Oy-jC-4Ad">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="" id="7Oy-jC-4Ad">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -289,6 +289,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

5
Clocker/Floating Window/zh-Hans.lproj/CLFloatingWindow.xib

@ -78,7 +78,7 @@
<constraint firstAttribute="width" constant="20" id="Obq-Oh-WXk"/>
<constraint firstAttribute="height" constant="20" id="reh-nM-X2T"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="s4Y-Ea-vG5"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="s4Y-Ea-vG5"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4gs-C2-sJo">
<rect key="frame" x="224" y="7" width="49" height="17"/>
@ -86,7 +86,7 @@
<constraint firstAttribute="width" constant="45" id="lao-W5-nM7"/>
<constraint firstAttribute="height" constant="17" id="wVS-6m-nWK"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="07:00 PM" id="o1Y-yu-qQs">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="" id="o1Y-yu-qQs">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -289,6 +289,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

5
Clocker/Floating Window/zh-Hant.lproj/CLFloatingWindow.xib

@ -79,7 +79,7 @@
<constraint firstAttribute="width" constant="20" id="5ea-gY-HZ1"/>
<constraint firstAttribute="height" constant="20" id="6Ir-U7-lbX"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="gKv-kD-9FC"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="gKv-kD-9FC"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XyF-3h-GbI">
<rect key="frame" x="224" y="7" width="49" height="17"/>
@ -87,7 +87,7 @@
<constraint firstAttribute="width" constant="45" id="8zt-C5-2xb"/>
<constraint firstAttribute="height" constant="17" id="dVD-Q8-tsO"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="left" placeholderString="07:00 PM" id="A8n-aG-v8t">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="left" placeholderString="" id="A8n-aG-v8t">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -290,6 +290,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

11
Clocker/Model/CLTimezoneData.m

@ -174,7 +174,9 @@
-(void)initializeSunriseSunset
{
EDSunriseSet *sunriseSetObject = [EDSunriseSet sunrisesetWithDate:[NSDate date] timezone:[NSTimeZone timeZoneWithName:self.timezoneID] latitude:self.latitude.doubleValue longitude:self.longitude.doubleValue];
EDSunriseSet *sunriseSetObject = [EDSunriseSet sunrisesetWithDate:[NSDate date]
timezone:[NSTimeZone timeZoneWithName:self.timezoneID]
latitude:self.latitude.doubleValue longitude:self.longitude.doubleValue];
self.sunriseTime = sunriseSetObject.sunrise;
self.sunsetTime = sunriseSetObject.sunset;
}
@ -388,6 +390,11 @@
{
[self initializeSunriseSunset];
if (!self.sunriseTime && !self.sunsetTime)
{
return CLEmptyString;
}
NSString *timezoneDate = [self getFullFledgedDateForTime];
NSDateFormatter *formatter = [NSDateFormatter new];
@ -435,8 +442,6 @@
[dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm a"];
dateFormatter.timeZone = [NSTimeZone timeZoneWithName:self.timezoneID];
return [dateFormatter stringFromDate:newDate];
}

6
Clocker/PanelController.m

@ -328,12 +328,14 @@ static PanelController *sharedPanel = nil;
NSNumber *displaySunriseSunsetTime = [[NSUserDefaults standardUserDefaults] objectForKey:CLSunriseSunsetTime];
cell.sunriseSetTime.hidden = [displaySunriseSunsetTime isEqualToNumber:@(1)] ? YES : NO;
cell.sunriseSetTime.hidden = ([displaySunriseSunsetTime isEqualToNumber:@(0)] && cell.sunriseSetTime.stringValue.length > 0) ? NO : YES;
cell.sunriseSetImage.hidden = [displaySunriseSunsetTime isEqualToNumber:@(1)] ? YES : NO;
cell.sunriseSetImage.hidden = [displaySunriseSunsetTime isEqualToNumber:@(0)] && cell.sunriseSetTime.stringValue.length > 0 ? NO : YES;
[cell setUpAutoLayoutWithCell:cell];
[cell setAppropriateFont];
return cell;
}

17
Clocker/en.lproj/Panel.xib

@ -85,7 +85,7 @@
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" tag="101" preferredMaxLayoutWidth="110" translatesAutoresizingMaskIntoConstraints="NO" id="vnv-J2-7r1">
<rect key="frame" x="159" y="25" width="114" height="35"/>
<rect key="frame" x="159" y="21" width="114" height="35"/>
<constraints>
<constraint firstAttribute="height" constant="35" id="3WU-de-OQL"/>
<constraint firstAttribute="width" constant="110" id="cQV-gJ-zMz"/>
@ -97,20 +97,20 @@
</textFieldCell>
</textField>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="7OQ-cr-VJS">
<rect key="frame" x="203" y="5" width="20" height="20"/>
<rect key="frame" x="203" y="6" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="Vmz-Ji-Y0Q"/>
<constraint firstAttribute="height" constant="20" id="qNj-EP-era"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="U2f-NK-Gua"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="U2f-NK-Gua"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uOg-ij-alO">
<rect key="frame" x="224" y="8" width="49" height="17"/>
<rect key="frame" x="224" y="9" width="49" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="89H-r0-Dnh"/>
<constraint firstAttribute="width" constant="45" id="8KH-Ks-d4T"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="07:00 PM" id="qpH-kn-cMT">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="" id="qpH-kn-cMT">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -123,10 +123,10 @@
<constraint firstItem="etF-33-bCB" firstAttribute="top" secondItem="qbN-ba-fho" secondAttribute="top" constant="5" id="Lct-kG-usb"/>
<constraint firstAttribute="trailing" secondItem="uOg-ij-alO" secondAttribute="trailing" constant="8" id="Siz-97-mYl"/>
<constraint firstItem="QUd-7D-q14" firstAttribute="top" secondItem="etF-33-bCB" secondAttribute="bottom" constant="2" id="VO6-Zn-eA3"/>
<constraint firstItem="uOg-ij-alO" firstAttribute="top" secondItem="vnv-J2-7r1" secondAttribute="bottom" id="j2E-3l-6B2"/>
<constraint firstItem="7OQ-cr-VJS" firstAttribute="top" secondItem="vnv-J2-7r1" secondAttribute="bottom" id="uZd-y0-d6A"/>
<constraint firstItem="uOg-ij-alO" firstAttribute="top" secondItem="vnv-J2-7r1" secondAttribute="bottom" constant="-5" id="j2E-3l-6B2"/>
<constraint firstItem="7OQ-cr-VJS" firstAttribute="top" secondItem="vnv-J2-7r1" secondAttribute="bottom" constant="-5" id="uZd-y0-d6A"/>
<constraint firstItem="etF-33-bCB" firstAttribute="leading" secondItem="qbN-ba-fho" secondAttribute="leading" constant="9" id="ueW-ow-ZRq"/>
<constraint firstItem="vnv-J2-7r1" firstAttribute="top" secondItem="qbN-ba-fho" secondAttribute="top" constant="1" id="vGp-XY-wiJ"/>
<constraint firstItem="vnv-J2-7r1" firstAttribute="top" secondItem="qbN-ba-fho" secondAttribute="top" constant="5" id="vGp-XY-wiJ"/>
<constraint firstAttribute="trailing" secondItem="vnv-J2-7r1" secondAttribute="trailing" constant="8" id="zXo-eA-0bQ"/>
</constraints>
<connections>
@ -290,6 +290,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

5
Clocker/zh-Hans.lproj/Panel.xib

@ -78,7 +78,7 @@
<constraint firstAttribute="height" constant="20" id="Tug-eT-kM6"/>
<constraint firstAttribute="width" constant="20" id="fw4-xM-R7B"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="SQ7-zC-HEd"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="SQ7-zC-HEd"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6Lf-Yu-mLH">
<rect key="frame" x="224" y="7" width="49" height="17"/>
@ -86,7 +86,7 @@
<constraint firstAttribute="height" constant="17" id="Erg-ja-DqV"/>
<constraint firstAttribute="width" constant="45" id="r3N-lG-lbQ"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="07:00 PM" id="7e9-Cy-Q3m">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="" id="7e9-Cy-Q3m">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -290,6 +290,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

5
Clocker/zh-Hant.lproj/Panel.xib

@ -78,7 +78,7 @@
<constraint firstAttribute="height" constant="20" id="TYa-1I-fQJ"/>
<constraint firstAttribute="width" constant="20" id="b27-EB-ZA9"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Sunrise" id="k54-vn-T4E"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="k54-vn-T4E"/>
</imageView>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="L5a-d8-SuC">
<rect key="frame" x="224" y="7" width="49" height="17"/>
@ -86,7 +86,7 @@
<constraint firstAttribute="height" constant="17" id="Fmh-lZ-7vJ"/>
<constraint firstAttribute="width" constant="45" id="psP-EH-mNo"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="07:00 PM" id="uGx-ek-RAy">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" alignment="center" placeholderString="" id="uGx-ek-RAy">
<font key="font" size="11" name="SFUIDisplay-Ultralight"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -290,6 +290,5 @@
<image name="ClockerIcon-16" width="16" height="16"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="PowerIcon" width="270" height="270"/>
<image name="Sunrise" width="512" height="512"/>
</resources>
</document>

Loading…
Cancel
Save