Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions Sources/WordPressData/Objective-C/Media.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,6 @@ @implementation Media

#pragma mark -

+ (NSString *)stringFromMediaType:(MediaType)mediaType
{
switch (mediaType) {
case MediaTypeImage:
return @"image";
break;
case MediaTypeVideo:
return @"video";
break;
case MediaTypePowerpoint:
return @"powerpoint";
break;
case MediaTypeDocument:
return @"document";
break;
case MediaTypeAudio:
return @"audio";
break;
}
}

#pragma mark -

- (NSString *)fileExtension
{
NSString *extension = [self.filename pathExtension];
Expand All @@ -72,60 +49,6 @@ - (NSString *)fileExtension
return extension;
}

#pragma mark - Media Types

- (MediaType)mediaType
{
if ([self.mediaTypeString isEqualToString:[Media stringFromMediaType:MediaTypeImage]]) {
return MediaTypeImage;
} else if ([self.mediaTypeString isEqualToString:[Media stringFromMediaType:MediaTypeVideo]]) {
return MediaTypeVideo;
} else if ([self.mediaTypeString isEqualToString:[Media stringFromMediaType:MediaTypePowerpoint]]) {
return MediaTypePowerpoint;
} else if ([self.mediaTypeString isEqualToString:[Media stringFromMediaType:MediaTypeDocument]]) {
return MediaTypeDocument;
} else if ([self.mediaTypeString isEqualToString:[Media stringFromMediaType:MediaTypeAudio]]) {
return MediaTypeAudio;
}

return MediaTypeDocument;
}

- (void)setMediaType:(MediaType)mediaType
{
self.mediaTypeString = [[self class] stringFromMediaType:mediaType];
}

#pragma mark - Remote Status

- (MediaRemoteStatus)remoteStatus
{
return (MediaRemoteStatus)[[self remoteStatusNumber] intValue];
}

- (void)setRemoteStatus:(MediaRemoteStatus)aStatus
{
[self setRemoteStatusNumber:@(aStatus)];
}

- (NSString *)remoteStatusText
{
switch (self.remoteStatus) {
case MediaRemoteStatusPushing:
return NSLocalizedString(@"Uploading", @"Status for Media object that is being uploaded.");
case MediaRemoteStatusFailed:
return NSLocalizedString(@"Failed", @"Status for Media object that is failed upload or export.");
case MediaRemoteStatusSync:
return NSLocalizedString(@"Uploaded", @"Status for Media object that is uploaded and sync with server.");
case MediaRemoteStatusProcessing:
return NSLocalizedString(@"Pending", @"Status for Media object that is being processed locally.");
case MediaRemoteStatusLocal:
return NSLocalizedString(@"Local", @"Status for Media object that is only exists locally.");
case MediaRemoteStatusStub:
return NSLocalizedString(@"Stub", @"Status for Media object that is only has the mediaID locally.");
}
}

#pragma mark - Absolute URLs

- (NSURL *)absoluteThumbnailLocalURL;
Expand Down
22 changes: 0 additions & 22 deletions Sources/WordPressData/Objective-C/include/Media.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,6 @@

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, MediaRemoteStatus) {
MediaRemoteStatusSync, /* Post synced. */
MediaRemoteStatusFailed, /* Upload failed. */
MediaRemoteStatusLocal, /* Only local version. */
MediaRemoteStatusPushing, /* Uploading post. */
MediaRemoteStatusProcessing, /* Intermediate status before uploading. */
MediaRemoteStatusStub, /* We only have the mediaID information from the server */
};

typedef NS_ENUM(NSUInteger, MediaType) {
MediaTypeImage,
MediaTypeVideo,
MediaTypeDocument,
MediaTypePowerpoint,
MediaTypeAudio
};

@interface Media : NSManagedObject

// Managed properties
Expand Down Expand Up @@ -60,9 +43,6 @@ typedef NS_ENUM(NSUInteger, MediaType) {

// Helper properties

@property (nonatomic, assign) MediaType mediaType;
@property (nonatomic, assign) MediaRemoteStatus remoteStatus;

/**
Local file URL for the Media's asset. e.g. an image, video, gif or other file.
*/
Expand All @@ -81,8 +61,6 @@ typedef NS_ENUM(NSUInteger, MediaType) {

// Helper methods

+ (NSString *)stringFromMediaType:(MediaType)mediaType;

- (nullable NSString *)fileExtension;

@end
Expand Down
71 changes: 71 additions & 0 deletions Sources/WordPressData/Swift/Media.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,55 @@
import Foundation
import UniformTypeIdentifiers

@objc
public enum MediaType: UInt {
case image
case video
case document
case powerpoint
case audio

public var stringValue: String {
switch self {
case .image:
return "image"
case .video:
return "video"
case .powerpoint:
return "powerpoint"
case .document:
return "document"
case .audio:
return "audio"
Comment on lines +13 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit)

Suggested change
switch self {
case .image:
return "image"
case .video:
return "video"
case .powerpoint:
return "powerpoint"
case .document:
return "document"
case .audio:
return "audio"
switch self {
case .image: "image"
case .video: "video"
case .powerpoint: "powerpoint"
case .document: "document"
case .audio: "audio"

}
}

public init(string: String) {
switch string {
case "image":
self = .image
case "video":
self = .video
case "powerpoint":
self = .powerpoint
case "audio":
self = .audio
default:
self = .document
}
}
}

@objc
public enum MediaRemoteStatus: UInt {
case sync
case failed
case local
case pushing
case processing
case stub
}

public extension Media {
// MARK: - AutoUpload Failure Count

Expand Down Expand Up @@ -43,6 +92,16 @@ public extension Media {

// MARK: - Media Type

@objc
var mediaType: MediaType {
get {
mediaTypeString.flatMap(MediaType.init) ?? .document
}
set {
mediaTypeString = newValue.stringValue
}
}

/// Returns the MIME type, e.g. "image/png".
@objc var mimeType: String? {
guard let fileExtension = self.fileExtension(),
Expand Down Expand Up @@ -75,6 +134,18 @@ public extension Media {
type.map(MediaType.init) ?? .document
}

// MARK: - Remote Status

@objc
var remoteStatus: MediaRemoteStatus {
get {
(remoteStatusNumber?.uintValue).flatMap(MediaRemoteStatus.init(rawValue:)) ?? .local
}
set {
remoteStatusNumber = NSNumber(value: newValue.rawValue)
}
}

// MARK: - Media Link

var link: String {
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/MediaRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/// Get the Media object from the server using the blog and the mediaID as the identifier of the resource
func getMedia(withID mediaID: NSNumber, in blogID: TaggedManagedObjectID<Blog>) async throws -> TaggedManagedObjectID<Media> {
let remote = try await remote(for: blogID)
let remoteMedia: RemoteMedia? = try await withCheckedThrowingContinuation { continuation in

Check warning on line 24 in WordPress/Classes/Services/MediaRepository.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "remoteMedia" local variable.

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlpmn0okEEDjlt--1&open=AZsPlpmn0okEEDjlt--1&pullRequest=25058
remote.getMediaWithID(mediaID) {
continuation.resume(returning: $0)
} failure: {
Expand All @@ -43,7 +43,7 @@
/// Deletes the Media object from the server. Note the Media is deleted, not trashed.
func delete(_ mediaID: TaggedManagedObjectID<Media>) async throws {
// Delete the media from WordPress Media Library
let queryResult: (MediaServiceRemote, RemoteMedia)? = try await coreDataStack.performQuery { [remoteFactory] context in

Check warning on line 46 in WordPress/Classes/Services/MediaRepository.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "queryResult" local variable.

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlpmn0okEEDjlt--2&open=AZsPlpmn0okEEDjlt--2&pullRequest=25058
guard let media = try? context.existingObject(with: mediaID) else {
return nil
}
Expand Down Expand Up @@ -114,7 +114,7 @@
extension MediaServiceRemote {

func getMediaLibraryCount(forMediaTypes types: [MediaType]) async throws -> Int {
try await getMediaLibraryCount(forMediaTypes: types.map(Media.string(from:)))
try await getMediaLibraryCount(forMediaTypes: types.map(\.stringValue))
}

func getMediaLibraryCount(forMediaTypes mediaTypes: [String]) async throws -> Int {
Expand Down
9 changes: 0 additions & 9 deletions WordPress/Classes/Services/MediaService.m
Original file line number Diff line number Diff line change
Expand Up @@ -458,15 +458,6 @@ - (void)syncMediaLibraryForBlog:(Blog *)blog
}];
}

#pragma mark - Private helpers

- (NSString *)mimeTypeForMediaType:(NSNumber *)mediaType
{
MediaType filter = (MediaType)[mediaType intValue];
NSString *mimeType = [Media stringFromMediaType:filter];
return mimeType;
}

#pragma mark - Media helpers

- (id<MediaServiceRemote>)remoteForBlog:(Blog *)blog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
}

extension SiteMediaCollectionViewControllerDelegate {
func siteMediaViewController(_ viewController: SiteMediaCollectionViewController, didUpdateSelection: [Media]) {}

Check warning on line 14 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "didUpdateSelection" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--f&open=AZsPlph90okEEDjlt--f&pullRequest=25058

Check warning on line 14 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "viewController" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--e&open=AZsPlph90okEEDjlt--e&pullRequest=25058
func makeAddMediaMenu(for viewController: SiteMediaCollectionViewController) -> UIMenu? { nil }

Check warning on line 15 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "viewController" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--g&open=AZsPlph90okEEDjlt--g&pullRequest=25058
func siteMediaViewController(_ viewController: SiteMediaCollectionViewController, contextMenuFor media: Media, sourceView: UIView) -> UIMenu? { nil }

Check warning on line 16 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "viewController" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--h&open=AZsPlph90okEEDjlt--h&pullRequest=25058

Check warning on line 16 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "media" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--i&open=AZsPlph90okEEDjlt--i&pullRequest=25058

Check warning on line 16 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "sourceView" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--j&open=AZsPlph90okEEDjlt--j&pullRequest=25058
}

/// The internal view controller for managing the media collection view.
Expand Down Expand Up @@ -71,7 +71,7 @@
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {

Check warning on line 74 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "coder" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--k&open=AZsPlph90okEEDjlt--k&pullRequest=25058
fatalError("init(coder:) has not been implemented")
}

Expand Down Expand Up @@ -271,7 +271,7 @@

// MARK: - Filter

func setMediaType(_ mediaType: MediaType?) {

Check warning on line 274 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "mediaType" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--l&open=AZsPlph90okEEDjlt--l&pullRequest=25058
if let mediaType {
self.filter = [mediaType]
} else {
Expand All @@ -289,7 +289,7 @@
return true
}

func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {

Check warning on line 292 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "touch" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--m&open=AZsPlph90okEEDjlt--m&pullRequest=25058
if gestureRecognizer === panGestureRecognizer {
return isEditing
}
Expand Down Expand Up @@ -364,7 +364,7 @@
private func makePredicate(searchTerm: String) -> NSPredicate {
var predicates = [NSPredicate(format: "blog == %@", blog)]
if let filter {
let mediaTypes = filter.map(Media.string(from:))
let mediaTypes = filter.map(\.stringValue)
predicates.append(NSPredicate(format: "mediaTypeString IN %@", mediaTypes))
}
if !isShowingPendingUploads {
Expand All @@ -390,11 +390,11 @@

// MARK: - NSFetchedResultsControllerDelegate

func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {

Check warning on line 393 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "controller" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--n&open=AZsPlph90okEEDjlt--n&pullRequest=25058
pendingChanges = []
}

func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {

Check warning on line 397 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "controller" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--o&open=AZsPlph90okEEDjlt--o&pullRequest=25058

Check warning on line 397 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "newIndexPath" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--q&open=AZsPlph90okEEDjlt--q&pullRequest=25058

Check warning on line 397 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "indexPath" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--p&open=AZsPlph90okEEDjlt--p&pullRequest=25058
switch type {
case .insert:
guard let newIndexPath else { return }
Expand Down Expand Up @@ -430,7 +430,7 @@
}
}

func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {

Check warning on line 433 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "controller" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--r&open=AZsPlph90okEEDjlt--r&pullRequest=25058
guard !pendingChanges.isEmpty else {
return
}
Expand All @@ -453,7 +453,7 @@

// MARK: - UICollectionViewDataSource

func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {

Check warning on line 456 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "section" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--t&open=AZsPlph90okEEDjlt--t&pullRequest=25058

Check warning on line 456 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "collectionView" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--s&open=AZsPlph90okEEDjlt--s&pullRequest=25058
fetchController.fetchedObjects?.count ?? 0
}

Expand All @@ -468,7 +468,7 @@

// MARK: - UICollectionViewDelegate

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {

Check warning on line 471 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "collectionView" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--u&open=AZsPlph90okEEDjlt--u&pullRequest=25058
let media = fetchController.object(at: indexPath)
if isEditing {
toggleSelection(for: media)
Expand All @@ -486,7 +486,7 @@
}
}

func collectionView(_ collectionView: UICollectionView, contextMenuConfigurationForItemsAt indexPaths: [IndexPath], point: CGPoint) -> UIContextMenuConfiguration? {

Check warning on line 489 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "point" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--v&open=AZsPlph90okEEDjlt--v&pullRequest=25058
guard let indexPath = indexPaths.first else {
return nil
}
Expand All @@ -507,14 +507,14 @@

// MARK: - UICollectionViewDataSourcePrefetching

func collectionView(_ collectionView: UICollectionView, prefetchItemsAt indexPaths: [IndexPath]) {

Check warning on line 510 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "collectionView" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--w&open=AZsPlph90okEEDjlt--w&pullRequest=25058
for indexPath in indexPaths {
let media = fetchController.object(at: indexPath)
getViewModel(for: media).startPrefetching()
}
}

func collectionView(_ collectionView: UICollectionView, cancelPrefetchingForItemsAt indexPaths: [IndexPath]) {

Check warning on line 517 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "collectionView" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--x&open=AZsPlph90okEEDjlt--x&pullRequest=25058
let count = fetchController.fetchedObjects?.count ?? 0
for indexPath in indexPaths where indexPath.row < count {
let media = fetchController.object(at: indexPath)
Expand All @@ -524,13 +524,13 @@

// MARK: - UISearchResultsUpdating

func updateSearchResults(for searchController: UISearchController) {

Check warning on line 527 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "searchController" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--y&open=AZsPlph90okEEDjlt--y&pullRequest=25058
reloadFetchController()
}

// MARK: - SiteMediaPageViewControllerDelegate

func siteMediaPageViewController(_ viewController: SiteMediaPageViewController, getMediaBeforeMedia media: Media) -> Media? {

Check warning on line 533 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "viewController" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--z&open=AZsPlph90okEEDjlt--z&pullRequest=25058
guard let fetchedObjects = fetchController.fetchedObjects,
let index = fetchedObjects.firstIndex(of: media),
index > 0 else {
Expand All @@ -539,7 +539,7 @@
return fetchedObjects[index - 1]
}

func siteMediaPageViewController(_ viewController: SiteMediaPageViewController, getMediaAfterMedia media: Media) -> Media? {

Check warning on line 542 in WordPress/Classes/ViewRelated/Media/SiteMedia/Controllers/SiteMediaCollectionViewController.swift

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the unused function parameter "viewController" or name it "_".

See more on https://sonarcloud.io/project/issues?id=wordpress-mobile_WordPress-iOS&issues=AZsPlph90okEEDjlt--0&open=AZsPlph90okEEDjlt--0&pullRequest=25058
guard let fetchedObjects = fetchController.fetchedObjects,
let index = fetchedObjects.firstIndex(of: media),
index < (fetchedObjects.count - 1) else {
Expand Down