Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Commit

Permalink
Display the correct item type in the share confirmation popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Steele committed Oct 6, 2011
1 parent 3cc6d99 commit 70883f3
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Classes/ShareActionSheet.m
Expand Up @@ -240,29 +240,37 @@ - (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)p
}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
NSString *type;
ABMultiValueRef value = ABRecordCopyValue(person, property);
NSString *email = (NSString *)ABMultiValueCopyValueAtIndex(value, ABMultiValueGetIndexForIdentifier(value, identifier));
[viewController dismissModalViewControllerAnimated:YES];

if( _track ) {
if( _event ) {
[[LastFMService sharedInstance] recommendEvent:[[_event objectForKey:@"id"] intValue]
toEmailAddress:email];
type = @"event";
} else if( _track ) {
[[LastFMService sharedInstance] recommendTrack:_track
byArtist:_artist
toEmailAddress:email];
type = @"track";
} else if ( _album ) {
[[LastFMService sharedInstance] recommendAlbum:_album
byArtist:_artist
toEmailAddress:email];
type = @"album";
} else {
[[LastFMService sharedInstance] recommendArtist:_artist
toEmailAddress:email ];
type = @"artist";
}
[email release];
CFRelease(value);

if([LastFMService sharedInstance].error)
[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) reportError:[LastFMService sharedInstance].error];
else
[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) displayError:NSLocalizedString(@"SHARE_SUCCESSFUL", @"Share successful") withTitle:NSLocalizedString(@"SHARE_SUCCESSFUL_TITLE", @"Share successful title")];
[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) displayError:[NSString stringWithFormat:@"This %@ was successfully shared.", type] withTitle:[NSString stringWithFormat:@"%@ Shared", [type capitalizedString]]];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque animated:YES];
return NO;
}
Expand Down Expand Up @@ -291,25 +299,30 @@ - (void)shareToFriend {
}

- (void)friendsViewController:(FriendsViewController *)friends didSelectFriend:(NSString *)username {
NSString *type;
if( _event ) {
[[LastFMService sharedInstance] recommendEvent:[[_event objectForKey:@"id"] intValue]
toEmailAddress:username];
type = @"event";
} else if( _track ) {
[[LastFMService sharedInstance] recommendTrack:_track
byArtist:_artist
toEmailAddress:username];
type = @"track";
} else if ( _album ) {
[[LastFMService sharedInstance] recommendAlbum:_album
byArtist:_artist
toEmailAddress:username];
type = @"album";
} else {
[[LastFMService sharedInstance] recommendArtist:_artist
toEmailAddress:username];
type = @"artist";
}
if([LastFMService sharedInstance].error)
[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) reportError:[LastFMService sharedInstance].error];
else
[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) displayError:NSLocalizedString(@"SHARE_SUCCESSFUL", @"Share successful") withTitle:NSLocalizedString(@"SHARE_SUCCESSFUL_TITLE", @"Share successful title")];
[((MobileLastFMApplicationDelegate *)[UIApplication sharedApplication].delegate) displayError:[NSString stringWithFormat:@"This %@ was successfully shared.", type] withTitle:[NSString stringWithFormat:@"%@ Shared", [type capitalizedString]]];

[[UIApplication sharedApplication] setStatusBarStyle:barStyle animated:YES];
[viewController dismissModalViewControllerAnimated:YES];
Expand Down

0 comments on commit 70883f3

Please sign in to comment.