Skip to content

Commit 6e9a61a

Browse files
committed
Extract Gutenberg content processors to WordPressShared
Move GutenbergContentParser, the GutenbergProcessor protocol, and the image, gallery, and file upload processors into WordPressShared, and relocate their tests. The Cover/Video/VideoPress/Audio processors and PostCoordinator stay in the app and now import WordPressShared.
1 parent 9c4ff76 commit 6e9a61a

16 files changed

Lines changed: 19 additions & 16 deletions

WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergContentParser.swift renamed to Modules/Sources/WordPressShared/Gutenberg/GutenbergContentParser.swift

File renamed without changes.

WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergFileUploadProcessor.swift renamed to Modules/Sources/WordPressShared/Gutenberg/GutenbergFileUploadProcessor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
class GutenbergFileUploadProcessor: GutenbergProcessor {
3+
public class GutenbergFileUploadProcessor: GutenbergProcessor {
44
private struct FileBlockKeys {
55
static var name = "wp:file"
66
static var id = "id"
@@ -11,7 +11,7 @@ class GutenbergFileUploadProcessor: GutenbergProcessor {
1111
let remoteURLString: String
1212
let serverMediaID: Int
1313

14-
init(mediaUploadID: Int32, serverMediaID: Int, remoteURLString: String) {
14+
public init(mediaUploadID: Int32, serverMediaID: Int, remoteURLString: String) {
1515
self.mediaUploadID = mediaUploadID
1616
self.serverMediaID = serverMediaID
1717
self.remoteURLString = remoteURLString
@@ -34,7 +34,7 @@ class GutenbergFileUploadProcessor: GutenbergProcessor {
3434
}
3535
}
3636

37-
func process(_ blocks: [GutenbergParsedBlock]) {
37+
public func process(_ blocks: [GutenbergParsedBlock]) {
3838
processFileBlocks(blocks)
3939
}
4040
}

WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergGalleryUploadProcessor.swift renamed to Modules/Sources/WordPressShared/Gutenberg/GutenbergGalleryUploadProcessor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import SwiftSoup
33

4-
class GutenbergGalleryUploadProcessor: GutenbergProcessor {
4+
public class GutenbergGalleryUploadProcessor: GutenbergProcessor {
55

66
let mediaUploadID: Int32
77
let remoteURLString: String
@@ -12,7 +12,7 @@ class GutenbergGalleryUploadProcessor: GutenbergProcessor {
1212

1313
static let imgClassIDPrefixAttribute = "wp-image-"
1414

15-
init(mediaUploadID: Int32, serverMediaID: Int, remoteURLString: String, mediaLink: String) {
15+
public init(mediaUploadID: Int32, serverMediaID: Int, remoteURLString: String, mediaLink: String) {
1616
self.mediaUploadID = mediaUploadID
1717
self.serverMediaID = serverMediaID
1818
self.remoteURLString = remoteURLString
@@ -139,7 +139,7 @@ class GutenbergGalleryUploadProcessor: GutenbergProcessor {
139139
}
140140
}
141141

142-
func process(_ blocks: [GutenbergParsedBlock]) {
142+
public func process(_ blocks: [GutenbergParsedBlock]) {
143143
processGalleryBlocks(blocks)
144144
}
145145
}

WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergImgUploadProcessor.swift renamed to Modules/Sources/WordPressShared/Gutenberg/GutenbergImgUploadProcessor.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import Foundation
22

3-
class GutenbergImgUploadProcessor: GutenbergProcessor {
3+
public class GutenbergImgUploadProcessor: GutenbergProcessor {
44

55
let mediaUploadID: Int32
66
let remoteURLString: String
77
let serverMediaID: Int
88
static let imgClassIDPrefixAttribute = "wp-image-"
99

10-
init(mediaUploadID: Int32, serverMediaID: Int, remoteURLString: String) {
10+
public init(mediaUploadID: Int32, serverMediaID: Int, remoteURLString: String) {
1111
self.mediaUploadID = mediaUploadID
1212
self.serverMediaID = serverMediaID
1313
self.remoteURLString = remoteURLString
@@ -63,7 +63,7 @@ class GutenbergImgUploadProcessor: GutenbergProcessor {
6363
}
6464
}
6565

66-
func process(_ blocks: [GutenbergParsedBlock]) {
66+
public func process(_ blocks: [GutenbergParsedBlock]) {
6767
processImageBlocks(blocks)
6868
processMediaTextBlocks(blocks)
6969
}

WordPress/Classes/ViewRelated/Gutenberg/Processors/GutenbergProcessor.swift renamed to Modules/Sources/WordPressShared/Gutenberg/GutenbergProcessor.swift

File renamed without changes.

Tests/KeystoneTests/Tests/Features/Gutenberg/GutenbergContentParser.swift renamed to Modules/Tests/WordPressSharedTests/GutenbergContentParserTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@testable import WordPress
2+
@testable import WordPressShared
33

44
class GutenbergContentParserTests: XCTestCase {
55
let singleBlock = """

Tests/KeystoneTests/Tests/Features/Gutenberg/GutenbergFileUploadProcessorTests.swift renamed to Modules/Tests/WordPressSharedTests/GutenbergFileUploadProcessorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@testable import WordPress
2+
@testable import WordPressShared
33

44
class GutenbergFileUploadProcessorTests: XCTestCase {
55

Tests/KeystoneTests/Tests/Features/Gutenberg/GutenbergGalleryUploadProcessorTests.swift renamed to Modules/Tests/WordPressSharedTests/GutenbergGalleryUploadProcessorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@testable import WordPress
2+
@testable import WordPressShared
33

44
class GutenbergGalleryUploadProcessorTests: XCTestCase {
55

Tests/KeystoneTests/Tests/Features/Gutenberg/GutenbergImgUploadProcessorTests.swift renamed to Modules/Tests/WordPressSharedTests/GutenbergImgUploadProcessorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@testable import WordPress
2+
@testable import WordPressShared
33

44
class GutenbergImgUploadProcessorTests: XCTestCase {
55

Tests/KeystoneTests/Tests/Features/Gutenberg/GutenbergRefactoredGalleryUploadProcessorTests.swift renamed to Modules/Tests/WordPressSharedTests/GutenbergRefactoredGalleryUploadProcessorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import XCTest
2-
@testable import WordPress
2+
@testable import WordPressShared
33

44
class GutenbergRefactoredGalleryUploadProcessorTests: XCTestCase {
55
struct ImageUploadJob {

0 commit comments

Comments
 (0)