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
18 changes: 14 additions & 4 deletions Networking/Networking/Remote/MediaRemote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class MediaRemote: Remote, MediaRemoteProtocol {
completion: @escaping (Result<[Media], Error>) -> Void) {
let parameters: [String: Any] = [
ParameterKey.contextKey: context ?? Default.context,
ParameterKey.pageSize: pageSize,
ParameterKey.dotComPageSize: pageSize,
ParameterKey.pageNumber: pageNumber,
ParameterKey.fields: "ID,date,URL,thumbnails,title,alt,extension,mime_type,file",
ParameterKey.mimeType: imagesOnly ? "image" : nil,
Expand Down Expand Up @@ -123,10 +123,10 @@ public class MediaRemote: Remote, MediaRemoteProtocol {
pageSize: Int = 25,
completion: @escaping (Result<[WordPressMedia], Error>) -> Void) {
let parameters: [String: Any] = [
ParameterKey.pageSize: pageSize,
ParameterKey.dotOrgPageSize: pageSize,
ParameterKey.pageNumber: pageNumber,
ParameterKey.fieldsWordPressSite: ParameterValue.wordPressMediaFields,
ParameterKey.mimeType: imagesOnly ? "image" : nil,
ParameterKey.mediaType: imagesOnly ? "image" : nil,
ParameterKey.wordPressMediaParent: productID
].compactMapValues { $0 }

Expand Down Expand Up @@ -294,13 +294,23 @@ public extension MediaRemote {

private enum ParameterKey {
static let pageNumber: String = "page"
static let pageSize: String = "number"
// For dotcom API usage, we want to use "number"
// https://developer.wordpress.com/docs/api/1.2/get/sites/%24site/media/
static let dotComPageSize: String = "number"
// For dotorg API usage, we want to use "per_page"
// https://developer.wordpress.org/rest-api/reference/media/#arguments
static let dotOrgPageSize: String = "per_page"
static let wordPressMediaPostID: String = "post"
static let altText: String = "alt"
static let wordPressAltText: String = "alt_text"
static let fields: String = "fields"
static let fieldsWordPressSite: String = "_fields"
// For dotcom API usage, we want to use "mime_type"
// https://developer.wordpress.com/docs/api/1.2/get/sites/%24site/media/
static let mimeType: String = "mime_type"
// For dotorg API usage, we want to use "media_type"
// https://developer.wordpress.org/rest-api/reference/media/#list-media
static let mediaType: String = "media_type"
static let postID: String = "post_ID"
static let contextKey: String = "context"
static let wordPressMediaParentID = "parent_id"
Expand Down
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [*] Menu tab > Payments: in the "deposits" summary view at the top, all mentions of "deposits/deposit/deposited" have been renamed to "payouts/payout/paid out" respectively to match the renaming in web. [https://github.com/woocommerce/woocommerce-ios/pull/14402]
- [*] Receipts: Added message confirming receipt sent to customer after successful payment. [https://github.com/woocommerce/woocommerce-ios/pull/14390]
- [internal] Simplifies App Icon by only using a single image for all supported platforms. [https://github.com/woocommerce/woocommerce-ios/pull/14429]
- [**] Media Library: On sites logged in with application password, when picking image from WordPress Media Library, all images will now load correctly. [https://github.com/woocommerce/woocommerce-ios/pull/14444]
- [*] Dashboard: Performance card now shows cached Visitors and Conversion data correctly. [https://github.com/woocommerce/woocommerce-ios/pull/14438]

21.1
Expand Down