Merge branch 'charlesmchen/mediaAlbumRename'

pull/1/head
Matthew Chen 7 years ago
commit 2c50e34606

@ -156,7 +156,7 @@
3496744F2076ACD000080B5F /* LongTextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3496744E2076ACCE00080B5F /* LongTextViewController.swift */; }; 3496744F2076ACD000080B5F /* LongTextViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3496744E2076ACCE00080B5F /* LongTextViewController.swift */; };
349EA07C2162AEA800F7B17F /* OWS111UDAttributesMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349EA07B2162AEA700F7B17F /* OWS111UDAttributesMigration.swift */; }; 349EA07C2162AEA800F7B17F /* OWS111UDAttributesMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 349EA07B2162AEA700F7B17F /* OWS111UDAttributesMigration.swift */; };
34A55F3720485465002CC6DE /* OWS2FARegistrationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A55F3520485464002CC6DE /* OWS2FARegistrationViewController.m */; }; 34A55F3720485465002CC6DE /* OWS2FARegistrationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A55F3520485464002CC6DE /* OWS2FARegistrationViewController.m */; };
34A8B3512190A40E00218A25 /* MediaGalleryCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A8B3502190A40E00218A25 /* MediaGalleryCellView.swift */; }; 34A8B3512190A40E00218A25 /* MediaAlbumCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A8B3502190A40E00218A25 /* MediaAlbumCellView.swift */; };
34A910601FFEB114000C4745 /* OWSBackup.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A9105F1FFEB114000C4745 /* OWSBackup.m */; }; 34A910601FFEB114000C4745 /* OWSBackup.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A9105F1FFEB114000C4745 /* OWSBackup.m */; };
34ABB2C42090C59700C727A6 /* OWSResaveCollectionDBMigration.m in Sources */ = {isa = PBXBuildFile; fileRef = 34ABB2C22090C59600C727A6 /* OWSResaveCollectionDBMigration.m */; }; 34ABB2C42090C59700C727A6 /* OWSResaveCollectionDBMigration.m in Sources */ = {isa = PBXBuildFile; fileRef = 34ABB2C22090C59600C727A6 /* OWSResaveCollectionDBMigration.m */; };
34ABB2C52090C59700C727A6 /* OWSResaveCollectionDBMigration.h in Headers */ = {isa = PBXBuildFile; fileRef = 34ABB2C32090C59700C727A6 /* OWSResaveCollectionDBMigration.h */; }; 34ABB2C52090C59700C727A6 /* OWSResaveCollectionDBMigration.h in Headers */ = {isa = PBXBuildFile; fileRef = 34ABB2C32090C59700C727A6 /* OWSResaveCollectionDBMigration.h */; };
@ -805,7 +805,7 @@
349EA07B2162AEA700F7B17F /* OWS111UDAttributesMigration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWS111UDAttributesMigration.swift; sourceTree = "<group>"; }; 349EA07B2162AEA700F7B17F /* OWS111UDAttributesMigration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWS111UDAttributesMigration.swift; sourceTree = "<group>"; };
34A55F3520485464002CC6DE /* OWS2FARegistrationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWS2FARegistrationViewController.m; sourceTree = "<group>"; }; 34A55F3520485464002CC6DE /* OWS2FARegistrationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWS2FARegistrationViewController.m; sourceTree = "<group>"; };
34A55F3620485464002CC6DE /* OWS2FARegistrationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWS2FARegistrationViewController.h; sourceTree = "<group>"; }; 34A55F3620485464002CC6DE /* OWS2FARegistrationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWS2FARegistrationViewController.h; sourceTree = "<group>"; };
34A8B3502190A40E00218A25 /* MediaGalleryCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaGalleryCellView.swift; sourceTree = "<group>"; }; 34A8B3502190A40E00218A25 /* MediaAlbumCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaAlbumCellView.swift; sourceTree = "<group>"; };
34A9105E1FFEB113000C4745 /* OWSBackup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackup.h; sourceTree = "<group>"; }; 34A9105E1FFEB113000C4745 /* OWSBackup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackup.h; sourceTree = "<group>"; };
34A9105F1FFEB114000C4745 /* OWSBackup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSBackup.m; sourceTree = "<group>"; }; 34A9105F1FFEB114000C4745 /* OWSBackup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSBackup.m; sourceTree = "<group>"; };
34ABB2C22090C59600C727A6 /* OWSResaveCollectionDBMigration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSResaveCollectionDBMigration.m; sourceTree = "<group>"; }; 34ABB2C22090C59600C727A6 /* OWSResaveCollectionDBMigration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSResaveCollectionDBMigration.m; sourceTree = "<group>"; };
@ -1830,7 +1830,7 @@
3488F9352191CC4000E524CC /* ConversationMediaView.swift */, 3488F9352191CC4000E524CC /* ConversationMediaView.swift */,
34D1F0961F867BFC0066283D /* ConversationViewCell.h */, 34D1F0961F867BFC0066283D /* ConversationViewCell.h */,
34D1F0971F867BFC0066283D /* ConversationViewCell.m */, 34D1F0971F867BFC0066283D /* ConversationViewCell.m */,
34A8B3502190A40E00218A25 /* MediaGalleryCellView.swift */, 34A8B3502190A40E00218A25 /* MediaAlbumCellView.swift */,
34D1F0B81F8800D90066283D /* OWSAudioMessageView.h */, 34D1F0B81F8800D90066283D /* OWSAudioMessageView.h */,
34D1F0B91F8800D90066283D /* OWSAudioMessageView.m */, 34D1F0B91F8800D90066283D /* OWSAudioMessageView.m */,
34DBF005206C3CB100025978 /* OWSBubbleShapeView.h */, 34DBF005206C3CB100025978 /* OWSBubbleShapeView.h */,
@ -3369,7 +3369,7 @@
3403B95D20EA9527001A1F44 /* OWSContactShareButtonsView.m in Sources */, 3403B95D20EA9527001A1F44 /* OWSContactShareButtonsView.m in Sources */,
34B0796D1FCF46B100E248C2 /* MainAppContext.m in Sources */, 34B0796D1FCF46B100E248C2 /* MainAppContext.m in Sources */,
34E3EF101EFC2684007F6822 /* DebugUIPage.m in Sources */, 34E3EF101EFC2684007F6822 /* DebugUIPage.m in Sources */,
34A8B3512190A40E00218A25 /* MediaGalleryCellView.swift in Sources */, 34A8B3512190A40E00218A25 /* MediaAlbumCellView.swift in Sources */,
340FC8CD20518C77007AEB0F /* OWSBackupJob.m in Sources */, 340FC8CD20518C77007AEB0F /* OWSBackupJob.m in Sources */,
34D1F0AE1F867BFC0066283D /* OWSMessageCell.m in Sources */, 34D1F0AE1F867BFC0066283D /* OWSMessageCell.m in Sources */,
4C4AEC4520EC343B0020E72B /* DismissableTextField.swift in Sources */, 4C4AEC4520EC343B0020E72B /* DismissableTextField.swift in Sources */,

@ -339,7 +339,7 @@ private class MockConversationViewItem: NSObject, ConversationViewItem {
var authorConversationColorName: String? var authorConversationColorName: String?
var hasBodyTextActionContent: Bool = false var hasBodyTextActionContent: Bool = false
var hasMediaActionContent: Bool = false var hasMediaActionContent: Bool = false
var mediaGalleryItems: [ConversationMediaGalleryItem]? var mediaAlbumItems: [ConversationMediaAlbumItem]?
override init() { override init() {
super.init() super.init()

@ -4,9 +4,9 @@
import Foundation import Foundation
@objc(OWSMediaGalleryCellView) @objc(OWSMediaAlbumCellView)
public class MediaGalleryCellView: UIStackView { public class MediaAlbumCellView: UIStackView {
private let items: [ConversationMediaGalleryItem] private let items: [ConversationMediaAlbumItem]
@objc @objc
public let itemViews: [ConversationMediaView] public let itemViews: [ConversationMediaView]
@ -21,10 +21,10 @@ public class MediaGalleryCellView: UIStackView {
@objc @objc
public required init(mediaCache: NSCache<NSString, AnyObject>, public required init(mediaCache: NSCache<NSString, AnyObject>,
items: [ConversationMediaGalleryItem], items: [ConversationMediaAlbumItem],
maxMessageWidth: CGFloat) { maxMessageWidth: CGFloat) {
self.items = items self.items = items
self.itemViews = MediaGalleryCellView.itemsToDisplay(forItems: items).map { self.itemViews = MediaAlbumCellView.itemsToDisplay(forItems: items).map {
ConversationMediaView(mediaCache: mediaCache, ConversationMediaView(mediaCache: mediaCache,
attachment: $0.attachment) attachment: $0.attachment)
} }
@ -55,19 +55,19 @@ public class MediaGalleryCellView: UIStackView {
case 2: case 2:
// X X // X X
// side-by-side. // side-by-side.
let imageSize = (maxMessageWidth - MediaGalleryCellView.kSpacingPts) / 2 let imageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts) / 2
autoSet(viewSize: imageSize, ofViews: itemViews) autoSet(viewSize: imageSize, ofViews: itemViews)
for itemView in itemViews { for itemView in itemViews {
addArrangedSubview(itemView) addArrangedSubview(itemView)
} }
self.axis = .horizontal self.axis = .horizontal
self.spacing = MediaGalleryCellView.kSpacingPts self.spacing = MediaAlbumCellView.kSpacingPts
case 3: case 3:
// x // x
// X x // X x
// Big on left, 2 small on right. // Big on left, 2 small on right.
let smallImageSize = (maxMessageWidth - MediaGalleryCellView.kSpacingPts * 2) / 3 let smallImageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts * 2) / 3
let bigImageSize = smallImageSize * 2 + MediaGalleryCellView.kSpacingPts let bigImageSize = smallImageSize * 2 + MediaAlbumCellView.kSpacingPts
guard let leftItemView = itemViews.first else { guard let leftItemView = itemViews.first else {
owsFailDebug("Missing view") owsFailDebug("Missing view")
@ -81,12 +81,12 @@ public class MediaGalleryCellView: UIStackView {
axis: .vertical, axis: .vertical,
viewSize: smallImageSize)) viewSize: smallImageSize))
self.axis = .horizontal self.axis = .horizontal
self.spacing = MediaGalleryCellView.kSpacingPts self.spacing = MediaAlbumCellView.kSpacingPts
case 4: case 4:
// X X // X X
// X X // X X
// Square // Square
let imageSize = (maxMessageWidth - MediaGalleryCellView.kSpacingPts) / 2 let imageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts) / 2
let topViews = Array(itemViews[0..<2]) let topViews = Array(itemViews[0..<2])
addArrangedSubview(newRow(rowViews: topViews, addArrangedSubview(newRow(rowViews: topViews,
@ -99,13 +99,13 @@ public class MediaGalleryCellView: UIStackView {
viewSize: imageSize)) viewSize: imageSize))
self.axis = .vertical self.axis = .vertical
self.spacing = MediaGalleryCellView.kSpacingPts self.spacing = MediaAlbumCellView.kSpacingPts
default: default:
// X X // X X
// xxx // xxx
// 2 big on top, 3 small on bottom. // 2 big on top, 3 small on bottom.
let bigImageSize = (maxMessageWidth - MediaGalleryCellView.kSpacingPts) / 2 let bigImageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts) / 2
let smallImageSize = (maxMessageWidth - MediaGalleryCellView.kSpacingPts * 2) / 3 let smallImageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts * 2) / 3
let topViews = Array(itemViews[0..<2]) let topViews = Array(itemViews[0..<2])
addArrangedSubview(newRow(rowViews: topViews, addArrangedSubview(newRow(rowViews: topViews,
@ -118,9 +118,9 @@ public class MediaGalleryCellView: UIStackView {
viewSize: smallImageSize)) viewSize: smallImageSize))
self.axis = .vertical self.axis = .vertical
self.spacing = MediaGalleryCellView.kSpacingPts self.spacing = MediaAlbumCellView.kSpacingPts
if items.count > MediaGalleryCellView.kMaxItems { if items.count > MediaAlbumCellView.kMaxItems {
guard let lastView = bottomViews.last else { guard let lastView = bottomViews.last else {
owsFailDebug("Missing lastView") owsFailDebug("Missing lastView")
return return
@ -133,7 +133,7 @@ public class MediaGalleryCellView: UIStackView {
lastView.addSubview(tintView) lastView.addSubview(tintView)
tintView.autoPinEdgesToSuperviewEdges() tintView.autoPinEdgesToSuperviewEdges()
let moreCount = max(1, items.count - MediaGalleryCellView.kMaxItems) let moreCount = max(1, items.count - MediaAlbumCellView.kMaxItems)
let moreCountText = OWSFormat.formatInt(Int32(moreCount)) let moreCountText = OWSFormat.formatInt(Int32(moreCount))
let moreText = String(format: NSLocalizedString("MEDIA_GALLERY_MORE_ITEMS_FORMAT", let moreText = String(format: NSLocalizedString("MEDIA_GALLERY_MORE_ITEMS_FORMAT",
comment: "Format for the 'more items' indicator for media galleries. Embeds {{the number of additional items}}."), moreCountText) comment: "Format for the 'more items' indicator for media galleries. Embeds {{the number of additional items}}."), moreCountText)
@ -195,7 +195,7 @@ public class MediaGalleryCellView: UIStackView {
axis: UILayoutConstraintAxis) -> UIStackView { axis: UILayoutConstraintAxis) -> UIStackView {
let stackView = UIStackView(arrangedSubviews: rowViews) let stackView = UIStackView(arrangedSubviews: rowViews)
stackView.axis = axis stackView.axis = axis
stackView.spacing = MediaGalleryCellView.kSpacingPts stackView.spacing = MediaAlbumCellView.kSpacingPts
return stackView return stackView
} }
@ -213,7 +213,7 @@ public class MediaGalleryCellView: UIStackView {
} }
} }
private class func itemsToDisplay(forItems items: [ConversationMediaGalleryItem]) -> [ConversationMediaGalleryItem] { private class func itemsToDisplay(forItems items: [ConversationMediaAlbumItem]) -> [ConversationMediaAlbumItem] {
// TODO: Unless design changes, we want to display // TODO: Unless design changes, we want to display
// items which are still downloading and invalid // items which are still downloading and invalid
// items. // items.
@ -226,7 +226,7 @@ public class MediaGalleryCellView: UIStackView {
@objc @objc
public class func layoutSize(forMaxMessageWidth maxMessageWidth: CGFloat, public class func layoutSize(forMaxMessageWidth maxMessageWidth: CGFloat,
items: [ConversationMediaGalleryItem]) -> CGSize { items: [ConversationMediaAlbumItem]) -> CGSize {
let itemCount = itemsToDisplay(forItems: items).count let itemCount = itemsToDisplay(forItems: items).count
switch itemCount { switch itemCount {
case 0, 1, 4: case 0, 1, 4:

@ -240,7 +240,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
return self.hasBodyText; return self.hasBodyText;
case OWSMessageCellType_ContactShare: case OWSMessageCellType_ContactShare:
return NO; return NO;
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
// Is there a gallery title? // Is there a gallery title?
return self.hasBodyText; return self.hasBodyText;
} }
@ -324,8 +324,8 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
case OWSMessageCellType_ContactShare: case OWSMessageCellType_ContactShare:
bodyMediaView = [self loadViewForContactShare]; bodyMediaView = [self loadViewForContactShare];
break; break;
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
bodyMediaView = [self loadViewForMediaGallery]; bodyMediaView = [self loadViewForMediaAlbum];
break; break;
} }
@ -604,7 +604,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
case OWSMessageCellType_DownloadingAttachment: case OWSMessageCellType_DownloadingAttachment:
case OWSMessageCellType_ContactShare: case OWSMessageCellType_ContactShare:
return NO; return NO;
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
return YES; return YES;
} }
} }
@ -612,7 +612,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
- (BOOL)hasFullWidthMediaView - (BOOL)hasFullWidthMediaView
{ {
return (self.hasBodyMediaWithThumbnail || self.cellType == OWSMessageCellType_ContactShare return (self.hasBodyMediaWithThumbnail || self.cellType == OWSMessageCellType_ContactShare
|| self.cellType == OWSMessageCellType_MediaGallery); || self.cellType == OWSMessageCellType_MediaAlbum);
} }
- (BOOL)canFooterOverlayMedia - (BOOL)canFooterOverlayMedia
@ -780,19 +780,19 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
return tapForMoreLabel; return tapForMoreLabel;
} }
- (UIView *)loadViewForMediaGallery - (UIView *)loadViewForMediaAlbum
{ {
OWSAssertDebug(self.viewItem.mediaGalleryItems); OWSAssertDebug(self.viewItem.mediaAlbumItems);
OWSMediaGalleryCellView *galleryView = OWSMediaAlbumCellView *albumView =
[[OWSMediaGalleryCellView alloc] initWithMediaCache:self.cellMediaCache [[OWSMediaAlbumCellView alloc] initWithMediaCache:self.cellMediaCache
items:self.viewItem.mediaGalleryItems items:self.viewItem.mediaAlbumItems
maxMessageWidth:self.conversationStyle.maxMessageWidth]; maxMessageWidth:self.conversationStyle.maxMessageWidth];
self.loadCellContentBlock = ^{ self.loadCellContentBlock = ^{
[galleryView loadMedia]; [albumView loadMedia];
}; };
self.unloadCellContentBlock = ^{ self.unloadCellContentBlock = ^{
[galleryView unloadMedia]; [albumView unloadMedia];
}; };
for (UIView *itemView in galleryView.itemViews) { for (UIView *itemView in galleryView.itemViews) {
OWSBubbleShapeView *strokeView = [[OWSBubbleShapeView alloc] initDraw]; OWSBubbleShapeView *strokeView = [[OWSBubbleShapeView alloc] initDraw];
@ -803,7 +803,7 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
[self.viewConstraints addObjectsFromArray:[strokeView ows_autoPinToSuperviewEdges]]; [self.viewConstraints addObjectsFromArray:[strokeView ows_autoPinToSuperviewEdges]];
} }
return galleryView; return albumView;
} }
- (UIView *)loadViewForMedia - (UIView *)loadViewForMedia
@ -1050,9 +1050,9 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
result = CGSizeMake(maxMessageWidth, [OWSContactShareView bubbleHeight]); result = CGSizeMake(maxMessageWidth, [OWSContactShareView bubbleHeight]);
break; break;
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
result = [OWSMediaGalleryCellView layoutSizeForMaxMessageWidth:maxMessageWidth result = [OWSMediaAlbumCellView layoutSizeForMaxMessageWidth:maxMessageWidth
items:self.viewItem.mediaGalleryItems]; items:self.viewItem.mediaAlbumItems];
break; break;
} }
@ -1417,9 +1417,9 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
case OWSMessageCellType_ContactShare: case OWSMessageCellType_ContactShare:
[self.delegate didTapContactShareViewItem:self.viewItem]; [self.delegate didTapContactShareViewItem:self.viewItem];
break; break;
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
OWSAssertDebug(self.bodyMediaView); OWSAssertDebug(self.bodyMediaView);
OWSAssertDebug(self.viewItem.mediaGalleryItems.count > 0); OWSAssertDebug(self.viewItem.mediaAlbumItems.count > 0);
// For now, use first valid attachment. // For now, use first valid attachment.
TSAttachmentStream *_Nullable attachmentStream = self.viewItem.firstValidGalleryAttachment; TSAttachmentStream *_Nullable attachmentStream = self.viewItem.firstValidGalleryAttachment;

@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, OWSMessageCellType) {
OWSMessageCellType_GenericAttachment, OWSMessageCellType_GenericAttachment,
OWSMessageCellType_DownloadingAttachment, OWSMessageCellType_DownloadingAttachment,
OWSMessageCellType_ContactShare, OWSMessageCellType_ContactShare,
OWSMessageCellType_MediaGallery, OWSMessageCellType_MediaAlbum,
}; };
NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType); NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
@ -38,7 +38,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
@class TSThread; @class TSThread;
@class YapDatabaseReadTransaction; @class YapDatabaseReadTransaction;
@interface ConversationMediaGalleryItem : NSObject @interface ConversationMediaAlbumItem : NSObject
@property (nonatomic, readonly) TSAttachment *attachment; @property (nonatomic, readonly) TSAttachment *attachment;
@ -109,7 +109,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
@property (nonatomic, readonly, nullable) TSAttachmentStream *attachmentStream; @property (nonatomic, readonly, nullable) TSAttachmentStream *attachmentStream;
@property (nonatomic, readonly, nullable) TSAttachmentPointer *attachmentPointer; @property (nonatomic, readonly, nullable) TSAttachmentPointer *attachmentPointer;
@property (nonatomic, readonly) CGSize mediaSize; @property (nonatomic, readonly) CGSize mediaSize;
@property (nonatomic, readonly, nullable) NSArray<ConversationMediaGalleryItem *> *mediaGalleryItems; @property (nonatomic, readonly, nullable) NSArray<ConversationMediaAlbumItem *> *mediaAlbumItems;
@property (nonatomic, readonly, nullable) DisplayableText *displayableQuotedText; @property (nonatomic, readonly, nullable) DisplayableText *displayableQuotedText;
@property (nonatomic, readonly, nullable) NSString *quotedAttachmentMimetype; @property (nonatomic, readonly, nullable) NSString *quotedAttachmentMimetype;

@ -41,14 +41,14 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return @"OWSMessageCellType_Unknown"; return @"OWSMessageCellType_Unknown";
case OWSMessageCellType_ContactShare: case OWSMessageCellType_ContactShare:
return @"OWSMessageCellType_ContactShare"; return @"OWSMessageCellType_ContactShare";
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
return @"OWSMessageCellType_MediaGallery"; return @"OWSMessageCellType_MediaAlbum";
} }
} }
#pragma mark - #pragma mark -
@implementation ConversationMediaGalleryItem @implementation ConversationMediaAlbumItem
- (instancetype)initWithAttachment:(TSAttachment *)attachment - (instancetype)initWithAttachment:(TSAttachment *)attachment
attachmentStream:(nullable TSAttachmentStream *)attachmentStream attachmentStream:(nullable TSAttachmentStream *)attachmentStream
@ -95,7 +95,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
@property (nonatomic, nullable) TSAttachmentPointer *attachmentPointer; @property (nonatomic, nullable) TSAttachmentPointer *attachmentPointer;
@property (nonatomic, nullable) ContactShareViewModel *contactShare; @property (nonatomic, nullable) ContactShareViewModel *contactShare;
@property (nonatomic) CGSize mediaSize; @property (nonatomic) CGSize mediaSize;
@property (nonatomic, nullable) NSArray<ConversationMediaGalleryItem *> *mediaGalleryItems; @property (nonatomic, nullable) NSArray<ConversationMediaAlbumItem *> *mediaAlbumItems;
@property (nonatomic, nullable) NSString *systemMessageText; @property (nonatomic, nullable) NSString *systemMessageText;
@property (nonatomic, nullable) TSThread *incomingMessageAuthorThread; @property (nonatomic, nullable) TSThread *incomingMessageAuthorThread;
@property (nonatomic, nullable) NSString *authorConversationColorName; @property (nonatomic, nullable) NSString *authorConversationColorName;
@ -160,7 +160,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
self.displayableQuotedText = nil; self.displayableQuotedText = nil;
self.quotedReply = nil; self.quotedReply = nil;
self.systemMessageText = nil; self.systemMessageText = nil;
self.mediaGalleryItems = nil; self.mediaAlbumItems = nil;
[self updateAuthorConversationColorNameWithTransaction:transaction]; [self updateAuthorConversationColorNameWithTransaction:transaction];
@ -411,13 +411,13 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
- (nullable TSAttachmentStream *)firstValidGalleryAttachment - (nullable TSAttachmentStream *)firstValidGalleryAttachment
{ {
OWSAssertDebug(self.mediaGalleryItems.count > 0); OWSAssertDebug(self.mediaAlbumItems.count > 0);
// For now, use first valid attachment. // For now, use first valid attachment.
TSAttachmentStream *_Nullable attachmentStream = nil; TSAttachmentStream *_Nullable attachmentStream = nil;
for (ConversationMediaGalleryItem *mediaGalleryItem in self.mediaGalleryItems) { for (ConversationMediaAlbumItem *mediaAlbumItem in self.mediaAlbumItems) {
if (mediaGalleryItem.attachmentStream && mediaGalleryItem.attachmentStream.isValidVisualMedia) { if (mediaAlbumItem.attachmentStream && mediaAlbumItem.attachmentStream.isValidVisualMedia) {
attachmentStream = mediaGalleryItem.attachmentStream; attachmentStream = mediaAlbumItem.attachmentStream;
break; break;
} }
} }
@ -570,11 +570,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
} }
NSArray<TSAttachment *> *attachments = [message attachmentsWithTransaction:transaction]; NSArray<TSAttachment *> *attachments = [message attachmentsWithTransaction:transaction];
if ([message isMediaGalleryWithTransaction:transaction]) { if ([message isMediaAlbumWithTransaction:transaction]) {
OWSAssertDebug(attachments.count > 0); OWSAssertDebug(attachments.count > 0);
NSArray<ConversationMediaGalleryItem *> *mediaGalleryItems = [self mediaGalleryItemsForAttachments:attachments]; NSArray<ConversationMediaAlbumItem *> *mediaAlbumItems = [self mediaAlbumItemsForAttachments:attachments];
self.mediaGalleryItems = mediaGalleryItems; self.mediaAlbumItems = mediaAlbumItems;
self.messageCellType = OWSMessageCellType_MediaGallery; self.messageCellType = OWSMessageCellType_MediaAlbum;
NSString *_Nullable galleryTitle = [message bodyTextWithTransaction:transaction]; NSString *_Nullable galleryTitle = [message bodyTextWithTransaction:transaction];
if (galleryTitle) { if (galleryTitle) {
self.displayableBodyText = [self displayableBodyTextForText:galleryTitle interactionId:message.uniqueId]; self.displayableBodyText = [self displayableBodyTextForText:galleryTitle interactionId:message.uniqueId];
@ -682,51 +682,51 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
} }
} }
- (NSArray<ConversationMediaGalleryItem *> *)mediaGalleryItemsForAttachments:(NSArray<TSAttachment *> *)attachments - (NSArray<ConversationMediaAlbumItem *> *)mediaAlbumItemsForAttachments:(NSArray<TSAttachment *> *)attachments
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();
OWSAssertDebug(attachments.count > 0); OWSAssertDebug(attachments.count > 0);
NSMutableArray<ConversationMediaGalleryItem *> *mediaGalleryItems = [NSMutableArray new]; NSMutableArray<ConversationMediaAlbumItem *> *mediaAlbumItems = [NSMutableArray new];
for (TSAttachment *attachment in attachments) { for (TSAttachment *attachment in attachments) {
NSString *_Nullable caption = (attachment.caption NSString *_Nullable caption = (attachment.caption
? [self displayableCaptionForText:attachment.caption attachmentId:attachment.uniqueId].displayText ? [self displayableCaptionForText:attachment.caption attachmentId:attachment.uniqueId].displayText
: nil); : nil);
if (![attachment isKindOfClass:[TSAttachmentStream class]]) { if (![attachment isKindOfClass:[TSAttachmentStream class]]) {
[mediaGalleryItems addObject:[[ConversationMediaGalleryItem alloc] initWithAttachment:attachment [mediaAlbumItems addObject:[[ConversationMediaAlbumItem alloc] initWithAttachment:attachment
attachmentStream:nil attachmentStream:nil
caption:caption caption:caption
mediaSize:CGSizeZero]]; mediaSize:CGSizeZero]];
continue; continue;
} }
TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment; TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment;
if (![attachmentStream isValidVisualMedia]) { if (![attachmentStream isValidVisualMedia]) {
OWSLogWarn(@"Filtering invalid media."); OWSLogWarn(@"Filtering invalid media.");
[mediaGalleryItems addObject:[[ConversationMediaGalleryItem alloc] initWithAttachment:attachment [mediaAlbumItems addObject:[[ConversationMediaAlbumItem alloc] initWithAttachment:attachment
attachmentStream:nil attachmentStream:nil
caption:caption caption:caption
mediaSize:CGSizeZero]]; mediaSize:CGSizeZero]];
continue; continue;
} }
CGSize mediaSize = [attachmentStream imageSize]; CGSize mediaSize = [attachmentStream imageSize];
if (mediaSize.width <= 0 || mediaSize.height <= 0) { if (mediaSize.width <= 0 || mediaSize.height <= 0) {
OWSLogWarn(@"Filtering media with invalid size."); OWSLogWarn(@"Filtering media with invalid size.");
[mediaGalleryItems addObject:[[ConversationMediaGalleryItem alloc] initWithAttachment:attachment [mediaAlbumItems addObject:[[ConversationMediaAlbumItem alloc] initWithAttachment:attachment
attachmentStream:nil attachmentStream:nil
caption:caption caption:caption
mediaSize:CGSizeZero]]; mediaSize:CGSizeZero]];
continue; continue;
} }
ConversationMediaGalleryItem *mediaGalleryItem = ConversationMediaAlbumItem *mediaAlbumItem =
[[ConversationMediaGalleryItem alloc] initWithAttachment:attachment [[ConversationMediaAlbumItem alloc] initWithAttachment:attachment
attachmentStream:attachmentStream attachmentStream:attachmentStream
caption:caption caption:caption
mediaSize:mediaSize]; mediaSize:mediaSize];
[mediaGalleryItems addObject:mediaGalleryItem]; [mediaAlbumItems addObject:mediaAlbumItem];
} }
return mediaGalleryItems; return mediaAlbumItems;
} }
- (NSString *)systemMessageTextWithTransaction:(YapDatabaseReadTransaction *)transaction - (NSString *)systemMessageTextWithTransaction:(YapDatabaseReadTransaction *)transaction
@ -854,7 +854,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_AnimatedImage: case OWSMessageCellType_AnimatedImage:
case OWSMessageCellType_Audio: case OWSMessageCellType_Audio:
case OWSMessageCellType_Video: case OWSMessageCellType_Video:
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
case OWSMessageCellType_GenericAttachment: { case OWSMessageCellType_GenericAttachment: {
OWSAssertDebug(self.displayableBodyText); OWSAssertDebug(self.displayableBodyText);
[UIPasteboard.generalPasteboard setString:self.displayableBodyText.fullText]; [UIPasteboard.generalPasteboard setString:self.displayableBodyText.fullText];
@ -898,7 +898,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSFailDebug(@"Can't copy not-yet-downloaded attachment"); OWSFailDebug(@"Can't copy not-yet-downloaded attachment");
break; break;
} }
case OWSMessageCellType_MediaGallery: { case OWSMessageCellType_MediaAlbum: {
OWSFailDebug(@"Can't copy media gallery"); OWSFailDebug(@"Can't copy media gallery");
break; break;
} }
@ -942,13 +942,13 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSFailDebug(@"Can't share not-yet-downloaded attachment"); OWSFailDebug(@"Can't share not-yet-downloaded attachment");
break; break;
} }
case OWSMessageCellType_MediaGallery: { case OWSMessageCellType_MediaAlbum: {
// TODO: We need a "canShareMediaAction" method. // TODO: We need a "canShareMediaAction" method.
OWSAssertDebug(self.mediaGalleryItems); OWSAssertDebug(self.mediaAlbumItems);
NSMutableArray<TSAttachmentStream *> *attachmentStreams = [NSMutableArray new]; NSMutableArray<TSAttachmentStream *> *attachmentStreams = [NSMutableArray new];
for (ConversationMediaGalleryItem *mediaGalleryItem in self.mediaGalleryItems) { for (ConversationMediaAlbumItem *mediaAlbumItem in self.mediaAlbumItems) {
if (mediaGalleryItem.attachmentStream) { if (mediaAlbumItem.attachmentStream) {
[attachmentStreams addObject:mediaGalleryItem.attachmentStream]; [attachmentStreams addObject:mediaAlbumItem.attachmentStream];
} }
} }
if (attachmentStreams.count < 1) { if (attachmentStreams.count < 1) {
@ -978,7 +978,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(self.attachmentStream.originalFilePath); return UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(self.attachmentStream.originalFilePath);
case OWSMessageCellType_GenericAttachment: case OWSMessageCellType_GenericAttachment:
case OWSMessageCellType_DownloadingAttachment: case OWSMessageCellType_DownloadingAttachment:
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
return NO; return NO;
} }
} }
@ -1001,17 +1001,17 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_GenericAttachment: case OWSMessageCellType_GenericAttachment:
case OWSMessageCellType_DownloadingAttachment: case OWSMessageCellType_DownloadingAttachment:
return NO; return NO;
case OWSMessageCellType_MediaGallery: { case OWSMessageCellType_MediaAlbum: {
for (ConversationMediaGalleryItem *mediaGalleryItem in self.mediaGalleryItems) { for (ConversationMediaAlbumItem *mediaAlbumItem in self.mediaAlbumItems) {
if (!mediaGalleryItem.attachmentStream) { if (!mediaAlbumItem.attachmentStream) {
continue; continue;
} }
if (mediaGalleryItem.attachmentStream.isImage || mediaGalleryItem.attachmentStream.isAnimated) { if (mediaAlbumItem.attachmentStream.isImage || mediaAlbumItem.attachmentStream.isAnimated) {
return YES; return YES;
} }
if (mediaGalleryItem.attachmentStream.isVideo) { if (mediaAlbumItem.attachmentStream.isVideo) {
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum( if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(
mediaGalleryItem.attachmentStream.originalFilePath)) { mediaAlbumItem.attachmentStream.originalFilePath)) {
return YES; return YES;
} }
} }
@ -1064,15 +1064,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSFailDebug(@"Can't save not-yet-downloaded attachment"); OWSFailDebug(@"Can't save not-yet-downloaded attachment");
break; break;
} }
case OWSMessageCellType_MediaGallery: { case OWSMessageCellType_MediaAlbum: {
// TODO: Use PHPhotoLibrary. // TODO: Use PHPhotoLibrary.
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init]; ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
for (ConversationMediaGalleryItem *mediaGalleryItem in self.mediaGalleryItems) { for (ConversationMediaAlbumItem *mediaAlbumItem in self.mediaAlbumItems) {
if (!mediaGalleryItem.attachmentStream) { if (!mediaAlbumItem.attachmentStream) {
continue; continue;
} }
if (mediaGalleryItem.attachmentStream.isImage || mediaGalleryItem.attachmentStream.isAnimated) { if (mediaAlbumItem.attachmentStream.isImage || mediaAlbumItem.attachmentStream.isAnimated) {
NSData *data = [NSData dataWithContentsOfURL:[mediaGalleryItem.attachmentStream originalMediaURL]]; NSData *data = [NSData dataWithContentsOfURL:[mediaAlbumItem.attachmentStream originalMediaURL]];
if (!data) { if (!data) {
OWSFailDebug(@"Could not load image data"); OWSFailDebug(@"Could not load image data");
continue; continue;
@ -1085,11 +1085,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
} }
}]; }];
} }
if (mediaGalleryItem.attachmentStream.isVideo) { if (mediaAlbumItem.attachmentStream.isVideo) {
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum( if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(
mediaGalleryItem.attachmentStream.originalFilePath)) { mediaAlbumItem.attachmentStream.originalFilePath)) {
UISaveVideoAtPathToSavedPhotosAlbum( UISaveVideoAtPathToSavedPhotosAlbum(
mediaGalleryItem.attachmentStream.originalFilePath, self, nil, nil); mediaAlbumItem.attachmentStream.originalFilePath, self, nil, nil);
} }
} }
} }
@ -1124,7 +1124,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSMessageCellType_DownloadingAttachment: { case OWSMessageCellType_DownloadingAttachment: {
return NO; return NO;
} }
case OWSMessageCellType_MediaGallery: case OWSMessageCellType_MediaAlbum:
// TODO: I suspect we need separate "can save media", "can share media", etc. methods. // TODO: I suspect we need separate "can save media", "can share media", etc. methods.
return self.firstValidGalleryAttachment != nil; return self.firstValidGalleryAttachment != nil;
} }

@ -129,7 +129,7 @@ NS_ASSUME_NONNULL_BEGIN
}], }],
[OWSTableItem itemWithTitle:@"Send Media Gallery" [OWSTableItem itemWithTitle:@"Send Media Gallery"
actionBlock:^{ actionBlock:^{
[DebugUIMessages sendMediaGalleryInThread:thread]; [DebugUIMessages sendMediaAlbumInThread:thread];
}], }],
[OWSTableItem itemWithTitle:@"Send Exemplary Media Galleries" [OWSTableItem itemWithTitle:@"Send Exemplary Media Galleries"
actionBlock:^{ actionBlock:^{
@ -4642,7 +4642,7 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
} }
} }
+ (void)sendMediaGalleryInThread:(TSThread *)thread + (void)sendMediaAlbumInThread:(TSThread *)thread
{ {
OWSLogInfo(@""); OWSLogInfo(@"");
@ -4650,32 +4650,32 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
const uint32_t kMaxImageCount = 10; const uint32_t kMaxImageCount = 10;
uint32_t imageCount = kMinImageCount + arc4random_uniform(kMaxImageCount - kMinImageCount); uint32_t imageCount = kMinImageCount + arc4random_uniform(kMaxImageCount - kMinImageCount);
NSString *_Nullable messageBody = (arc4random_uniform(2) > 0 ? @"This is the media gallery title..." : nil); NSString *_Nullable messageBody = (arc4random_uniform(2) > 0 ? @"This is the media gallery title..." : nil);
[self sendMediaGalleryInThread:thread imageCount:imageCount messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:imageCount messageBody:messageBody];
} }
+ (void)sendExemplaryMediaGalleriesInThread:(TSThread *)thread + (void)sendExemplaryMediaGalleriesInThread:(TSThread *)thread
{ {
OWSLogInfo(@""); OWSLogInfo(@"");
[self sendMediaGalleryInThread:thread imageCount:2 messageBody:nil]; [self sendMediaAlbumInThread:thread imageCount:2 messageBody:nil];
[self sendMediaGalleryInThread:thread imageCount:3 messageBody:nil]; [self sendMediaAlbumInThread:thread imageCount:3 messageBody:nil];
[self sendMediaGalleryInThread:thread imageCount:4 messageBody:nil]; [self sendMediaAlbumInThread:thread imageCount:4 messageBody:nil];
[self sendMediaGalleryInThread:thread imageCount:5 messageBody:nil]; [self sendMediaAlbumInThread:thread imageCount:5 messageBody:nil];
[self sendMediaGalleryInThread:thread imageCount:6 messageBody:nil]; [self sendMediaAlbumInThread:thread imageCount:6 messageBody:nil];
[self sendMediaGalleryInThread:thread imageCount:7 messageBody:nil]; [self sendMediaAlbumInThread:thread imageCount:7 messageBody:nil];
NSString *messageBody = @"This is the media gallery title..."; NSString *messageBody = @"This is the media gallery title...";
[self sendMediaGalleryInThread:thread imageCount:2 messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:2 messageBody:messageBody];
[self sendMediaGalleryInThread:thread imageCount:3 messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:3 messageBody:messageBody];
[self sendMediaGalleryInThread:thread imageCount:4 messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:4 messageBody:messageBody];
[self sendMediaGalleryInThread:thread imageCount:5 messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:5 messageBody:messageBody];
[self sendMediaGalleryInThread:thread imageCount:6 messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:6 messageBody:messageBody];
[self sendMediaGalleryInThread:thread imageCount:7 messageBody:messageBody]; [self sendMediaAlbumInThread:thread imageCount:7 messageBody:messageBody];
} }
+ (void)sendMediaGalleryInThread:(TSThread *)thread + (void)sendMediaAlbumInThread:(TSThread *)thread
imageCount:(uint32_t)imageCount imageCount:(uint32_t)imageCount
messageBody:(nullable NSString *)messageBody messageBody:(nullable NSString *)messageBody
fakeAssetLoaders:(NSArray<DebugUIMessagesAssetLoader *> *)fakeAssetLoaders fakeAssetLoaders:(NSArray<DebugUIMessagesAssetLoader *> *)fakeAssetLoaders
{ {
OWSAssertDebug(imageCount > 0); OWSAssertDebug(imageCount > 0);
OWSLogInfo(@""); OWSLogInfo(@"");
@ -4706,9 +4706,9 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
}]; }];
} }
+ (void)sendMediaGalleryInThread:(TSThread *)thread + (void)sendMediaAlbumInThread:(TSThread *)thread
imageCount:(uint32_t)imageCount imageCount:(uint32_t)imageCount
messageBody:(nullable NSString *)messageBody messageBody:(nullable NSString *)messageBody
{ {
OWSAssertDebug(thread); OWSAssertDebug(thread);
@ -4721,10 +4721,10 @@ typedef OWSContact * (^OWSContactBlock)(YapDatabaseReadWriteTransaction *transac
]; ];
[DebugUIMessagesAssetLoader prepareAssetLoaders:fakeAssetLoaders [DebugUIMessagesAssetLoader prepareAssetLoaders:fakeAssetLoaders
success:^{ success:^{
[self sendMediaGalleryInThread:thread [self sendMediaAlbumInThread:thread
imageCount:imageCount imageCount:imageCount
messageBody:messageBody messageBody:messageBody
fakeAssetLoaders:fakeAssetLoaders]; fakeAssetLoaders:fakeAssetLoaders];
} }
failure:^{ failure:^{
OWSLogError(@"Could not prepare fake asset loaders."); OWSLogError(@"Could not prepare fake asset loaders.");

@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)hasAttachments; - (BOOL)hasAttachments;
- (NSArray<TSAttachment *> *)attachmentsWithTransaction:(YapDatabaseReadTransaction *)transaction; - (NSArray<TSAttachment *> *)attachmentsWithTransaction:(YapDatabaseReadTransaction *)transaction;
- (BOOL)isMediaGalleryWithTransaction:(YapDatabaseReadTransaction *)transaction; - (BOOL)isMediaAlbumWithTransaction:(YapDatabaseReadTransaction *)transaction;
- (void)setQuotedMessageThumbnailAttachmentStream:(TSAttachmentStream *)attachmentStream; - (void)setQuotedMessageThumbnailAttachmentStream:(TSAttachmentStream *)attachmentStream;

@ -214,7 +214,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
return [attachments copy]; return [attachments copy];
} }
- (BOOL)isMediaGalleryWithTransaction:(YapDatabaseReadTransaction *)transaction - (BOOL)isMediaAlbumWithTransaction:(YapDatabaseReadTransaction *)transaction
{ {
NSArray<TSAttachment *> *attachments = [self attachmentsWithTransaction:transaction]; NSArray<TSAttachment *> *attachments = [self attachmentsWithTransaction:transaction];
if (attachments.count < 2) { if (attachments.count < 2) {

Loading…
Cancel
Save