Skip to content

Commit

Permalink
Remove a couple of unused functions in MediaService (#21741)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Oct 13, 2023
2 parents e46cdee + beaf759 commit 32404ca
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions WordPress/Classes/Services/MediaService.m
Original file line number Diff line number Diff line change
Expand Up @@ -416,64 +416,6 @@ - (void)deleteMedia:(nonnull NSArray<Media *> *)mediaObjects
});
}

#pragma mark - Getting media

- (void) getMediaWithID:(NSNumber *) mediaID inBlog:(Blog *) blog
success:(void (^)(Media *media))success
failure:(void (^)(NSError *error))failure
{
id<MediaServiceRemote> remote = [self remoteForBlog:blog];
NSManagedObjectID *blogID = blog.objectID;

[remote getMediaWithID:mediaID success:^(RemoteMedia *remoteMedia) {
[self.managedObjectContext performBlock:^{
Blog *blog = (Blog *)[self.managedObjectContext existingObjectWithID:blogID error:nil];
if (!blog) {
return;
}
Media *media = [Media existingMediaWithMediaID:remoteMedia.mediaID inBlog:blog];
if (!media) {
media = [Media makeMediaWithBlog:blog];
}
[MediaHelper updateMedia:media withRemoteMedia:remoteMedia];

[[ContextManager sharedInstance] saveContextAndWait:self.managedObjectContext];

if (success){
success(media);

if ([media hasChanges]) {
NSCAssert(NO, @"The success callback should not modify the Media instance");
[[ContextManager sharedInstance] saveContext:self.managedObjectContext];
}
}
}];
} failure:^(NSError *error) {
if (failure) {
[self.managedObjectContext performBlock:^{
failure(error);
}];
}
}];
}

- (void)getMetadataFromVideoPressID:(NSString *)videoPressID
inBlog:(Blog *)blog
success:(void (^)(RemoteVideoPressVideo *metadata))success
failure:(void (^)(NSError *error))failure
{
id<MediaServiceRemote> remote = [self remoteForBlog:blog];
[remote getMetadataFromVideoPressID:videoPressID isSitePrivate:blog.isPrivate success:^(RemoteVideoPressVideo *metadata) {
if (success) {
success(metadata);
}
} failure:^(NSError * error) {
if (failure) {
failure(error);
}
}];
}

- (void)syncMediaLibraryForBlog:(Blog *)blog
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
Expand Down

0 comments on commit 32404ca

Please sign in to comment.