Rename to media album.

This commit is contained in:
Matthew Chen 2018-11-07 12:26:57 -05:00
parent 2dfd4b2c0d
commit 777e2b9251
3 changed files with 29 additions and 29 deletions

View File

@ -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 /* MediaAlbumGalleryCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A8B3502190A40E00218A25 /* MediaAlbumGalleryCellView.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 /* MediaAlbumGalleryCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaAlbumGalleryCellView.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 /* MediaAlbumGalleryCellView.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 /* MediaAlbumGalleryCellView.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 */,

View File

@ -4,8 +4,8 @@
import Foundation import Foundation
@objc(OWSMediaAlbumGalleryCellView) @objc(OWSMediaAlbumCellView)
public class MediaAlbumGalleryCellView: UIStackView { public class MediaAlbumCellView: UIStackView {
private let items: [ConversationMediaAlbumItem] private let items: [ConversationMediaAlbumItem]
@objc @objc
@ -24,7 +24,7 @@ public class MediaAlbumGalleryCellView: UIStackView {
items: [ConversationMediaAlbumItem], items: [ConversationMediaAlbumItem],
maxMessageWidth: CGFloat) { maxMessageWidth: CGFloat) {
self.items = items self.items = items
self.itemViews = MediaAlbumGalleryCellView.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 MediaAlbumGalleryCellView: UIStackView {
case 2: case 2:
// X X // X X
// side-by-side. // side-by-side.
let imageSize = (maxMessageWidth - MediaAlbumGalleryCellView.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 = MediaAlbumGalleryCellView.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 - MediaAlbumGalleryCellView.kSpacingPts * 2) / 3 let smallImageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts * 2) / 3
let bigImageSize = smallImageSize * 2 + MediaAlbumGalleryCellView.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 MediaAlbumGalleryCellView: UIStackView {
axis: .vertical, axis: .vertical,
viewSize: smallImageSize)) viewSize: smallImageSize))
self.axis = .horizontal self.axis = .horizontal
self.spacing = MediaAlbumGalleryCellView.kSpacingPts self.spacing = MediaAlbumCellView.kSpacingPts
case 4: case 4:
// X X // X X
// X X // X X
// Square // Square
let imageSize = (maxMessageWidth - MediaAlbumGalleryCellView.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 MediaAlbumGalleryCellView: UIStackView {
viewSize: imageSize)) viewSize: imageSize))
self.axis = .vertical self.axis = .vertical
self.spacing = MediaAlbumGalleryCellView.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 - MediaAlbumGalleryCellView.kSpacingPts) / 2 let bigImageSize = (maxMessageWidth - MediaAlbumCellView.kSpacingPts) / 2
let smallImageSize = (maxMessageWidth - MediaAlbumGalleryCellView.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 MediaAlbumGalleryCellView: UIStackView {
viewSize: smallImageSize)) viewSize: smallImageSize))
self.axis = .vertical self.axis = .vertical
self.spacing = MediaAlbumGalleryCellView.kSpacingPts self.spacing = MediaAlbumCellView.kSpacingPts
if items.count > MediaAlbumGalleryCellView.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 MediaAlbumGalleryCellView: UIStackView {
lastView.addSubview(tintView) lastView.addSubview(tintView)
tintView.autoPinEdgesToSuperviewEdges() tintView.autoPinEdgesToSuperviewEdges()
let moreCount = max(1, items.count - MediaAlbumGalleryCellView.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 MediaAlbumGalleryCellView: 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 = MediaAlbumGalleryCellView.kSpacingPts stackView.spacing = MediaAlbumCellView.kSpacingPts
return stackView return stackView
} }

View File

@ -784,15 +784,15 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
{ {
OWSAssertDebug(self.viewItem.mediaAlbumItems); OWSAssertDebug(self.viewItem.mediaAlbumItems);
OWSMediaAlbumGalleryCellView *galleryView = OWSMediaAlbumCellView *albumView =
[[OWSMediaAlbumGalleryCellView alloc] initWithMediaCache:self.cellMediaCache [[OWSMediaAlbumCellView alloc] initWithMediaCache:self.cellMediaCache
items:self.viewItem.mediaAlbumItems 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
@ -1051,8 +1051,8 @@ const UIDataDetectorTypes kOWSAllowedDataDetectorTypes
result = CGSizeMake(maxMessageWidth, [OWSContactShareView bubbleHeight]); result = CGSizeMake(maxMessageWidth, [OWSContactShareView bubbleHeight]);
break; break;
case OWSMessageCellType_MediaAlbum: case OWSMessageCellType_MediaAlbum:
result = [OWSMediaAlbumGalleryCellView layoutSizeForMaxMessageWidth:maxMessageWidth result = [OWSMediaAlbumCellView layoutSizeForMaxMessageWidth:maxMessageWidth
items:self.viewItem.mediaAlbumItems]; items:self.viewItem.mediaAlbumItems];
break; break;
} }