Skip to content

Commit

Permalink
Merge pull request #8 from nearengine/2.2-dev
Browse files Browse the repository at this point in the history
Version 2.2 Release
  • Loading branch information
chrisshiplet committed Apr 18, 2015
2 parents 13284c7 + 390dc84 commit 5e7b549
Show file tree
Hide file tree
Showing 19 changed files with 648 additions and 45 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
btcbar
======

A tiny status bar widget for OS X that displays the latest USD/BTC spot price from BitStamp, BTCe, and Coinbase.
A tiny status bar widget for OS X that displays the latest USD/BTC spot price from several USD and CNY exchanges.

## Screenshot

Expand All @@ -19,14 +19,19 @@ Simply place btcbar.app in your `/Applications` folder, and optionally add it to

## Download

The current version of btcbar (2.1.4) can be downloaded here:
The current version of btcbar (2.2.0) can be downloaded here:

https://github.com/nearengine/btcbar/releases/download/v2.1.4/btcbar_2_1_4.zip
https://github.com/nearengine/btcbar/releases/download/v2.2.0/btcbar_2_2_0.zip

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

## Changelog

### 2.2.0

* Adds BitFinexUSD, WinkDexUSD, HuobiCNY and OKCoinCNY
* New status bar icon with Yosemite (dark theme) support

### 2.1.4

* Removes MtGox
Expand Down Expand Up @@ -76,4 +81,4 @@ The source is provided for inspection, considering the nature of Bitcoin. You ar

If for some reason you feel like donating a few micro btc to future development, those should go here:

`1AmsBDouePjXxe2R2kFwbuCdBSpsxwtrUt`
`1D3NtjVFpoXonqk3MZwsYD9iV5WA7MRXUj`
40 changes: 24 additions & 16 deletions btcbar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
830CE09B171B6C3E00DDD525 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 830CE099171B6C3E00DDD525 /* InfoPlist.strings */; };
830CE09D171B6C3E00DDD525 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 830CE09C171B6C3E00DDD525 /* main.m */; };
830CE0A4171B6C3E00DDD525 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 830CE0A3171B6C3E00DDD525 /* AppDelegate.m */; };
838F835018602990007A7AAE /* btclogoDim.png in Resources */ = {isa = PBXBuildFile; fileRef = 838F834E18602990007A7AAE /* btclogoDim.png */; };
838F835118602990007A7AAE /* btclogoDim@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 838F834F18602990007A7AAE /* btclogoDim@2x.png */; };
83C3E7491859700100FA2921 /* BitStampUSDFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 83C3E7421859700100FA2921 /* BitStampUSDFetcher.m */; };
83C3E74A1859700100FA2921 /* BTCeUSDFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 83C3E7441859700100FA2921 /* BTCeUSDFetcher.m */; };
83C3E74B1859700100FA2921 /* CoinbaseUSDFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 83C3E7461859700100FA2921 /* CoinbaseUSDFetcher.m */; };
83C3E74F1859702000FA2921 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 83C3E74E1859702000FA2921 /* MainMenu.xib */; };
83C3E7541859702D00FA2921 /* btclogo.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C3E7501859702D00FA2921 /* btclogo.png */; };
83C3E7551859702D00FA2921 /* btclogo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C3E7511859702D00FA2921 /* btclogo@2x.png */; };
83C3E7561859702D00FA2921 /* btclogoAlternate.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C3E7521859702D00FA2921 /* btclogoAlternate.png */; };
83C3E7571859702D00FA2921 /* btclogoAlternate@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83C3E7531859702D00FA2921 /* btclogoAlternate@2x.png */; };
83C3E759185970C800FA2921 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 83C3E758185970C800FA2921 /* Icon.icns */; };
90347B7918ACB073005C42A8 /* HuobiCNYFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 90347B7818ACB073005C42A8 /* HuobiCNYFetcher.m */; };
B65127471A71A1BB00FB6A24 /* OKCoinCNYFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = B65127461A71A1BB00FB6A24 /* OKCoinCNYFetcher.m */; };
B662833B1A712EBB00520512 /* BitFinexUSDFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = B662833A1A712EBB00520512 /* BitFinexUSDFetcher.m */; };
B662833E1A715EFB00520512 /* WinkDexUSDFetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = B662833D1A715EFB00520512 /* WinkDexUSDFetcher.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -38,8 +38,6 @@
830CE0A3171B6C3E00DDD525 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
830CE0AE171B6C3F00DDD525 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
838F4296182E2F6E00B4FC58 /* Fetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fetcher.h; sourceTree = "<group>"; };
838F834E18602990007A7AAE /* btclogoDim.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = btclogoDim.png; path = Icons/btclogoDim.png; sourceTree = "<group>"; };
838F834F18602990007A7AAE /* btclogoDim@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "btclogoDim@2x.png"; path = "Icons/btclogoDim@2x.png"; sourceTree = "<group>"; };
83C3E7411859700100FA2921 /* BitStampUSDFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BitStampUSDFetcher.h; path = Fetchers/BitStampUSDFetcher.h; sourceTree = "<group>"; };
83C3E7421859700100FA2921 /* BitStampUSDFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BitStampUSDFetcher.m; path = Fetchers/BitStampUSDFetcher.m; sourceTree = "<group>"; };
83C3E7431859700100FA2921 /* BTCeUSDFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BTCeUSDFetcher.h; path = Fetchers/BTCeUSDFetcher.h; sourceTree = "<group>"; };
Expand All @@ -49,9 +47,15 @@
83C3E74E1859702000FA2921 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = MainMenu.xib; path = Views/MainMenu.xib; sourceTree = "<group>"; };
83C3E7501859702D00FA2921 /* btclogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = btclogo.png; path = Icons/btclogo.png; sourceTree = "<group>"; };
83C3E7511859702D00FA2921 /* btclogo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "btclogo@2x.png"; path = "Icons/btclogo@2x.png"; sourceTree = "<group>"; };
83C3E7521859702D00FA2921 /* btclogoAlternate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = btclogoAlternate.png; path = Icons/btclogoAlternate.png; sourceTree = "<group>"; };
83C3E7531859702D00FA2921 /* btclogoAlternate@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "btclogoAlternate@2x.png"; path = "Icons/btclogoAlternate@2x.png"; sourceTree = "<group>"; };
83C3E758185970C800FA2921 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Icon.icns; path = ../Resources/Icon.icns; sourceTree = "<group>"; };
90347B7718ACB073005C42A8 /* HuobiCNYFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HuobiCNYFetcher.h; path = Fetchers/HuobiCNYFetcher.h; sourceTree = "<group>"; };
90347B7818ACB073005C42A8 /* HuobiCNYFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HuobiCNYFetcher.m; path = Fetchers/HuobiCNYFetcher.m; sourceTree = "<group>"; };
B65127451A71A1BB00FB6A24 /* OKCoinCNYFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OKCoinCNYFetcher.h; path = Fetchers/OKCoinCNYFetcher.h; sourceTree = "<group>"; };
B65127461A71A1BB00FB6A24 /* OKCoinCNYFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OKCoinCNYFetcher.m; path = Fetchers/OKCoinCNYFetcher.m; sourceTree = "<group>"; };
B66283391A712EBB00520512 /* BitFinexUSDFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BitFinexUSDFetcher.h; path = Fetchers/BitFinexUSDFetcher.h; sourceTree = "<group>"; };
B662833A1A712EBB00520512 /* BitFinexUSDFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BitFinexUSDFetcher.m; path = Fetchers/BitFinexUSDFetcher.m; sourceTree = "<group>"; };
B662833C1A715EFB00520512 /* WinkDexUSDFetcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WinkDexUSDFetcher.h; path = Fetchers/WinkDexUSDFetcher.h; sourceTree = "<group>"; };
B662833D1A715EFB00520512 /* WinkDexUSDFetcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WinkDexUSDFetcher.m; path = Fetchers/WinkDexUSDFetcher.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -134,10 +138,6 @@
83C3E758185970C800FA2921 /* Icon.icns */,
83C3E7501859702D00FA2921 /* btclogo.png */,
83C3E7511859702D00FA2921 /* btclogo@2x.png */,
83C3E7521859702D00FA2921 /* btclogoAlternate.png */,
83C3E7531859702D00FA2921 /* btclogoAlternate@2x.png */,
838F834E18602990007A7AAE /* btclogoDim.png */,
838F834F18602990007A7AAE /* btclogoDim@2x.png */,
);
name = Icons;
sourceTree = "<group>";
Expand All @@ -147,10 +147,18 @@
children = (
83C3E7411859700100FA2921 /* BitStampUSDFetcher.h */,
83C3E7421859700100FA2921 /* BitStampUSDFetcher.m */,
B65127451A71A1BB00FB6A24 /* OKCoinCNYFetcher.h */,
B65127461A71A1BB00FB6A24 /* OKCoinCNYFetcher.m */,
B662833C1A715EFB00520512 /* WinkDexUSDFetcher.h */,
B662833D1A715EFB00520512 /* WinkDexUSDFetcher.m */,
B66283391A712EBB00520512 /* BitFinexUSDFetcher.h */,
B662833A1A712EBB00520512 /* BitFinexUSDFetcher.m */,
83C3E7431859700100FA2921 /* BTCeUSDFetcher.h */,
83C3E7441859700100FA2921 /* BTCeUSDFetcher.m */,
83C3E7451859700100FA2921 /* CoinbaseUSDFetcher.h */,
83C3E7461859700100FA2921 /* CoinbaseUSDFetcher.m */,
90347B7718ACB073005C42A8 /* HuobiCNYFetcher.h */,
90347B7818ACB073005C42A8 /* HuobiCNYFetcher.m */,
);
name = Fetchers;
sourceTree = "<group>";
Expand Down Expand Up @@ -215,12 +223,8 @@
buildActionMask = 2147483647;
files = (
83C3E7541859702D00FA2921 /* btclogo.png in Resources */,
83C3E7561859702D00FA2921 /* btclogoAlternate.png in Resources */,
838F835118602990007A7AAE /* btclogoDim@2x.png in Resources */,
830CE09B171B6C3E00DDD525 /* InfoPlist.strings in Resources */,
83C3E7571859702D00FA2921 /* btclogoAlternate@2x.png in Resources */,
83C3E759185970C800FA2921 /* Icon.icns in Resources */,
838F835018602990007A7AAE /* btclogoDim.png in Resources */,
83C3E7551859702D00FA2921 /* btclogo@2x.png in Resources */,
83C3E74F1859702000FA2921 /* MainMenu.xib in Resources */,
);
Expand All @@ -234,7 +238,11 @@
buildActionMask = 2147483647;
files = (
83C3E7491859700100FA2921 /* BitStampUSDFetcher.m in Sources */,
B662833B1A712EBB00520512 /* BitFinexUSDFetcher.m in Sources */,
830CE09D171B6C3E00DDD525 /* main.m in Sources */,
B65127471A71A1BB00FB6A24 /* OKCoinCNYFetcher.m in Sources */,
B662833E1A715EFB00520512 /* WinkDexUSDFetcher.m in Sources */,
90347B7918ACB073005C42A8 /* HuobiCNYFetcher.m in Sources */,
83C3E74B1859700100FA2921 /* CoinbaseUSDFetcher.m in Sources */,
83C3E74A1859700100FA2921 /* BTCeUSDFetcher.m in Sources */,
830CE0A4171B6C3E00DDD525 /* AppDelegate.m in Sources */,
Expand Down
10 changes: 7 additions & 3 deletions btcbar/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
#import "BitStampUSDFetcher.h"
#import "CoinbaseUSDFetcher.h"
#import "BTCeUSDFetcher.h"
#import "BitFinexUSDFetcher.h"
#import "WinkDexUSDFetcher.h"
#import "OKCoinCNYFetcher.h"
#import "HuobiCNYFetcher.h"

@interface AppDelegate : NSObject <NSApplicationDelegate> {
NSMenu *btcbarMainMenu;
NSInteger currentFetcherTag;

NSStatusItem *btcbarStatusItem;

NSTimer *updateViewTimer;
NSTimer *updateDataTimer;

NSMutableArray *tickers;
NSUserDefaults *prefs;
}
Expand Down
45 changes: 24 additions & 21 deletions btcbar/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,64 @@ - (void)awakeFromNib
{
// Load ticker preference from disk
prefs = [NSUserDefaults standardUserDefaults];

// Register update notifications for tickers
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(handleTickerNotification:)
name:@"btcbar_ticker_update"
object:nil];

// Pass each ticker object into a dictionary, get first updates
tickers = [NSMutableArray arrayWithObjects:
[[BitStampUSDFetcher alloc] init],
[[BTCeUSDFetcher alloc] init],
[[CoinbaseUSDFetcher alloc] init],
[[BitFinexUSDFetcher alloc] init],
[[WinkDexUSDFetcher alloc] init],
[[OKCoinCYNFetcher alloc] init],
[[HuobiCNYFetcher alloc] init],
nil];



// If ticker preference does not exist, default to 0
if (![prefs integerForKey:@"btcbar_ticker"])
[prefs setInteger:0 forKey:@"btcbar_ticker"];
currentFetcherTag = [prefs integerForKey:@"btcbar_ticker"];

// If ticker preference exceeds the bounds of `tickers`, default to 0
if (currentFetcherTag < 0 || currentFetcherTag >= [tickers count])
currentFetcherTag = 0;

// Initialize main menu
btcbarMainMenu = [[NSMenu alloc] initWithTitle:@"loading..."];

// Add each loaded ticker object to main menu
for(id <Fetcher> ticker in tickers)
{
NSMenuItem *new_menuitem = [[NSMenuItem alloc] initWithTitle:[ticker ticker_menu] action:@selector(menuActionSetTicker:) keyEquivalent:@""];
new_menuitem.tag = [tickers indexOfObject:ticker];
[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:@""]];
[btcbarMainMenu addItem:[[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(menuActionQuit:) keyEquivalent:@"q"]];

// Set the default ticker's menu item state to checked
[[btcbarMainMenu.itemArray objectAtIndex:currentFetcherTag] setState:NSOnState];

// Initialize status bar item with flexible width
btcbarStatusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];

// Set status bar image and highlighted image
btcbarStatusItem.image = [NSImage imageNamed:@"btclogoDim"];
btcbarStatusItem.alternateImage = [NSImage imageNamed:@"btclogoAlternate"];
// Set status bar image
NSImage *image = [NSImage imageNamed:@"btclogo"];
[image setTemplate:YES];
[btcbarStatusItem setImage:image];

// Set menu options on click
btcbarStatusItem.highlightMode = YES;
btcbarStatusItem.menu = btcbarMainMenu;

// Setup timer to update all tickers every 10 seconds
updateDataTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(updateDataTimerAction:) userInfo:nil repeats:YES];
}
Expand All @@ -87,18 +90,18 @@ - (void)menuActionSetTicker:(id)sender
// Set all menu items to "off" state
for (NSMenuItem *menuitem in btcbarMainMenu.itemArray)
menuitem.state = NSOffState;

// Set this menu item to "on" state
[sender setState:NSOnState];

// Update ticker preference
currentFetcherTag = [sender tag];
[prefs setInteger:currentFetcherTag forKey:@"btcbar_ticker"];
[prefs synchronize];

// Update the requested ticker immediately
[[tickers objectAtIndex:currentFetcherTag] requestUpdate];

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

Expand Down Expand Up @@ -134,7 +137,7 @@ -(void)handleTickerNotification:(NSNotification *)pNotification
// Set the ticker value in the menu to the short error
[[[btcbarMainMenu itemArray] objectAtIndex:[tickers indexOfObject:[pNotification object]]] setTitle:[NSString stringWithFormat:@"[%@] %@",[[pNotification object] error].localizedDescription, [[pNotification object] ticker_menu]]];
}

// If this notification is for the currently selected ticker, update the status item too
if ([pNotification object] == [tickers objectAtIndex:currentFetcherTag])
{
Expand All @@ -152,7 +155,7 @@ -(void)handleTickerNotification:(NSNotification *)pNotification
btcbarStatusItem.toolTip = [[tickers objectAtIndex:currentFetcherTag] ticker_menu];
}
}

}

// Requests for each Fetcher to update itself
Expand Down
22 changes: 22 additions & 0 deletions btcbar/Fetchers/BitFinexUSDFetcher.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// BitFinexUSDFetcher.h
// btcbar
//
// Created by Tim Daubenschütz on 22/01/15.
// Copyright (c) 2015 nearengine. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Fetcher.h"

@interface BitFinexUSDFetcher : NSObject<Fetcher, NSURLConnectionDelegate>

@property (nonatomic) NSString* ticker;
@property (nonatomic) NSString* ticker_menu;
@property (nonatomic) NSString* url;
@property (nonatomic) NSError* error;
@property (nonatomic) NSMutableData *responseData;

- (void)requestUpdate;

@end
Loading

0 comments on commit 5e7b549

Please sign in to comment.