2012-06-13 18:07:24 -07:00
|
|
|
//
|
|
|
|
// FirstTimeUserViewController.m
|
|
|
|
// NewsBlur
|
|
|
|
//
|
|
|
|
// Created by Roy Yang on 6/13/12.
|
|
|
|
// Copyright (c) 2012 NewsBlur. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "FirstTimeUserViewController.h"
|
|
|
|
#import "NewsBlurAppDelegate.h"
|
2012-07-22 14:23:50 -07:00
|
|
|
#import "FirstTimeUserAddSitesViewController.h"
|
2012-08-14 17:20:45 -07:00
|
|
|
#import <QuartzCore/QuartzCore.h>
|
2012-06-13 18:07:24 -07:00
|
|
|
|
2012-06-15 10:49:51 -07:00
|
|
|
#define WELCOME_BUTTON_TITLE @"LET'S GET STARTED"
|
2012-06-15 15:02:30 -07:00
|
|
|
#define ADD_SITES_SKIP_BUTTON_TITLE @"SKIP THIS STEP"
|
|
|
|
#define ADD_SITES_BUTTON_TITLE @"NEXT"
|
2012-06-15 10:49:51 -07:00
|
|
|
#define ADD_FRIENDS_BUTTON_TITLE @"SKIP THIS STEP"
|
|
|
|
#define ADD_NEWSBLUR_BUTTON_TITLE @"FINISH"
|
|
|
|
|
2012-08-11 16:43:53 -07:00
|
|
|
@interface FirstTimeUserViewController ()
|
|
|
|
|
|
|
|
@property (readwrite) float angle_;
|
2012-08-12 18:07:54 -07:00
|
|
|
@property (readwrite) float timerInterval_;
|
|
|
|
@property (nonatomic) NSTimer *timer_;
|
2012-08-11 16:43:53 -07:00
|
|
|
@end
|
|
|
|
|
2012-06-13 18:07:24 -07:00
|
|
|
@implementation FirstTimeUserViewController
|
|
|
|
|
2012-06-15 10:49:51 -07:00
|
|
|
@synthesize appDelegate;
|
2012-06-15 15:02:30 -07:00
|
|
|
@synthesize nextButton;
|
2012-06-20 07:39:49 -07:00
|
|
|
@synthesize logo;
|
2012-08-11 18:03:28 -07:00
|
|
|
@synthesize header;
|
|
|
|
@synthesize footer;
|
2012-08-11 16:43:53 -07:00
|
|
|
@synthesize angle_;
|
2012-08-12 18:07:54 -07:00
|
|
|
@synthesize timerInterval_;
|
|
|
|
@synthesize timer_;
|
2012-06-14 10:19:36 -07:00
|
|
|
|
2012-06-13 18:07:24 -07:00
|
|
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
|
|
|
{
|
|
|
|
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
|
|
|
if (self) {
|
|
|
|
// Custom initialization
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)viewDidLoad
|
|
|
|
{
|
|
|
|
[super viewDidLoad];
|
2020-08-29 21:19:32 -07:00
|
|
|
|
|
|
|
self.appDelegate = [NewsBlurAppDelegate sharedAppDelegate];
|
|
|
|
|
2016-10-05 21:03:32 -07:00
|
|
|
UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"Get Started" style:UIBarButtonItemStylePlain target:self action:@selector(tapNextButton)];
|
2012-07-22 14:23:50 -07:00
|
|
|
self.nextButton = next;
|
|
|
|
self.navigationItem.rightBarButtonItem = next;
|
2013-03-04 18:21:10 -08:00
|
|
|
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
|
2012-08-11 18:03:28 -07:00
|
|
|
header.font = [UIFont systemFontOfSize:22];
|
2013-03-04 18:21:10 -08:00
|
|
|
footer.font = [UIFont systemFontOfSize:22];
|
2012-08-11 18:03:28 -07:00
|
|
|
}
|
2012-08-14 17:20:45 -07:00
|
|
|
|
2012-08-15 13:04:05 -07:00
|
|
|
UITapGestureRecognizer *singleFingerTap =
|
|
|
|
[[UITapGestureRecognizer alloc] initWithTarget:self
|
|
|
|
action:@selector(tapNextButton)];
|
|
|
|
[self.view addGestureRecognizer:singleFingerTap];
|
2012-07-22 14:23:50 -07:00
|
|
|
|
2012-06-13 18:07:24 -07:00
|
|
|
}
|
|
|
|
|
2012-06-20 07:39:49 -07:00
|
|
|
- (void)viewWillAppear:(BOOL)animated {
|
2014-09-18 11:25:51 -07:00
|
|
|
[super viewWillAppear:animated];
|
|
|
|
|
2012-08-14 17:20:45 -07:00
|
|
|
[self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
|
|
|
|
|
|
|
|
UIImage *logoImg = [UIImage imageNamed:@"logo_512"];
|
|
|
|
UIImageView *logoView = [[UIImageView alloc] initWithImage:logoImg];
|
2014-09-24 12:37:13 -07:00
|
|
|
CGFloat width = CGRectGetWidth(self.view.frame);
|
|
|
|
CGFloat height = CGRectGetHeight(self.view.frame);
|
2020-03-29 16:21:00 -07:00
|
|
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
|
2014-09-24 12:37:13 -07:00
|
|
|
logoView.frame = CGRectMake((width-220)/2, (height-220)/2-50, 220, 220);
|
2012-08-14 17:20:45 -07:00
|
|
|
} else {
|
2014-09-24 12:37:13 -07:00
|
|
|
logoView.frame = CGRectMake((width-240)/2, (height-240)/2-50, 240, 240);
|
2012-08-14 17:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
self.logo = logoView;
|
|
|
|
[self.view addSubview:self.logo];
|
2012-06-20 07:39:49 -07:00
|
|
|
[self rotateLogo];
|
|
|
|
}
|
|
|
|
|
2012-07-22 14:23:50 -07:00
|
|
|
- (void)viewDidAppear:(BOOL)animated {
|
2014-09-18 11:25:51 -07:00
|
|
|
[super viewDidAppear:animated];
|
2012-08-14 17:20:45 -07:00
|
|
|
}
|
2012-07-22 14:23:50 -07:00
|
|
|
|
2012-08-14 17:20:45 -07:00
|
|
|
- (void)viewDidDisappear:(BOOL)animated {
|
2014-09-18 11:25:51 -07:00
|
|
|
[super viewDidDisappear:animated];
|
|
|
|
|
2012-08-14 17:20:45 -07:00
|
|
|
self.logo = nil;
|
2012-07-22 14:23:50 -07:00
|
|
|
}
|
|
|
|
|
2020-08-27 21:26:12 -07:00
|
|
|
//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
|
|
|
// // Return YES for supported orientations
|
|
|
|
// if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
|
|
|
|
// return YES;
|
|
|
|
// } else if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
|
|
|
|
// return YES;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return NO;
|
|
|
|
//}
|
2012-06-13 18:07:24 -07:00
|
|
|
|
2012-06-14 10:19:36 -07:00
|
|
|
|
2012-06-15 15:02:30 -07:00
|
|
|
- (IBAction)tapNextButton {
|
2020-12-24 13:49:27 -08:00
|
|
|
[appDelegate.ftuxNavigationController showViewController:appDelegate.firstTimeUserAddSitesViewController sender:self];
|
2012-06-15 16:35:54 -07:00
|
|
|
}
|
2012-06-15 15:02:30 -07:00
|
|
|
|
2012-06-20 07:39:49 -07:00
|
|
|
- (void)rotateLogo {
|
2012-08-11 16:43:53 -07:00
|
|
|
angle_ = 0;
|
2012-08-12 18:07:54 -07:00
|
|
|
timerInterval_ = 0.01;
|
|
|
|
|
2020-09-23 21:30:31 -07:00
|
|
|
[UIView animateWithDuration:1 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
|
|
|
self.timer_ = [NSTimer scheduledTimerWithTimeInterval: self.timerInterval_ target: self selector:@selector(handleTimer:) userInfo: nil repeats: YES];
|
|
|
|
} completion:nil];
|
2012-08-11 16:43:53 -07:00
|
|
|
}
|
|
|
|
|
2012-08-12 18:07:54 -07:00
|
|
|
-(void)handleTimer:(NSTimer *)timer
|
2012-08-11 16:43:53 -07:00
|
|
|
{
|
2012-08-12 18:07:54 -07:00
|
|
|
timerInterval_ += .01;
|
2012-08-11 16:43:53 -07:00
|
|
|
angle_ += 0.001;
|
|
|
|
if (angle_ > 6.283) {
|
|
|
|
angle_ = 0;
|
|
|
|
}
|
|
|
|
|
2012-08-14 17:20:45 -07:00
|
|
|
CGAffineTransform transform = CGAffineTransformMakeRotation(angle_);
|
2012-08-11 16:43:53 -07:00
|
|
|
self.logo.transform = transform;
|
2012-06-20 07:39:49 -07:00
|
|
|
}
|
|
|
|
|
2012-06-13 18:07:24 -07:00
|
|
|
@end
|