Ryan Detzel

Pandora, Your iPhone App Sucks in the Car, Here Is the Code to Fix It

I can’t be the first person to notice this and I’m really surprised that a public company(or am I?) has taken this long to update their app so that it’s even close to their competition. Anyway, let me explain my three pet peeves with the Pandora app while in the car.

First, the damn interface buttons are too small and too close together for quick glances. A day doesn’t go by where I don’t pause instead of skip or skip(Arg!) instead of pause. Since there is no tactical feedback on the iPhone I have to physically look down at the device to change songs; Bad idea when I’m cruising 80 mph down the Mass Pike. Instead why don’t you offer swipe to skip and double tap to pause/play. This would allow me to skips songs and/or play/pause with not so much as a glance at the phone. Here’s the code to implement it.

This code is not complete. My Objective-C is a little rusty but it should get the point across on how easy it is to implement these features. This code was not tested so it might not even work. :-P

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
- (void)viewDidLoad{
    //...Your other magical code

    UISwipeGestureRecognizer *rightRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
    rightRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;
    [self.view addGestureRecognizer:rightRecognizer];
    [rightRecognizer release];

    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
    [doubleTap setNumberOfTapsRequired:2];
    [self.view addGestureRecognizer:doubleTap];
    [doubleTap release];
}

- (void)handleSwipe:(UISwipeGestureRecognizer*)gestureRecognizer {
    // Skip!
}

-(void)handleDoubleTap:(UISwipeGestureRecognizer*)gestureRecognizer{
    //If currently playing
        // Pause
    //Else
        // Play
}

The other thing that really grinds my gears is when you pop up that damn “Sorry, our music licenses…” alert. Sure I get why you have to alert me that I’ve skipped too many times but the alert interface(again while driving) is horrible. I skip(while trying to avoid the play button) and nothing happens. Damn, I have to look down again and I see the message and now I have to look even longer and aim for the OK button to dismiss it. Pain in the ass! A simple audible alert and a modal that fades away would be perfect. Here’s the code, help yourself.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-(void)handleLicenseWarning{
    /* You already have this function, change that damn alert to this */

    NSURL *soundFileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"bong.mp3" ofType:@"mp3"]];
    AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:soundFileURL error:nil];
    [player play];

    UIView *licenseWarning = [[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2-100,
                                                                                                                                            self.view.frame.size.width/2-50,
                                                                                                                                            200, 100)];
    [licenseWarning setBackgroundColor:[UIColor darkGrayColor]];
    [licenseWarning setAlpha:0.8];
    [licenseWarning.layer setCornerRadius:8];
    [licenseWarning.layer setMasksToBounds:YES];
    [licenseWarning setTag:123];

    UILabel *warning = [[UILabel alloc] initWithFrame:CGRectMake(10,10,180,80)];
    [warning setBackgroundColor:[UIColor clearColor]];
    [warning setText:@"Blah blah, our license..."];
    [warning setTextColor:[UIColor whiteColor]];
    [licenseWarning addSubview:warning];
    [warning release];

    [self.view addSubview:licenseWarning];
    [licenseWarning release];

    [NSTimer scheduledTimerWithTimeInterval:4
                                          target:self
                                        selector:@selector(hideWarning)
                                        userInfo:nil
                                         repeats:NO];
}

-(void)hideWarning{
    [UIView animateWithDuration:0.5 animations:^{
        [[self.view viewWithTag:123] setAlpha:0.0];
    } completion:^(BOOL b){
        [[self.view viewWithTag:123] removeFromSuperview];
    }];
}

I’ll expect these features in your next release which is coming any day now, right?

ios

Comments