Retry media upload - Take 2

Implement retry functionality for media uploads that fails.

Solves: 
 * wordpress-mobile/WordPress-iOS-Editor#348
 * wordpress-mobile/WordPress-iOS-Editor#361

cc @bummytime @diegoreymendez 
You are right, this test was assuming that you only called when no media is
uploading. I will improve this to a safer not state dependent check.

On Thu, Dec 18, 2014 at 6:03 PM, Matt Bumgardner <notifications@github.com>
wrote:
>
> In WordPress/Classes/ViewRelated/Post/WPPostViewController.m
> <https://github.com/wordpress-mobile/WordPress-iOS/pull/2943#discussion-diff-22058914>
> :
>
> >  - (BOOL)hasFailedMedia
> >  {
> > -	BOOL hasFailedMedia = NO;
> > -
> > -	NSSet *mediaFiles = self.post.media;
> > -	for (Media *media in mediaFiles) {
> > -		if(media.remoteStatus == MediaRemoteStatusFailed) {
> > -			hasFailedMedia = YES;
> > -			break;
> > -		}
> > -	}
> > -	mediaFiles = nil;
> > -
> > -	return hasFailedMedia;
> > +    return self.mediaInProgress.count > 0;
>
> OK dumb question here [image: :grinning:]....for failed media wouldn't we
> need to check for something else besides the count of the media in
> progress? Like !self.isMediaUploading && self.mediaInProgress.count > 0
> or something.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/wordpress-mobile/WordPress-iOS/pull/2943/files#r22058914>
> .
>