Skip to content

Commit

Permalink
Option shows current version
Browse files Browse the repository at this point in the history
  • Loading branch information
iosdeveloper committed Mar 20, 2016
1 parent 16d9063 commit 8d6fa09
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions App/BitBar/PluginManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,27 @@ - (void) addHelperItemsToMenu:(NSMenu*)menu asSubMenu:(BOOL)submenu {
[targetMenu addItem:NSMenuItem.separatorItem];
}

NSString *versionString = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleShortVersionString"];

NSMenuItem *versionMenuitem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"v%@", versionString] action:nil keyEquivalent:@""];

if (!self.latestVersion || [self.latestVersion isEqualToString:[[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]]) {
NSString *versionString = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleShortVersionString"];

NSMenuItem *versionMenuitem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"v%@", versionString] action:nil keyEquivalent:@""];

[targetMenu addItem:versionMenuitem];
} else {
NSImage *cautionImage = [NSImage imageNamed:NSImageNameCaution];
cautionImage.size = CGSizeMake(16, 16);

NSMenuItem *versionMenuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"Download latest (v%@)", self.latestVersion]
action:@selector(openLatestRelease)
keyEquivalent:@""];
versionMenuItem.target = self;
versionMenuItem.offStateImage = cautionImage;
[targetMenu addItem:versionMenuItem];
NSMenuItem *latestVersionMenuItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"Download latest (v%@)", self.latestVersion]
action:@selector(openLatestRelease)
keyEquivalent:@""];
latestVersionMenuItem.target = self;
latestVersionMenuItem.offStateImage = cautionImage;
[targetMenu addItem:latestVersionMenuItem];

moreItem.offStateImage = cautionImage;

versionMenuitem.alternate = YES;
[targetMenu addItem:versionMenuitem];
}

//
Expand Down

0 comments on commit 8d6fa09

Please sign in to comment.