Skip to content

Commit 78e7bdc

Browse files
Merge pull request #49 from contentful/fix_non-full-screen-issues
Fix non full screen issues
2 parents 233f595 + a948867 commit 78e7bdc

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

ContentfulRichTextRenderer.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Pod::Spec.new do |spec|
44
spec.name = "ContentfulRichTextRenderer"
5-
spec.version = "0.3.0"
5+
spec.version = "0.3.1"
66
spec.summary = "Swift library for rendering Contentful RichTextDocument."
77
spec.homepage = "https://github.com/contentful-labs/rich-text-renderer.swift"
88
spec.social_media_url = 'https://twitter.com/contentful'

RichTextRenderer.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@
821821
"@executable_path/Frameworks",
822822
"@loader_path/Frameworks",
823823
);
824-
MARKETING_VERSION = 0.3.0;
824+
MARKETING_VERSION = 0.3.1;
825825
PRODUCT_BUNDLE_IDENTIFIER = com.contentful.RichTextRenderer;
826826
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
827827
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -850,7 +850,7 @@
850850
"@executable_path/Frameworks",
851851
"@loader_path/Frameworks",
852852
);
853-
MARKETING_VERSION = 0.3.0;
853+
MARKETING_VERSION = 0.3.1;
854854
PRODUCT_BUNDLE_IDENTIFIER = com.contentful.RichTextRenderer;
855855
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
856856
PROVISIONING_PROFILE_SPECIFIER = "";

Sources/RichTextRenderer/ViewController/RichTextViewController.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,25 @@ open class RichTextViewController: UIViewController, NSLayoutManagerDelegate {
213213
// In cases if table row or cell has to be rendered on its own in the future, more if cases have to be added here
214214

215215
if let blockAttachment = attrView as? ResourceLinkBlockViewRepresentable {
216-
layoutEmbedElementResourceBlock(attrView: blockAttachment, attributes: attributes, range: range, containerSize: containerSize)
216+
// Async is needed as if there are multiple tables, the starting positions of each will get calculated wrong, so they have to be recalculated after everything else is drawn, and has to be done one after the other instead of concurrently.
217+
DispatchQueue.main.async { [weak self] in
218+
self?.layoutEmbedElementResourceBlock(attrView: blockAttachment, attributes: attributes, range: range, containerSize: containerSize)
219+
}
217220
} else if let tableAttachment = attrView as? SimpleTableView {
218-
// Async is needed as if there are multiple tables, the starting positions of each will get calculated wrong, so they have to be recalculated after everything else is drawn, and has to be done one after the other instead of concurrently. This could possibly be needed also for the other views in this block so if any issues happens in the future with custom views layout this might be the solution in other if statements as well.
219-
DispatchQueue.main.async {
220-
self.layoutEmbedElementTable(attrView: tableAttachment, attributes: attributes, range: range, containerSize: containerSize)
221+
// Async is needed as if there are multiple tables, the starting positions of each will get calculated wrong, so they have to be recalculated after everything else is drawn, and has to be done one after the other instead of concurrently.
222+
DispatchQueue.main.async { [weak self] in
223+
self?.layoutEmbedElementTable(attrView: tableAttachment, attributes: attributes, range: range, containerSize: containerSize)
221224
}
222225

223226
} else {
224227
attrView.isHidden = true
225228
}
226229

227230
} else if attributes.keys.contains(.horizontalRule) {
228-
layoutHorizontalRuleElement(attributes: attributes, range: range, containerSize: containerSize)
231+
// Async is needed as if there are multiple tables, the starting positions of each will get calculated wrong, so they have to be recalculated after everything else is drawn, and has to be done one after the other instead of concurrently.
232+
DispatchQueue.main.async { [weak self] in
233+
self?.layoutHorizontalRuleElement(attributes: attributes, range: range, containerSize: containerSize)
234+
}
229235
}
230236
}
231237
}

0 commit comments

Comments
 (0)