This file contains hidden or 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 "LoginViewController.h" | |
| #import "Global.h" | |
| #import "MeetupTopic.h" | |
| #import "UserAuthenticated.h" | |
| @interface LoginViewController () <UIWebViewDelegate> | |
| @property (strong, nonatomic) UIWebView* webView; | |
| @property (strong, nonatomic) NSNumber* userId; | |
| @end |
This file contains hidden or 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
| - (void)goGoogle | |
| { | |
| GPPSignIn *signIn = [GPPSignIn sharedInstance]; | |
| signIn.delegate = self; | |
| signIn.shouldFetchGoogleUserEmail = YES; | |
| signIn.clientID = GOOGLE_CLIENTID; | |
| signIn.scopes = [NSArray arrayWithObjects:kGTLAuthScopePlusLogin,nil]; | |
| signIn.actions = [NSArray arrayWithObjects:@"http://schemas.google.com/ListenActivity",nil]; | |
| [signIn authenticate]; | |
| } |
This file contains hidden or 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
| - (void)textViewDidBeginEditing:(UITextView *)textView | |
| { | |
| [self animateTextView:textView up: YES]; | |
| } | |
| - (void)textViewDidEndEditing:(UITextView *)textView | |
| { | |
| [self animateTextView:textView up:NO]; | |
| } |
This file contains hidden or 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
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
| { | |
| self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | |
| self.window.backgroundColor = [UIColor clearColor]; | |
| ViewController *viewController = [[ViewController alloc] init]; | |
| self.window.rootViewController = viewController; | |
This file contains hidden or 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
| ACAccountStore *store = [[ACAccountStore alloc] init]; // Long-lived | |
| ACAccountType *twitterType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; | |
| [store requestAccessToAccountsWithType:twitterType withCompletionHandler:^(BOOL granted, NSError *error) { | |
| if(granted) { | |
| // Access has been granted, now we can access the accounts | |
| // Remember that twitterType was instantiated above | |
| NSArray *twitterAccounts = [store accountsWithAccountType:twitterType]; | |
| // If there are no accounts, we need to pop up an alert | |
| if(twitterAccounts != nil && [twitterAccounts count] == 0) { |
This file contains hidden or 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
| // on button click, get and display user location to view | |
| - (void)cityStateFinder | |
| { | |
| NSLog(@"%s [Line %d]", __PRETTY_FUNCTION__, __LINE__); | |
| // init location | |
| locationManager.desiredAccuracy = kCLLocationAccuracyBest; | |
| locationManager.distanceFilter = kCLDistanceFilterNone; |
This file contains hidden or 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
| // Rex Fatahi Jan 2014 | |
| // use as category for NSString* | |
| + (NSString *)randomNameGenerator:(NSInteger)characterLength | |
| { | |
| NSString *letters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; | |
| NSMutableString *randomString = [NSMutableString stringWithCapacity:characterLength]; | |
| for (int i = 0; i < characterLength; i++) { | |
| [randomString appendFormat: @"%C", [letters characterAtIndex: arc4random() % [letters length]]]; |
This file contains hidden or 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
| + (NSNumber *)randomNumberFromRangeMax:(NSInteger)aMax Min:(NSInteger)aMin | |
| { | |
| return [NSNumber numberWithInt:(int)(rand() % (aMax - aMin + 1) + aMin)]; | |
| } |
This file contains hidden or 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
| - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { | |
| if( [text rangeOfCharacterFromSet:[NSCharacterSet newlineCharacterSet]].location == NSNotFound ) { | |
| return YES; | |
| } | |
| [self animateTextView:NO]; | |
| [textView resignFirstResponder]; | |
| return NO; | |
| } |
This file contains hidden or 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
| - (BOOL)isAllDigits:(NSString *)input | |
| { | |
| NSCharacterSet* nonNumbers = [[NSCharacterSet decimalDigitCharacterSet] invertedSet]; | |
| NSRange r = [input rangeOfCharacterFromSet: nonNumbers]; | |
| return r.location == NSNotFound; | |
| } |