Skip to content

Commit

Permalink
Merge pull request #6 from rdio/useARC
Browse files Browse the repository at this point in the history
Use ARC, bump target to iOS 5.0
  • Loading branch information
dasevilla committed May 19, 2014
2 parents 717e13e + 1f36d5e commit ea9ae6f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Classes/HelloAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

+ (Rdio *)rdioInstance;

@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) HelloViewController *viewController;
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) HelloViewController *viewController;

@property (readonly) Rdio *rdio;

Expand Down
5 changes: 1 addition & 4 deletions Classes/HelloAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

rdio = [[Rdio alloc] initWithConsumerKey:CONSUMER_KEY andSecret:CONSUMER_SECRET delegate:nil];

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[HelloViewController alloc] init];

self.window.rootViewController = self.viewController;
Expand All @@ -43,9 +43,6 @@ - (void)dealloc

rdio.delegate = nil;
rdio.player.delegate = nil;
[rdio release];
[window release];
[super dealloc];
}


Expand Down
2 changes: 1 addition & 1 deletion Classes/HelloViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

@interface HelloViewController : UIViewController<RdioDelegate,RDPlayerDelegate>

@property (readonly, nonatomic) RDPlayer *player;
@property (readonly, nonatomic, weak) RDPlayer *player;

@end
25 changes: 4 additions & 21 deletions Classes/HelloViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ - (void)loadView
[_playButton setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[_playButton addTarget:self action:@selector(playClicked) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:_playButton];
[_playButton release];

// Login button
_loginButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
Expand All @@ -70,7 +69,6 @@ - (void)loadView
[_loginButton setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[_loginButton addTarget:self action:@selector(loginClicked) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:_loginButton];
[_loginButton release];

// Powered by Rdio label
CGRect labelFrame = CGRectMake(20, 110, appFrame.size.width - 40, 40);
Expand All @@ -79,7 +77,6 @@ - (void)loadView
[rdioLabel setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[rdioLabel setTextAlignment:NSTextAlignmentCenter];
[view addSubview:rdioLabel];
[rdioLabel release];

// Previous track button
UIButton *prevButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
Expand All @@ -89,7 +86,6 @@ - (void)loadView
[prevButton setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[prevButton addTarget:self action:@selector(previousClicked) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:prevButton];
[prevButton release];

// Next track button
UIButton *nextButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
Expand All @@ -99,59 +95,50 @@ - (void)loadView
[nextButton setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[nextButton addTarget:self action:@selector(nextClicked) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:nextButton];
[nextButton release];

// Left level label
CGRect leftLevelLabelFrame = CGRectMake(20, 151, 15, 21);
UILabel *leftLevelLabel = [[UILabel alloc] initWithFrame:leftLevelLabelFrame];
[leftLevelLabel setText:@"L"];
[view addSubview:leftLevelLabel];
[leftLevelLabel release];

// Left level
CGRect leftSliderFrame = CGRectMake(65, 151, 191, 28);
_leftLevelMonitor = [[UISlider alloc] initWithFrame:leftSliderFrame];
[_leftLevelMonitor setValue:0.0];
[view addSubview:_leftLevelMonitor];
[_leftLevelMonitor release];

// Right level label
CGRect rightLevelLabelFrame = CGRectMake(20, 191, 15, 21);
UILabel *rightLevelLabel = [[UILabel alloc] initWithFrame:rightLevelLabelFrame];
[rightLevelLabel setText:@"R"];
[view addSubview:rightLevelLabel];
[rightLevelLabel release];

// Right level
CGRect rightSliderFrame = CGRectMake(65, 191, 191, 28);
_rightLevelMonitor = [[UISlider alloc] initWithFrame:rightSliderFrame];
[_rightLevelMonitor setValue:0.0];
[view addSubview:_rightLevelMonitor];
[_rightLevelMonitor release];

// Current artist label
CGRect currentArtistFrame = CGRectMake(20, 258, 280, 25);
_currentArtistLabel = [[UILabel alloc] initWithFrame:currentArtistFrame];
[view addSubview:_currentArtistLabel];
[_currentArtistLabel release];

// Current track title
CGRect currentTrackFrame = CGRectMake(20, 316, 280, 25);
_currentTrackLabel = [[UILabel alloc] initWithFrame:currentTrackFrame];
[view addSubview:_currentTrackLabel];
[_currentTrackLabel release];

// Position label
CGRect posLabelFrame = CGRectMake(20, 287, 37, 21);
_positionLabel = [[UILabel alloc] initWithFrame:posLabelFrame];
[view addSubview:_positionLabel];
[_positionLabel release];

// Duration label
CGRect durLabelFrame = CGRectMake(264, 287, 37, 21);
_durationLabel = [[UILabel alloc] initWithFrame:durLabelFrame];
[view addSubview:_durationLabel];
[_durationLabel release];

// Position slider
CGRect posSliderFrame = CGRectMake(65, 287, 191, 28);
Expand All @@ -160,13 +147,11 @@ - (void)loadView
[_positionSlider addTarget:self action:@selector(seekFinished) forControlEvents:UIControlEventTouchUpInside];
[_positionSlider addTarget:self action:@selector(seekFinished) forControlEvents:UIControlEventTouchUpOutside];
[view addSubview:_positionSlider];
[_positionSlider release];

Rdio *sharedRdio = [HelloAppDelegate rdioInstance];
sharedRdio.delegate = self;

self.view = view;
[view release];
}

- (void)viewDidAppear:(BOOL)animated
Expand Down Expand Up @@ -207,36 +192,34 @@ - (NSUInteger)supportedInterfaceOrientations
- (void)startObservers
{
if (!_levelObserver) {
_levelObserver = [[self.player addPeriodicLevelObserverForInterval:CMTimeMake(1, 100)
_levelObserver = [self.player addPeriodicLevelObserverForInterval:CMTimeMake(1, 100)
queue:dispatch_get_main_queue()
usingBlock:^(Float32 left, Float32 right) {
[self setMonitorValuesForLeft:left andRight:right];
}] retain];
}];
}

if (!_timeObserver) {
_timeObserver = [[self.player addPeriodicTimeObserverForInterval:CMTimeMake(1, 100)
_timeObserver = [self.player addPeriodicTimeObserverForInterval:CMTimeMake(1, 100)
queue:dispatch_get_main_queue()
usingBlock:^(CMTime time) {
Float64 seconds = CMTimeGetSeconds(time);
if (!isnan(seconds) && !isinf(seconds)) {
[self positionUpdated:seconds];
}
}] retain];
}];
}
}

- (void)stopObservers
{
if (_levelObserver) {
[self.player removeLevelObserver:_levelObserver];
[_levelObserver release];
_levelObserver = nil;
}

if (_timeObserver) {
[self.player removeTimeObserver:_timeObserver];
[_timeObserver release];
_timeObserver = nil;
}
}
Expand Down
6 changes: 4 additions & 2 deletions Hello.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -229,6 +230,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -254,7 +256,7 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_LDFLAGS = "-all_load";
PREBINDING = NO;
SDKROOT = iphoneos;
Expand All @@ -269,7 +271,7 @@
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
OTHER_LDFLAGS = "-all_load";
PREBINDING = NO;
Expand Down

0 comments on commit ea9ae6f

Please sign in to comment.