Skip to content

Commit

Permalink
Merge pull request #16508 from wordpress-mobile/merge/17.3-final-into…
Browse files Browse the repository at this point in the history
…-develop

Merge 17.3 final into develop
  • Loading branch information
oguzkocer authored May 17, 2021
2 parents 73c84b2 + 9811669 commit cf5292c
Show file tree
Hide file tree
Showing 109 changed files with 2,202 additions and 48,683 deletions.
75 changes: 35 additions & 40 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
GIT
remote: https://github.com/wordpress-mobile/release-toolkit
revision: 4efe6cd1585db9bbf8f3f0cd889037ceade8de6e
tag: 0.15.0
revision: eb0f24ec6c73b3454d711cc4b3276c50b9655861
tag: 0.18.1
specs:
fastlane-plugin-wpmreleasetoolkit (0.15.0)
fastlane-plugin-wpmreleasetoolkit (0.18.1)
activesupport (~> 5)
bigdecimal (~> 1.4)
chroma (= 0.2.0)
Expand All @@ -21,7 +21,7 @@ GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.3)
activesupport (5.2.4.4)
activesupport (5.2.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
Expand All @@ -34,7 +34,7 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.1.1)
aws-partitions (1.449.0)
aws-partitions (1.455.0)
aws-sdk-core (3.114.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
Expand All @@ -43,7 +43,7 @@ GEM
aws-sdk-kms (1.43.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.94.0)
aws-sdk-s3 (1.94.1)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
Expand All @@ -53,10 +53,10 @@ GEM
bigdecimal (1.4.4)
chroma (0.2.0)
claide (1.0.3)
cocoapods (1.10.0)
cocoapods (1.10.1)
addressable (~> 2.6)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.10.0)
cocoapods-core (= 1.10.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -71,7 +71,7 @@ GEM
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.19.0, < 2.0)
cocoapods-core (1.10.0)
cocoapods-core (1.10.1)
activesupport (> 5.0, < 6)
addressable (~> 2.6)
algoliasearch (~> 1.0)
Expand All @@ -93,11 +93,11 @@ GEM
colored (1.2)
colored2 (3.1.2)
colorize (0.8.1)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
commonmarker (0.21.0)
commander (4.6.0)
highline (~> 2.0.0)
commonmarker (0.21.2)
ruby-enum (~> 0.5)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
declarative (0.0.20)
diffy (3.4.0)
digest-crc (0.6.3)
Expand All @@ -107,8 +107,8 @@ GEM
dotenv (2.7.6)
emoji_regex (3.2.2)
escape (0.0.4)
ethon (0.12.0)
ffi (>= 1.3.0)
ethon (0.14.0)
ffi (>= 1.15.0)
excon (0.81.0)
faraday (1.4.1)
faraday-excon (~> 1.1)
Expand All @@ -125,15 +125,15 @@ GEM
faraday_middleware (1.0.0)
faraday (~> 1.0)
fastimage (2.2.3)
fastlane (2.181.0)
fastlane (2.183.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
artifactory (~> 3.0)
aws-sdk-s3 (~> 1.0)
babosa (>= 1.0.3, < 2.0.0)
bundler (>= 1.12.0, < 3.0.0)
colored
commander-fastlane (>= 4.4.6, < 5.0.0)
commander (~> 4.6)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 4.0)
excon (>= 0.71.0, < 1.0.0)
Expand All @@ -142,9 +142,10 @@ GEM
faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.37.0, < 0.39.0)
google-cloud-storage (>= 1.15.0, < 2.0.0)
highline (>= 1.7.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.1)
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
Expand All @@ -154,7 +155,6 @@ GEM
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
tty-screen (>= 0.6.3, < 1.0.0)
Expand All @@ -172,20 +172,14 @@ GEM
trainer
xcodeproj
xctest_list (>= 1.2.1)
ffi (1.13.1)
ffi (1.15.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
git (1.8.1)
rchardet (~> 1.8)
google-api-client (0.38.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.9)
httpclient (>= 2.8.1, < 3.0)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.12)
google-apis-androidpublisher_v3 (0.2.0)
google-apis-core (~> 0.1)
google-apis-core (0.3.0)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.14)
Expand All @@ -198,6 +192,8 @@ GEM
webrick
google-apis-iamcredentials_v1 (0.3.0)
google-apis-core (~> 0.1)
google-apis-playcustomapp_v1 (0.2.0)
google-apis-core (~> 0.1)
google-apis-storage_v1 (0.3.0)
google-apis-core (~> 0.1)
google-cloud-core (1.6.0)
Expand All @@ -221,11 +217,11 @@ GEM
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.14)
highline (1.7.10)
highline (2.0.3)
http-cookie (1.0.3)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.8.5)
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jmespath (1.4.0)
json (2.5.1)
Expand All @@ -236,22 +232,22 @@ GEM
memoist (0.16.2)
mini_magick (4.11.0)
mini_mime (1.1.0)
mini_portile2 (2.5.0)
minitest (5.14.2)
mini_portile2 (2.5.1)
minitest (5.14.4)
molinillo (0.6.6)
multi_json (1.15.0)
multipart-post (2.0.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
nokogiri (1.11.1)
nokogiri (1.11.3)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
octokit (4.19.0)
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
oj (3.11.2)
oj (3.11.5)
optimist (3.0.1)
options (2.3.2)
os (1.1.1)
Expand All @@ -274,7 +270,7 @@ GEM
rexml (3.2.5)
rmagick (3.2.0)
rouge (2.0.7)
ruby-enum (0.8.0)
ruby-enum (0.9.0)
i18n
ruby-macho (1.4.0)
ruby2_keywords (0.0.4)
Expand All @@ -291,7 +287,6 @@ GEM
simctl (1.6.8)
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
Expand All @@ -306,7 +301,7 @@ GEM
tty-cursor (~> 0.7)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.8)
tzinfo (1.2.9)
thread_safe (~> 0.1)
uber (0.1.0)
unf (0.1.4)
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -765,4 +765,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: a123d26f80f5f584a7b54add2057f9853d571c26

COCOAPODS: 1.10.0
COCOAPODS: 1.10.1
2 changes: 2 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* [**] Block Editor: The media upload options of the Image, Video and Gallery block automatically opens when the respective block is inserted. [https://github.com/wordpress-mobile/gutenberg-mobile/pull/2700]
* [**] Block Editor: The media upload options of the File and Audio block automatically opens when the respective block is inserted. [https://github.com/wordpress-mobile/gutenberg-mobile/pull/3399]
* [*] Block Editor: Remove visual feedback from non-interactive bottom-sheet cell sections [https://github.com/wordpress-mobile/gutenberg-mobile/pull/3404]
* [*] Block Editor: Fixed an issue that was causing the featured image badge to be shown on images in an incorrect manner. [https://github.com/wordpress-mobile/gutenberg-mobile/pull/3494]


17.2
-----
Expand Down
5 changes: 3 additions & 2 deletions WordPress/Classes/Utility/Media/MediaURLExporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ class MediaURLExporter: MediaExporter {
///
func exportURL(fileURL: URL, onCompletion: @escaping OnMediaExport, onError: @escaping OnExportError) -> Progress {
// Verify the export is permissible
if let fileExtension = fileURL.typeIdentifierFileExtension {
if let urlExportOptions = urlOptions, let fileExtension = fileURL.typeIdentifierFileExtension {
// Check the default file types. We want to limit to supported types but mobile is not restricted to only allowed ones.
if !MediaImportService.defaultAllowableFileExtensions.contains(fileExtension) {
// `allowableFileExtensions` can be empty for self-hosted sites
if !MediaImportService.defaultAllowableFileExtensions.contains(fileExtension) && !urlExportOptions.allowableFileExtensions.isEmpty && !urlExportOptions.allowableFileExtensions.contains(fileExtension) {
onError(exporterErrorWith(error: URLExportError.unsupportedFileType))
return Progress.discreteCompletedProgress()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ class GutenbergFilesAppMediaSource: NSObject {
}

func presentPicker(origin: UIViewController, filters: [Gutenberg.MediaType], allowedTypesOnBlog: [String], multipleSelection: Bool, callback: @escaping MediaPickerDidPickMediaCallback) {
let uttypeFilters = filters.contains(.any) ? allowedTypesOnBlog : allTypesFrom(allowedTypesOnBlog, conformingTo: filters)

mediaPickerCallback = callback
let docPicker = UIDocumentPickerViewController(documentTypes: uttypeFilters, in: .import)
let documentTypes = getDocumentTypes(filters: filters, allowedTypesOnBlog: allowedTypesOnBlog)
let docPicker = UIDocumentPickerViewController(documentTypes: documentTypes, in: .import)
docPicker.delegate = self
docPicker.allowsMultipleSelection = multipleSelection

origin.present(docPicker, animated: true)
}

private func allTypesFrom(_ allTypes: [String], conformingTo filters: [Gutenberg.MediaType]) -> [String] {
return filters.map { $0.filterTypesConformingTo(allTypes: allTypes) }.reduce([], +)
private func getDocumentTypes(filters: [Gutenberg.MediaType], allowedTypesOnBlog: [String]) -> [String] {
if filters.contains(.any) {
return allowedTypesOnBlog
} else {
return filters.map { $0.filterTypesConformingTo(allTypes: allowedTypesOnBlog) }.reduce([], +)
}
}
}

Expand Down Expand Up @@ -70,7 +72,23 @@ extension Gutenberg.MediaType {
}

private func getTypesFrom(_ allTypes: [String], conformingTo uttype: CFString) -> [String] {
return allTypes.filter { UTTypeConformsTo($0 as CFString, uttype) }

return allTypes.filter {
if #available(iOS 14.0, *) {
guard let allowedType = UTType($0), let requiredType = UTType(uttype as String) else {
return false
}
// Sometimes the compared type could be a supertype
// For example a self-hosted site without Jetpack may have "public.content" as allowedType
// Although "public.audio" conforms to "public.content", it's not true the other way around
if allowedType.isSupertype(of: requiredType) {
return true
}
return allowedType.conforms(to: requiredType)
} else {
return UTTypeConformsTo($0 as CFString, uttype)
}
}
}

private var typeIdentifier: CFString? {
Expand Down
Loading

0 comments on commit cf5292c

Please sign in to comment.