Skip to content

Commit

Permalink
For issue #12:
Browse files Browse the repository at this point in the history
1. Fixed 2 dangerous null-exception.
2. Prevent the need-login-view being visible when contribution chart is drawn.
  • Loading branch information
Nightonke committed Mar 17, 2017
1 parent f54c7ed commit 19d0286
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
4 changes: 2 additions & 2 deletions VHGithubNotifier/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.2.1</string>
<string>1.0.2.2</string>
<key>CFBundleVersion</key>
<string>1021</string>
<string>1022</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key>
Expand Down
13 changes: 9 additions & 4 deletions VHGithubNotifier/Model/Manager/VHGithubNotifierManager+Profile.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,15 @@ - (NSString *)yearContributionsTimeString
NSLocale *enUSPOSIXLocale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
[dateFormatter setLocale:enUSPOSIXLocale];
[dateFormatter setDateFormat:@"MMM d, yyyy"];
NSMutableString *timeString = [NSMutableString string];
[timeString appendString:[dateFormatter stringFromDate:[contributionBlocks firstObject].date]];
[timeString appendString:@""];
[timeString appendString:[dateFormatter stringFromDate:[contributionBlocks lastObject].date]];
NSMutableString *timeString = [NSMutableString stringWithFormat:@""];
NSString *firstContributionDate = [dateFormatter stringFromDate:[contributionBlocks firstObject].date];
NSString *lastContributionDate = [dateFormatter stringFromDate:[contributionBlocks lastObject].date];
if (firstContributionDate && lastContributionDate)
{
[timeString appendString:[dateFormatter stringFromDate:[contributionBlocks firstObject].date]];
[timeString appendString:@""];
[timeString appendString:[dateFormatter stringFromDate:[contributionBlocks lastObject].date]];
}
return [timeString copy];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,15 @@ - (void)configureNotificationBannerImage {

- (void)configureNotificationBannerTexts {
self.title = [self labelWithidentifier:@"titleLabel"
attributedTextValue:[[NSAttributedString alloc] initWithString:_userNotification.title attributes:titleAttributes]
attributedTextValue:[[NSAttributedString alloc] initWithString:AVOID_NIL_STRING(_userNotification.title) attributes:titleAttributes]
superView:[[self window] contentView]];

self.subtitle = [self labelWithidentifier:@"subtitleLabel"
attributedTextValue:[[NSAttributedString alloc] initWithString:_userNotification.subtitle attributes:subtitleAttributes]
attributedTextValue:[[NSAttributedString alloc] initWithString:AVOID_NIL_STRING(_userNotification.subtitle) attributes:subtitleAttributes]
superView:[[self window] contentView]];

self.informativeText = [self labelWithidentifier:@"informativeTextLabel"
attributedTextValue:[[NSAttributedString alloc] initWithString:_userNotification.informativeText attributes:informativeTextAttributes]
attributedTextValue:[[NSAttributedString alloc] initWithString:AVOID_NIL_STRING(_userNotification.informativeText) attributes:informativeTextAttributes]
superView:[[self window] contentView]];
switch (_informativeTextLineBreakMode) {
case NSLineBreakByClipping:
Expand Down
2 changes: 2 additions & 0 deletions VHGithubNotifier/VC/VHProfileVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ - (void)onNotifyLoginCookieGotFailed:(NSNotification *)notification
- (void)onNotifyContributionBlocksLoadedSuccessfully:(NSNotification *)notification
{
self.stateView.state = VHStateViewStateTypeLoadSuccessfully;
self.needLoginView.hidden = YES;
self.contributionChart.hidden = NO;
[self.contributionChart setNeedsDisplay:YES];
[self updateContributionLabels];
Expand All @@ -150,6 +151,7 @@ - (void)onNotifyProfileLoadedSuccessfully:(NSNotification *)notificatio

- (void)onNotifyContributionChartChanged:(NSNotification *)notification
{
self.needLoginView.hidden = YES;
[self.contributionChart setNeedsDisplay:YES];
}

Expand Down

0 comments on commit 19d0286

Please sign in to comment.