Skip to content

Commit

Permalink
2.1.1 adds live prices to menu
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisshiplet committed Nov 9, 2013
1 parent 5f2dd05 commit 17a1c87
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 18 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,37 @@ Simply place btcbar.app in your `/Applications` folder, and optionally add it to

## Download

The current version of btcbar (2.1.0) can be downloaded here:
The current version of btcbar (2.1.1) can be downloaded here:

https://github.com/nearengine/btcbar/releases/download/v2.1.0/btcbar_2_1_0.zip
https://github.com/nearengine/btcbar/releases/download/v2.1.1/btcbar_2_1_1.zip

It requires OS X 10.7+ and a 64-bit processor.

## Changelog

### 2.1.1

* Enables live prices in menu
* Fixes a minor bug in the ticker switching code

### 2.1.0

* New BTCe/USD ticker
* Manually refreshes when a ticker is clicked
* Decreased disk io/cpu time/power usage
* Greatly increased modularity (tickers now have a protocol, menu is dynamically generated)
* Decreases disk io/cpu time/power usage
* Greatly increases modularity (tickers now have a protocol, menu is dynamically generated)

### 2.0.0

Adds Bitstamp and Coinbase, and a little better backend abstraction so it will be easier to add future tickers.
* Adds Bitstamp and Coinbase, and a little better backend abstraction so it will be easier to add future tickers.

TODO:
* Live updating prices for each menu item in the dropdown
* More robust abstraction of tickers/dynamic menu

### 1.0.0

The first release, which uses MtGox's USD ticker API.
* The first release, which uses MtGox's USD ticker API.

## Donate

Expand Down
Binary file modified Resources/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 11 additions & 7 deletions btcbar/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ - (void)awakeFromNib
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(handleTickerNotification:)
name:@"ticker_update"
name:@"btcbar_ticker_update"
object:nil];

// Pass each ticker object into a dictionary, get first updates
Expand Down Expand Up @@ -50,14 +50,14 @@ - (void)awakeFromNib
for(id <Fetcher> ticker in tickers)
{
NSUInteger tag = [tickers indexOfObject:ticker];
NSMenuItem *new_menuitem = [[NSMenuItem alloc] initWithTitle:[ticker ticker_menu] action:@selector(menuActionSetTicker:) keyEquivalent:[NSString stringWithFormat:@"%lu", (unsigned long)tag+1]];
NSMenuItem *new_menuitem = [[NSMenuItem alloc] initWithTitle:[ticker ticker_menu] action:@selector(menuActionSetTicker:) keyEquivalent:@""];
[new_menuitem setTag:tag];
[btcbarMainMenu addItem:new_menuitem];
}

// Add the separator, Open in Browser, and Quit items to main menu
[btcbarMainMenu addItem:[NSMenuItem separatorItem]];
[btcbarMainMenu addItem:[[NSMenuItem alloc] initWithTitle:@"Open in Browser" action:@selector(menuActionBrowser:) keyEquivalent:@"o"]];
[btcbarMainMenu addItem:[[NSMenuItem alloc] initWithTitle:@"Open in Browser" action:@selector(menuActionBrowser:) keyEquivalent:@""]];
[btcbarMainMenu addItem:[[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(menuActionQuit:) keyEquivalent:@"q"]];

// Set the default ticker's menu item state to checked
Expand Down Expand Up @@ -101,8 +101,8 @@ - (void)menuActionSetTicker:(id)sender
// Update the requested ticker immediately
[[tickers objectAtIndex:currentFetcherTag] requestUpdate];

//Force the status item value to update
[[NSNotificationCenter defaultCenter] postNotificationName:@"ticker_update" object:self];
// Force the status item value to update
[[NSNotificationCenter defaultCenter] postNotificationName:@"btcbar_ticker_update" object:[tickers objectAtIndex:currentFetcherTag]];

}

Expand All @@ -123,13 +123,17 @@ - (void)menuActionQuit:(id)sender
// CALLBACKS
//

// Updates the status item with the latest ticker value
// Handles Fetcher completion notifications
-(void)handleTickerNotification:(NSNotification *)pNotification
{
// Set the status item to the current Fetcher's ticker
[btcbarStatusItem setTitle:[(id <Fetcher>)[tickers objectAtIndex:currentFetcherTag] ticker]];

// Set the menu item of the notifying Fetcher to its latest ticker value
[[[btcbarMainMenu itemArray] objectAtIndex:[tickers indexOfObject:[pNotification object]]] setTitle:[NSString stringWithFormat:@"[%@] %@",[[pNotification object] ticker], [[pNotification object] ticker_menu]]];
}

// Requests for each ticker to update itself
// Requests for each Fetcher to update itself
- (void)updateDataTimerAction:(NSTimer*)timer
{
for (id <Fetcher> ticker in tickers)
Expand Down
2 changes: 1 addition & 1 deletion btcbar/BTCeUSDFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)setTicker:(NSString *)tickerString
_ticker = tickerString;

// Trigger notification to update ticker
[[NSNotificationCenter defaultCenter] postNotificationName:@"ticker_update" object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"btcbar_ticker_update" object:self];
}

// Initiates an asyncronous HTTP connection
Expand Down
2 changes: 1 addition & 1 deletion btcbar/BitStampUSDFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)setTicker:(NSString *)tickerString
_ticker = tickerString;

// Trigger notification to update ticker
[[NSNotificationCenter defaultCenter] postNotificationName:@"ticker_update" object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"btcbar_ticker_update" object:self];
}

// Initiates an asyncronous HTTP connection
Expand Down
2 changes: 1 addition & 1 deletion btcbar/CoinbaseUSDFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)setTicker:(NSString *)tickerString
_ticker = tickerString;

// Trigger notification to update ticker
[[NSNotificationCenter defaultCenter] postNotificationName:@"ticker_update" object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"btcbar_ticker_update" object:self];
}

// Initiates an asyncronous HTTP connection
Expand Down
2 changes: 1 addition & 1 deletion btcbar/MtGoxUSDFetcher.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)setTicker:(NSString *)tickerString
_ticker = tickerString;

// Trigger notification to update ticker
[[NSNotificationCenter defaultCenter] postNotificationName:@"ticker_update" object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:@"btcbar_ticker_update" object:self];
}

// Initiates an asyncronous HTTP connection
Expand Down
2 changes: 1 addition & 1 deletion btcbar/btcbar-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1</string>
<string>2.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 17a1c87

Please sign in to comment.