Permalink
Browse files

Added registered API 2.0 key

1. Added registered key to the requests, so you can now request 10000 requests per day
2. Cosmetic formatting
  • Loading branch information...
1 parent cb032e0 commit 51a990faad8895858b3dfd783a3877fd081c48f8 @BinyaminSharet committed Apr 28, 2012
Showing with 9 additions and 6 deletions.
  1. +2 −1 SONotifier/BaseMenu.h
  2. +2 −3 SONotifier/BaseMenu.m
  3. +2 −0 SONotifier/Globals.h
  4. +2 −1 SONotifier/PersistantData.m
  5. +1 −1 SONotifier/UpdateManager.m
View
@@ -38,5 +38,6 @@
- (void) buildUi;
- (void) updateCompletedWithUpdater:(id)updater;
- (void) updateFailedForProblem:(UPDATE_PROBLEMS)problem;
-- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item;
+- (void) menuWillOpen:(NSMenu *)menu;
+- (void) menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item;
@end
View
@@ -53,7 +53,7 @@ - (void) setStatusIconWithImagePath:(NSString *) image_name
[statusItem setImage:imageObj];
}
-- (void)statusBarClicked:(id)sender
+- (void)menuWillOpen:(NSMenu *)menu
{
if (connect_status == CONNECTION_STATUS_ONLINE)
{
@@ -72,7 +72,6 @@ - (void) initStatusItem
[statusItem setHighlightMode:YES];
[statusItem setEnabled:YES];
[statusItem setTarget:self];
- [statusItem setAction:@selector(statusBarClicked:)];
}
- (void) quitApp
@@ -222,7 +221,7 @@ - (void) updateReputationInfoWithData:(UserData *) data
NSNumber * offset;
lastSetRep = [data reputation];
offset = [NSNumber numberWithInt:[lastSetRep intValue] - [lastViewedRep intValue]];
- if (([offset intValue] <= 0) || ([lastViewedRep intValue] == 0))
+ if (([offset intValue] == 0) || ([lastViewedRep intValue] == 0))
{
[menuItem setTitle:[NSString stringWithFormat:@"Rep: %@", [data reputation]]];
}
View
@@ -37,6 +37,8 @@
// Base URL
#define API_20_BASE_URL @"http://api.stackexchange.com/2.0"
#define API_20_FILTER_QUESTIONS @"!-rf7acLF"
+#define API_20_APP_ID @"&client_id=287"
+#define API_20_APP_KEY @"&key=nWxVLEQliwjmk5QH5NZIpw(("
// Keys for parsing server JSON response
@@ -40,8 +40,9 @@ + (id)retrieveFromUserDefaults:(NSString *)key
id val = nil;
if (standardUserDefaults)
+ {
val = [standardUserDefaults objectForKey:key];
-
+ }
return val;
}
@@ -67,7 +67,7 @@ - (NSString *) getDataForUrl:(NSString *)urlString
- (NSString *) getDataForApiRequest:(NSString *) apiRequest
{
- NSString * urlString = [NSString stringWithFormat:@"%@%@", API_20_BASE_URL, apiRequest];
+ NSString * urlString = [NSString stringWithFormat:@"%@%@%@%@", API_20_BASE_URL, apiRequest, API_20_APP_ID, API_20_APP_KEY];
return [self getDataForUrl:urlString];
}

0 comments on commit 51a990f

Please sign in to comment.