Bgerstle has uploaded a new change for review. https://gerrit.wikimedia.org/r/226726
Change subject: fix gallery image owner label overflow ...................................................................... fix gallery image owner label overflow Needed to add tail truncation to attributed string attributes (since it attributes were overriding UIButton.titleLabel.lineBreakMode), as well as adding a >= "standard" trailing constraint to the button. See Phab ticket for screencaps of the fix. Bug: T106174 Change-Id: I73e51682200dea5186e9e6e0a6c5f06d79a837a5 --- M Wikipedia.xcodeproj/project.pbxproj D Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.m R Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.h A Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.m M Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.m M Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.xib 6 files changed, 51 insertions(+), 37 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia refs/changes/26/226726/1 diff --git a/Wikipedia.xcodeproj/project.pbxproj b/Wikipedia.xcodeproj/project.pbxproj index 40d3040..48f6477 100644 --- a/Wikipedia.xcodeproj/project.pbxproj +++ b/Wikipedia.xcodeproj/project.pbxproj @@ -230,7 +230,6 @@ BC0FED751AAA026C002488D7 /* NSArray+BKIndexTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB58F7B1A8D0C8E00465627 /* NSArray+BKIndexTests.m */; }; BC0FED761AAA026C002488D7 /* NSString+WMFHTMLParsingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C983151B1AA5205700E25EE1 /* NSString+WMFHTMLParsingTests.m */; }; BC0FED771AAA026C002488D7 /* WMFImageURLParsingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCBDE0AB1AA76EAC006BD29A /* WMFImageURLParsingTests.m */; }; - BC23759A1AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2375991AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.m */; }; BC23759E1AB8928600B0BAA8 /* WMFDateFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC23759D1AB8928600B0BAA8 /* WMFDateFormatterTests.m */; }; BC2375C11ABB14CC00B0BAA8 /* WMFArticleImageInjectionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2375C01ABB14CC00B0BAA8 /* WMFArticleImageInjectionTests.m */; }; BC2CBB8E1AA10F400079A313 /* UIView+WMFFrameUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = BC2CBB8D1AA10F400079A313 /* UIView+WMFFrameUtils.m */; }; @@ -245,6 +244,7 @@ BC5FE5751B1DFF5400273BC0 /* ArticleFetcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC5FE5741B1DFF5400273BC0 /* ArticleFetcherTests.m */; }; BC69C3141AB0C1FF0090B039 /* WMFImageInfoController.m in Sources */ = {isa = PBXBuildFile; fileRef = BC69C3131AB0C1FF0090B039 /* WMFImageInfoController.m */; }; BC6BF4001B19213600362968 /* XCTestCase+WMFLocaleTesting.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6BF3FE1B19209900362968 /* XCTestCase+WMFLocaleTesting.m */; }; + BC725ECF1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.m in Sources */ = {isa = PBXBuildFile; fileRef = BC725ECE1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.m */; }; BC7DFCD61AA4E5FE000035C3 /* WMFImageURLParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7DFCD51AA4E5FE000035C3 /* WMFImageURLParsing.m */; }; BC7E4A521B34B53E00EECD8B /* MWKLanguageLinkControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC7E4A511B34B53E00EECD8B /* MWKLanguageLinkControllerTests.m */; }; BC86B9361A92966B00B4C039 /* AFHTTPRequestOperationManager+UniqueRequests.m in Sources */ = {isa = PBXBuildFile; fileRef = BC86B9351A92966B00B4C039 /* AFHTTPRequestOperationManager+UniqueRequests.m */; }; @@ -773,8 +773,6 @@ BC092BA11B19135700093C59 /* WMFApiJsonResponseSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WMFApiJsonResponseSerializer.m; path = Serializers/WMFApiJsonResponseSerializer.m; sourceTree = "<group>"; }; BC092BA61B19189100093C59 /* MWKSiteInfoFetcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MWKSiteInfoFetcherTests.m; sourceTree = "<group>"; }; BC14F89F1B34B72500860018 /* WikipediaUnitTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WikipediaUnitTests-Prefix.pch"; sourceTree = "<group>"; }; - BC2375981AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSParagraphStyle+WMFNaturalAlignmentStyle.h"; sourceTree = "<group>"; }; - BC2375991AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSParagraphStyle+WMFNaturalAlignmentStyle.m"; sourceTree = "<group>"; }; BC23759D1AB8928600B0BAA8 /* WMFDateFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WMFDateFormatterTests.m; sourceTree = "<group>"; }; BC2375C01ABB14CC00B0BAA8 /* WMFArticleImageInjectionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WMFArticleImageInjectionTests.m; sourceTree = "<group>"; }; BC282E271AE7FBB1005A5277 /* WMFTestFixtureUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WMFTestFixtureUtilities.h; sourceTree = "<group>"; }; @@ -799,6 +797,8 @@ BC6BF3FD1B19209900362968 /* XCTestCase+WMFLocaleTesting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCTestCase+WMFLocaleTesting.h"; sourceTree = "<group>"; }; BC6BF3FE1B19209900362968 /* XCTestCase+WMFLocaleTesting.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCTestCase+WMFLocaleTesting.m"; sourceTree = "<group>"; }; BC6FEAE01A9B7EFD00A1D890 /* WMFCodingStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WMFCodingStyle.m; sourceTree = "<group>"; }; + BC725ECD1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSParagraphStyle+WMFParagraphStyles.h"; sourceTree = "<group>"; }; + BC725ECE1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSParagraphStyle+WMFParagraphStyles.m"; sourceTree = "<group>"; }; BC7A4A231B17B3510003E73E /* NSObjectUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSObjectUtilities.h; sourceTree = "<group>"; }; BC7ACB621AB34C9C00791497 /* WMFAsyncTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WMFAsyncTestCase.h; path = ../WMFAsyncTestCase.h; sourceTree = "<group>"; }; BC7ACB631AB34C9C00791497 /* WMFAsyncTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WMFAsyncTestCase.m; path = ../WMFAsyncTestCase.m; sourceTree = "<group>"; }; @@ -1909,12 +1909,12 @@ BCC185DF1A9EC836005378F8 /* UIButton+FrameUtils.m */, BC2CBB8C1AA10F400079A313 /* UIView+WMFFrameUtils.h */, BC2CBB8D1AA10F400079A313 /* UIView+WMFFrameUtils.m */, + BC725ECD1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.h */, + BC725ECE1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.m */, 0EA4402C1AA6281200B09DBA /* NSDateFormatter+WMFExtensions.h */, 0EA4402D1AA6281200B09DBA /* NSDateFormatter+WMFExtensions.m */, BCA96E751AAA35EE009A61FA /* UIView+WMFDefaultNib.h */, BCA96E761AAA35EE009A61FA /* UIView+WMFDefaultNib.m */, - BC2375981AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.h */, - BC2375991AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.m */, BCA6765B1AC0686600A16160 /* Article+ConvenienceAccessors.h */, BCA6765C1AC0686600A16160 /* Article+ConvenienceAccessors.m */, BC90C4BC1AC219FE009F36D2 /* UIWindow+WMFMainScreenWindow.h */, @@ -3128,7 +3128,6 @@ 040892641935ABBD004CF254 /* UIViewController+StatusBarHeight.m in Sources */, 04142A8F184F974E006EF779 /* NSDate-Utilities.m in Sources */, 0487048C19F8262600B7D307 /* SearchResultFetcher.m in Sources */, - BC23759A1AB78D8A00B0BAA8 /* NSParagraphStyle+WMFNaturalAlignmentStyle.m in Sources */, 04090A3B187FB7D000577EDF /* UIView+Debugging.m in Sources */, BCC185D81A9E5628005378F8 /* UILabel+WMFStyling.m in Sources */, 0EFB0F241B31EE2D00D05C08 /* Saved.m in Sources */, @@ -3289,6 +3288,7 @@ D47BF5D4197870390067C3BC /* SavedPagesFunnel.m in Sources */, 04616DFC1AE706C600815BCE /* WMFLocalizationProtocol.m in Sources */, 04C43AC0183442FC006C643B /* NSString+Extras.m in Sources */, + BC725ECF1B628C0300E0A64C /* NSParagraphStyle+WMFParagraphStyles.m in Sources */, 04D686FE1AB2949C0009B44A /* WikiGlyphLabel.m in Sources */, 04CCCFEE1935093A00E3F60C /* SecondaryMenuRowView.m in Sources */, 04D686CE1AB292160009B44A /* WMFFaceDetector.m in Sources */, diff --git a/Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.m b/Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.m deleted file mode 100644 index 7e5c325..0000000 --- a/Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// NSParagraphStyle+WMFNaturalAlignmentStyle.m -// Wikipedia -// -// Created by Brian Gerstle on 3/16/15. -// Copyright (c) 2015 Wikimedia Foundation. All rights reserved. -// - -#import "NSParagraphStyle+WMFNaturalAlignmentStyle.h" - -@implementation NSParagraphStyle (WMFNaturalAlignmentStyle) - -+ (NSParagraphStyle*)wmf_naturalAlignmentStyle { - NSParameterAssert([NSThread isMainThread]); - static NSParagraphStyle* naturalAlignmentStyle = nil; - if (!naturalAlignmentStyle) { - NSMutableParagraphStyle* style = [NSMutableParagraphStyle new]; - style.alignment = NSTextAlignmentNatural; - naturalAlignmentStyle = [style copy]; - } - return naturalAlignmentStyle; -} - -@end diff --git a/Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.h b/Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.h similarity index 66% rename from Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.h rename to Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.h index c92d4d1..cc6bf5d 100644 --- a/Wikipedia/Categories/NSParagraphStyle+WMFNaturalAlignmentStyle.h +++ b/Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.h @@ -1,5 +1,5 @@ // -// NSParagraphStyle+WMFNaturalAlignmentStyle.h +// NSParagraphStyle+WMFParagraphStyles.h // Wikipedia // // Created by Brian Gerstle on 3/16/15. @@ -8,9 +8,11 @@ #import <UIKit/UIKit.h> -@interface NSParagraphStyle (WMFNaturalAlignmentStyle) +@interface NSParagraphStyle (WMFParagraphStyles) /// Provides a backwards-compatible way to have "natural" text alignment of labels & buttons. + (NSParagraphStyle*)wmf_naturalAlignmentStyle; ++ (NSParagraphStyle*)wmf_tailTruncatingNaturalAlignmentStyle; + @end diff --git a/Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.m b/Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.m new file mode 100644 index 0000000..cfd3e7a --- /dev/null +++ b/Wikipedia/Categories/NSParagraphStyle+WMFParagraphStyles.m @@ -0,0 +1,36 @@ +// +// NSParagraphStyle+WMFParagraphStyles.m +// Wikipedia +// +// Created by Brian Gerstle on 3/16/15. +// Copyright (c) 2015 Wikimedia Foundation. All rights reserved. +// + +#import "NSParagraphStyle+WMFParagraphStyles.h" + +@implementation NSParagraphStyle (WMFParagraphStyles) + ++ (NSParagraphStyle*)wmf_naturalAlignmentStyle { + NSParameterAssert([NSThread isMainThread]); + static NSParagraphStyle* naturalAlignmentStyle = nil; + if (!naturalAlignmentStyle) { + NSMutableParagraphStyle* style = [NSMutableParagraphStyle new]; + style.alignment = NSTextAlignmentNatural; + naturalAlignmentStyle = [style copy]; + } + return naturalAlignmentStyle; +} + ++ (NSParagraphStyle*)wmf_tailTruncatingNaturalAlignmentStyle { + NSParameterAssert([NSThread isMainThread]); + static NSParagraphStyle* tailTruncatingNaturalAlignmentStyle = nil; + if (!tailTruncatingNaturalAlignmentStyle) { + NSMutableParagraphStyle* style = [NSMutableParagraphStyle new]; + style.alignment = NSTextAlignmentNatural; + style.lineBreakMode = NSLineBreakByTruncatingTail; + tailTruncatingNaturalAlignmentStyle = [style copy]; + } + return tailTruncatingNaturalAlignmentStyle; +} + +@end diff --git a/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.m b/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.m index 63346cc..9cae0d0 100644 --- a/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.m +++ b/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.m @@ -12,7 +12,7 @@ #import "WikiGlyph_Chars.h" #import "UILabel+WMFStyling.h" #import "MWKLicense+ToGlyph.h" -#import "NSParagraphStyle+WMFNaturalAlignmentStyle.h" +#import "NSParagraphStyle+WMFParagraphStyles.h" static double const WMFImageGalleryLicenseFontSize = 19.0; static double const WMFImageGalleryLicenseBaselineOffset = -1.5; @@ -25,7 +25,6 @@ - (IBAction)didTapOwnerButton; @end - static NSAttributedString* ConcatOwnerAndLicense(NSString* owner, MWKLicense* license){ if (!owner && !license) { @@ -53,7 +52,7 @@ [result appendAttributedString:attributedOwnerAndSeparator]; [result addAttribute:NSParagraphStyleAttributeName - value:[NSParagraphStyle wmf_naturalAlignmentStyle] + value:[NSParagraphStyle wmf_tailTruncatingNaturalAlignmentStyle] range:NSMakeRange(0, result.length)]; return result; diff --git a/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.xib b/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.xib index 90d3706..2af405a 100644 --- a/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.xib +++ b/Wikipedia/View Controllers/Image Gallery/WMFImageGalleryDetailOverlayView.xib @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6751" systemVersion="14C1510" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14E46" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> @@ -36,6 +36,7 @@ <constraints> <constraint firstItem="I6f-Vm-XuX" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="100" id="0L5-I0-Yi9"/> <constraint firstItem="I6f-Vm-XuX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="2k3-u8-8nA"/> + <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="l6E-b6-poB" secondAttribute="trailing" constant="20" symbolic="YES" id="7RJ-RE-3u1"/> <constraint firstAttribute="bottom" secondItem="l6E-b6-poB" secondAttribute="bottom" constant="8" id="PWz-xR-vOr"/> <constraint firstItem="l6E-b6-poB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="e6B-Lc-WcL"/> <constraint firstItem="l6E-b6-poB" firstAttribute="top" secondItem="I6f-Vm-XuX" secondAttribute="bottom" constant="8" symbolic="YES" id="eSj-hx-LwA"/> -- To view, visit https://gerrit.wikimedia.org/r/226726 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I73e51682200dea5186e9e6e0a6c5f06d79a837a5 Gerrit-PatchSet: 1 Gerrit-Project: apps/ios/wikipedia Gerrit-Branch: master Gerrit-Owner: Bgerstle <bgers...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits