From d7543113952cbe3a4a8f45f7fec7607d51c0eb95 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Mon, 6 Dec 2021 09:50:47 +1100 Subject: [PATCH 1/2] update version & build number --- Session.xcodeproj/project.pbxproj | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 65323a6ce..eb3fd9e22 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -5049,7 +5049,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 306; + CURRENT_PROJECT_VERSION = 312; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5074,7 +5074,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.11.18; + MARKETING_VERSION = 1.11.19; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5122,7 +5122,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 306; + CURRENT_PROJECT_VERSION = 312; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -5152,7 +5152,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.11.18; + MARKETING_VERSION = 1.11.19; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.ShareExtension"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -5188,7 +5188,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 306; + CURRENT_PROJECT_VERSION = 312; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -5211,7 +5211,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.11.18; + MARKETING_VERSION = 1.11.19; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension"; @@ -5262,7 +5262,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 306; + CURRENT_PROJECT_VERSION = 312; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = SUQ8J2PCT7; ENABLE_NS_ASSERTIONS = NO; @@ -5290,7 +5290,7 @@ "@executable_path/Frameworks", "@executable_path/../../Frameworks", ); - MARKETING_VERSION = 1.11.18; + MARKETING_VERSION = 1.11.19; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger.NotificationServiceExtension"; @@ -6198,7 +6198,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 306; + CURRENT_PROJECT_VERSION = 312; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -6237,7 +6237,7 @@ "$(SRCROOT)", ); LLVM_LTO = NO; - MARKETING_VERSION = 1.11.18; + MARKETING_VERSION = 1.11.19; OTHER_LDFLAGS = "$(inherited)"; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; @@ -6269,7 +6269,7 @@ CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 306; + CURRENT_PROJECT_VERSION = 312; DEVELOPMENT_TEAM = SUQ8J2PCT7; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -6308,7 +6308,7 @@ "$(SRCROOT)", ); LLVM_LTO = NO; - MARKETING_VERSION = 1.11.18; + MARKETING_VERSION = 1.11.19; OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger"; PRODUCT_NAME = Session; From 5e521a81925386079513bfd322cf0212a2f08844 Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Tue, 7 Dec 2021 14:12:48 +1100 Subject: [PATCH 2/2] fix the issue where no text will show along with a doc type attachment --- .../Content Views/DocumentView.swift | 18 ++++++--------- .../Message Cells/VisibleMessageCell.swift | 21 +++++++++++++++--- .../Session/File.imageset/Contents.json | 12 ++++++++++ .../Session/File.imageset/doc.pdf | Bin 0 -> 4310 bytes 4 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 Session/Meta/Images.xcassets/Session/File.imageset/Contents.json create mode 100644 Session/Meta/Images.xcassets/Session/File.imageset/doc.pdf diff --git a/Session/Conversations/Message Cells/Content Views/DocumentView.swift b/Session/Conversations/Message Cells/Content Views/DocumentView.swift index ff2b2e73d..372befc8c 100644 --- a/Session/Conversations/Message Cells/Content Views/DocumentView.swift +++ b/Session/Conversations/Message Cells/Content Views/DocumentView.swift @@ -4,8 +4,7 @@ final class DocumentView : UIView { private let textColor: UIColor // MARK: Settings - private static let iconSize: CGFloat = 24 - private static let iconImageViewSize: CGFloat = 40 + private static let iconImageViewSize: CGSize = CGSize(width: 26, height: 40) // MARK: Lifecycle init(viewItem: ConversationViewItem, textColor: UIColor) { @@ -26,26 +25,23 @@ final class DocumentView : UIView { private func setUpViewHierarchy() { guard let attachment = viewItem.attachmentStream ?? viewItem.attachmentPointer else { return } // Image view - let iconSize = DocumentView.iconSize - let icon = UIImage(named: "actionsheet_document_black")?.withTint(textColor)?.resizedImage(to: CGSize(width: iconSize, height: iconSize)) + let icon = UIImage(named: "File")?.withTint(textColor) let imageView = UIImageView(image: icon) imageView.contentMode = .center let iconImageViewSize = DocumentView.iconImageViewSize - imageView.set(.width, to: iconImageViewSize) - imageView.set(.height, to: iconImageViewSize) + imageView.set(.width, to: iconImageViewSize.width) + imageView.set(.height, to: iconImageViewSize.height) // Body label let titleLabel = UILabel() titleLabel.lineBreakMode = .byTruncatingTail titleLabel.text = attachment.sourceFilename ?? "File" titleLabel.textColor = textColor - titleLabel.font = .systemFont(ofSize: Values.mediumFontSize) + titleLabel.font = .systemFont(ofSize: Values.mediumFontSize, weight: .light) // Stack view let stackView = UIStackView(arrangedSubviews: [ imageView, titleLabel ]) stackView.axis = .horizontal - stackView.alignment = .center - stackView.isLayoutMarginsRelativeArrangement = true - stackView.layoutMargins = UIEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 12) + stackView.spacing = Values.verySmallSpacing addSubview(stackView) - stackView.pin(to: self, withInset: Values.smallSpacing) + stackView.pin(to: self) } } diff --git a/Session/Conversations/Message Cells/VisibleMessageCell.swift b/Session/Conversations/Message Cells/VisibleMessageCell.swift index fe529aa51..db69e60e7 100644 --- a/Session/Conversations/Message Cells/VisibleMessageCell.swift +++ b/Session/Conversations/Message Cells/VisibleMessageCell.swift @@ -362,7 +362,6 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate { let maxMessageWidth = VisibleMessageCell.getMaxWidth(for: viewItem) let albumView = MediaAlbumView(mediaCache: cache, items: viewItem.mediaAlbumItems!, isOutgoing: isOutgoing, maxMessageWidth: maxMessageWidth) self.albumView = albumView - snContentView.addSubview(albumView) let size = getSize(for: viewItem) albumView.set(.width, to: size.width) albumView.set(.height, to: size.height) @@ -398,9 +397,25 @@ final class VisibleMessageCell : MessageCell, LinkPreviewViewDelegate { Storage.shared.getContact(with: thread.contactSessionID())?.isTrusted != true { showMediaPlaceholder() } else { + let inset: CGFloat = 12 + let maxWidth = VisibleMessageCell.getMaxWidth(for: viewItem) - 2 * inset + // Stack view + let stackView = UIStackView(arrangedSubviews: []) + stackView.axis = .vertical + stackView.spacing = Values.smallSpacing + // Document view let documentView = DocumentView(viewItem: viewItem, textColor: bodyLabelTextColor) - snContentView.addSubview(documentView) - documentView.pin(to: snContentView) + stackView.addArrangedSubview(documentView) + // Body text view + if let message = viewItem.interaction as? TSMessage, let body = message.body, body.count > 0, + let delegate = delegate { // delegate should always be set at this point + let bodyTextView = VisibleMessageCell.getBodyTextView(for: viewItem, with: maxWidth, textColor: bodyLabelTextColor, searchText: delegate.lastSearchedText, delegate: self) + self.bodyTextView = bodyTextView + stackView.addArrangedSubview(bodyTextView) + } + // Constraints + snContentView.addSubview(stackView) + stackView.pin(to: snContentView, withInset: inset) } case .deletedMessage: let deletedMessageView = DeletedMessageView(viewItem: viewItem, textColor: bodyLabelTextColor) diff --git a/Session/Meta/Images.xcassets/Session/File.imageset/Contents.json b/Session/Meta/Images.xcassets/Session/File.imageset/Contents.json new file mode 100644 index 000000000..df41b260e --- /dev/null +++ b/Session/Meta/Images.xcassets/Session/File.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "doc.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Session/Meta/Images.xcassets/Session/File.imageset/doc.pdf b/Session/Meta/Images.xcassets/Session/File.imageset/doc.pdf new file mode 100644 index 0000000000000000000000000000000000000000..4338f23a167302e52ad9bce56015c86851f4cd0b GIT binary patch literal 4310 zcmai&2{=^W|HmyO456}9Zn7lXEVila%OtWVYs`$XZ;i1h##Xj05vGvHz7<6@_DK9p zvL}QrSrgfp|M;%`{@>s4`JLxJ_nzl-KIe1pJ?Ha&p4aCJ8)#@rLZ#qf;nwLN(+l}) zPd>D^f#CoI@IX6*FJA_vwVYh>SRCc)io#axeXXk4^MSI2t4F!yKZEj_T|xTA&S#}wLx{GaVYEDk)?O)ej=x^;07 z#_ka#nN|7Vq>yWTW)I`5kZdDDjIXF!90VcxImyZIc~u53#N3}q8iLT$e>%+^-5DSS zhiS}OaR|lJD%@igsln;m)N)8uk&|a&*i(C*(j@ByL6-9>%eI{sD2sPAfRy zEol!HSw+r^u8o3z@h6is1E1MNJ-4?oRpZRK}yY!0Yoied!+H%H6qq+)F6z z6r4R|@;l+RV=+SAS#$Gcr~to-ty1|(mHh34%_$$g6}IN8!B3SOcKS6Y6}9-1$!1V+ zq!2A(ua?+jWM{j~TY^z35YF#{)3R zun{0_g!S_9#$m8tfXwd(bq{wuW!wum5|7c5EdGdhH2$ZU3~(M8V=Nx9qy*K_0;~aP zbq`k$oUtbgg9VP%rtSp=Wd8{8OANVRV(3v;kXAhsr8`BDfV2kI#|eWqLaO~GOPCxK z_Me6Ot5`E0`kELIbKWJB z8mWfJOkttuLB=0!25n7-8k*Ciu`Y}&rLt>d#Qk>j@!{F(!C{A$put)ygS}8t zGv16kL?+veeR-kD>g1`;)=e62Hfk0#>c$Csdk}IgEmh=eHm`X%&l{P{*gAtTqVPmcEGXM5P56sL&TV=u$wZq-HNAPhw|DEYE)|45 z-KJ|+B-=F#rpeB;9QA{SiXpib@dn2dvyE`fr1Hyi_!WVCPn77d08~HdsH(;uubqi>y_wWH z$t=ngv$*K$MV;j$B|ay=n-%Kuz9AB^nclg)YkDbgp|sK*FS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