Created
March 18, 2011 12:39
-
-
Save jamesbrink/875996 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import <Foundation/CPObject.j> | |
@import "UserSessionController.j" | |
@implementation AppController : CPObject | |
{ | |
CPWindow mainWindow; //this "outlet" is connected automatically by the Cib | |
CPToolbar toolbar; | |
CPToolbarItem toolItemSearch; | |
CPToolbarItem toolItemUserName; | |
CPSearchField searchField; | |
CPTextField labelUserName; | |
CPString test; | |
UserSessionController userSessionController; | |
} | |
- (void)applicationDidFinishLaunching:(CPNotification)aNotification | |
{ | |
} | |
- (void)awakeFromCib | |
{ | |
[mainWindow setFullBridge:YES]; | |
[labelUserName setStringValue:""]; | |
[self checkAuth]; | |
} | |
//Called to see if we are authenticated or not | |
-(void)checkAuth | |
{ | |
var request = [[CPURLRequest alloc] initWithURL:[CPURL URLWithString: @"/user_sessions/authenticated"]]; | |
[request setHTTPMethod:@"GET"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
test = [[CPString alloc] init]; | |
[CPURLConnection connectionWithRequest:request delegate:self]; | |
[labelUserName setStringValue:@"horse shit"]; | |
} | |
- (void)connection:(CPURLConnection) connection didReceiveData:(CPString)data | |
{ | |
console.log([labelUserName stringValue]); | |
[labelUserName setStringValue:data]; | |
console.log([labelUserName stringValue]); | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
horse shit | |
false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment