Skip to content

Commit

Permalink
Fix crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaanderson committed Jan 12, 2014
1 parent d494cb7 commit cc9f346
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions app/app_delegate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def applicationDidFinishLaunching(notification)
@status_menu.addItem createMenuItem('Donations Appreciated', 'donations')
@status_menu.addItem createMenuItem('Quit', 'terminate:')

self.checkPrice
NSTimer.scheduledTimerWithTimeInterval(INTERVAL, target: self, selector: 'checkValue', userInfo: nil, repeats: true)
self.checkValue
end

def createMenuItem(name, action)
Expand All @@ -31,11 +32,9 @@ def donations
alert.runModal
end

def checkPrice
def checkValue
Dogecoin.toBtc do |price|
@status_item.setTitle(#{price}")
end

NSTimer.scheduledTimerWithTimeInterval(INTERVAL, target: self, selector: 'checkPrice', userInfo: nil, repeats: true)
end
end
4 changes: 3 additions & 1 deletion app/dogecoin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ def toBtc(&block)
AFMotion::JSON.get('http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid=132') do |result|
if result.success?
json = result.object
block.call(json[:return][:markets][:DOGE][:lasttradeprice])
btcValue = json[:return][:markets][:DOGE][:lasttradeprice]

block.call(btcValue)
end
end
end
Expand Down

0 comments on commit cc9f346

Please sign in to comment.