Skip to content

Commit cabf104

Browse files
Merge pull request #1233 from wordpress-mobile/issue/12920_adds_is_loaded_property
Creates isLoaded property
2 parents 9d0c18f + 988da48 commit cabf104

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Aztec/Classes/TextKit/MediaAttachment.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ open class MediaAttachment: NSTextAttachment {
4545
}
4646
}
4747

48+
/// Indicates if the media is loaded
49+
///
50+
public var isLoaded: Bool {
51+
return !needsNewAsset && !isFetchingImage
52+
}
53+
4854
/// Indicates if a new Asset should be retrieved, or we're current!.
4955
///
5056
fileprivate var needsNewAsset = true

WordPressEditor/WordPressEditorTests/Extensions/MediaAttachmentWordPressTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,10 @@ class MediaAttachmentWordPressTests: XCTestCase {
2929
imageAttachment.extraAttributes[MediaAttachment.uploadKey] = nil
3030
XCTAssertEqual(imageAttachment.uploadID, nil)
3131
}
32+
33+
func testIsLoadedInitiallyReturnsFalse() {
34+
let imageAttachment = MediaAttachment(identifier: "testing")
35+
36+
XCTAssertFalse(imageAttachment.isLoaded)
37+
}
3238
}

0 commit comments

Comments
 (0)