From 881364685258f768d3cf0423585fac627118c769 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Thu, 27 Jun 2019 15:29:33 -0400 Subject: [PATCH 1/4] Added exportIcon images. Added convenience function which adds the new images to attributed string. --- MVMCoreUI/Atoms/Views/Label.swift | 22 +++++++++++++++++ .../Media.xcassets/Contents.json | 6 +++++ .../externalLink.imageset/Contents.json | 23 ++++++++++++++++++ .../externalLink.imageset/exportBlack.png | Bin 0 -> 345 bytes .../externalLink.imageset/exportBlack@2x.png | Bin 0 -> 589 bytes .../externalLink.imageset/exportBlack@3x.png | Bin 0 -> 869 bytes 6 files changed, 51 insertions(+) create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/Contents.json create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@2x.png create mode 100644 MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@3x.png diff --git a/MVMCoreUI/Atoms/Views/Label.swift b/MVMCoreUI/Atoms/Views/Label.swift index a0733521..69e22119 100644 --- a/MVMCoreUI/Atoms/Views/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label.swift @@ -340,6 +340,28 @@ public typealias ActionBlock = () -> Void standardFontSize = 0 } } + + /** + Appends an external link imcage to the end of the attributed string. + + - Attention: This method expects text to be set first. Otherwise, it will do nothing. + - Parameters: + - magnitude: Applied to Width and Height of image for congruency. + */ + public func addExternalLinkIcon(magnitude: Int = 12) { + + guard let attributedText = self.attributedText else { return } + + let fullString = NSMutableAttributedString(attributedString: attributedText) + + let imageAttachment = NSTextAttachment() + imageAttachment.image = MVMCoreUIUtility.imageNamed("externalLink") + imageAttachment.bounds = CGRect(x: 0, y: 0, width: magnitude, height: magnitude) + + fullString.append(NSAttributedString(string: " ")) + fullString.append(NSAttributedString(attachment: imageAttachment)) + self.attributedText = fullString + } } // MARK: - Atomization diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/Contents.json b/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/Contents.json new file mode 100644 index 00000000..07a5a9f8 --- /dev/null +++ b/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "exportBlack.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "exportBlack@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "exportBlack@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack.png b/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack.png new file mode 100644 index 0000000000000000000000000000000000000000..34f6d7e9c930cfd3b15aa1fd6be1e88c0e281a28 GIT binary patch literal 345 zcmV-f0jBPx$6G=otR5%gMk}*yLK@3GFhz__y1QnspDN^PFTp_38DAdpqr9z^BGE$T}%YPov z?wSm%DJZb?$6kMr*JC@SK{`x3FfKSG_gUq$XVa`u7`PWXB0WgIU=Oj*{8U|^!x^py z=}Hm3_fl4sjc-PqA;Ge-tqu#tTdY?n&sTlBLo z?S-ZACVU9Df(Z#~J$E`NHjG)I%RH#=e7oiRO`e=!;#=Y1-&Dnx*c!A}Px%2T4RhR9Fe^mpM|zFc3v&fC~_D2#6sfnRKe)8eD`ka1TNPa&kBX5EDVw(66np zl5LH=%o@0>+Pz7wuhwFFKC9CT^UN6K9>Zu}iOMP6i$vEiN@m5LcLHI&GkH(Sx$NeN)yQE z`(H+vWD1wYtT+S!m1gd9b9eV+QEJj_ZA%FhJHA8|%a=|N2TB!tV7J+fqsPE49-8sW zlAI^QvmKridz4BNkUa$1h8Y4a_~!pHhLi-!*^4_{uMZlPh`Wr=@5W5?!#EydM(#@~ z67_LJ7=05plW3YC^NX}^BHED*;WsE;fG zQU3^NYv)y&6Dc6P{vcj7eCY8S)F-H^ZPM~=t3m=oUhNT$dSePpNi0jcKeEA*&Ts2S z6&69JX{gX?>S*e_0K{(@U`Ej{_s|4rR0X;^O-nXasH*~9@$??z7Tq;uCV77L$$&l_-Z00000NkvXXu0mjf1aSuz literal 0 HcmV?d00001 diff --git a/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@3x.png b/MVMCoreUI/SupportingFiles/Media.xcassets/externalLink.imageset/exportBlack@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..15f13e3249cc453310cf2b87eed836add51186f8 GIT binary patch literal 869 zcmV-r1DgDaP)Px&A4x<(RA>e5SUYkQF%Y%E0faV*Q;vW+fD>~9LZ5+z09W}41SC{(4k8je;Q+u% zFjWMOTm}8c^R&HEOEc1FXLq*LRdQ=v-TnF_&5U(;VADTaypo<^YH1x)$6D;xo>0T$ z<%@@gI~Rks2z{sE8*_o&Uw^bLk2Yx;i#7;C3A#X!M1aYaTCk=cdp&d!V4ZO^)!qZv z*JREy=R6nyd2fN z|1E+SGH|GHxDHr*%*_WM7Df_4I;X;s)gRxkXvcd_m`gkS)+`j<7i-`OO;ZbwT${ue@I1DV{PhFgE3&M57Mk<9E@h7!cVd1 z0UwopDIS5yHwH!ka1gU|6ADWBmq(x7UmwVUaqE8*$#-RtGkp-{Prbnp;jd);l7Tlu zK**%V83Pb}f&0`|tJc;B05U-dU;9Y>T?5Pl(mf?RVvB9*)XZ$J5orU96edsH%9vNLh;}Puq%e8n{VgLO#OHYhNoq%Z;fvUO z_axnoTdei9Jq|5XYwTSLiZeKNDO21o?DK Date: Mon, 1 Jul 2019 14:23:44 -0400 Subject: [PATCH 2/4] link icon now scales in size with the text. --- MVMCoreUI/Atoms/Views/Label.swift | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/Label.swift b/MVMCoreUI/Atoms/Views/Label.swift index a524dbac..858e87d6 100644 --- a/MVMCoreUI/Atoms/Views/Label.swift +++ b/MVMCoreUI/Atoms/Views/Label.swift @@ -342,14 +342,11 @@ public typealias ActionBlock = () -> Void } } - /** - Appends an external link imcage to the end of the attributed string. - - - Attention: This method expects text to be set first. Otherwise, it will do nothing. - - Parameters: - - magnitude: Applied to Width and Height of image for congruency. - */ - public func addExternalLinkIcon(magnitude: Int = 12) { + + ///Appends an external link image to the end of the attributed string. + public func addExternalLinkIcon() { + + let size = round(font.pointSize * 0.8) guard let attributedText = self.attributedText else { return } @@ -357,7 +354,7 @@ public typealias ActionBlock = () -> Void let imageAttachment = NSTextAttachment() imageAttachment.image = MVMCoreUIUtility.imageNamed("externalLink") - imageAttachment.bounds = CGRect(x: 0, y: 0, width: magnitude, height: magnitude) + imageAttachment.bounds = CGRect(x: 0, y: 0, width: size, height: size) fullString.append(NSAttributedString(string: " ")) fullString.append(NSAttributedString(attachment: imageAttachment)) From 436e9035d24cb338d65ef4aea8a85d3b84b90a97 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Wed, 3 Jul 2019 13:21:52 -0400 Subject: [PATCH 3/4] resolve discussions --- MVMCoreUI/Atoms/Views/ViewConstrainingView.h | 2 +- MVMCoreUI/Atoms/Views/ViewConstrainingView.m | 3 ++- MVMCoreUI/Molecules/StandardFooterView.swift | 2 +- MVMCoreUI/Molecules/StandardHeaderView.swift | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/MVMCoreUI/Atoms/Views/ViewConstrainingView.h b/MVMCoreUI/Atoms/Views/ViewConstrainingView.h index 9ec6c193..a98a181d 100644 --- a/MVMCoreUI/Atoms/Views/ViewConstrainingView.h +++ b/MVMCoreUI/Atoms/Views/ViewConstrainingView.h @@ -37,7 +37,7 @@ @property (weak, nullable, nonatomic) UIView *molecule; /// A flag for if we should add a molecule from json. -@property (nonatomic) BOOL setupMoleculeFromJSON; +@property (nonatomic) BOOL shouldSetupMoleculeFromJSON; // Returns an empty view + (nonnull ViewConstrainingView *)emptyView; diff --git a/MVMCoreUI/Atoms/Views/ViewConstrainingView.m b/MVMCoreUI/Atoms/Views/ViewConstrainingView.m index 093e1ecc..1f6b568f 100644 --- a/MVMCoreUI/Atoms/Views/ViewConstrainingView.m +++ b/MVMCoreUI/Atoms/Views/ViewConstrainingView.m @@ -341,7 +341,7 @@ [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; [self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - if (self.setupMoleculeFromJSON && !self.molecule) { + if (self.shouldSetupMoleculeFromJSON && !self.molecule) { NSDictionary *moleculeJSON = [json dict:KeyMolecule]; if (moleculeJSON) { UIView *molecule = [[MVMCoreUIMoleculeMappingObject sharedMappingObject] createMoleculeForJSON:moleculeJSON delegateObject:delegateObject constrainIfNeeded:true]; @@ -349,6 +349,7 @@ [self insertSubview:molecule atIndex:0]; [self pinViewToSuperView:molecule]; } + self.molecule = molecule; } } if (self.molecule) { diff --git a/MVMCoreUI/Molecules/StandardFooterView.swift b/MVMCoreUI/Molecules/StandardFooterView.swift index a135ccc0..59f7c0a9 100644 --- a/MVMCoreUI/Molecules/StandardFooterView.swift +++ b/MVMCoreUI/Molecules/StandardFooterView.swift @@ -11,7 +11,7 @@ import UIKit open class StandardFooterView: ViewConstrainingView { open override func setupView() { super.setupView() - setupMoleculeFromJSON = true + shouldSetupMoleculeFromJSON = true } open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { diff --git a/MVMCoreUI/Molecules/StandardHeaderView.swift b/MVMCoreUI/Molecules/StandardHeaderView.swift index ff5b8538..bf6e2580 100644 --- a/MVMCoreUI/Molecules/StandardHeaderView.swift +++ b/MVMCoreUI/Molecules/StandardHeaderView.swift @@ -19,7 +19,7 @@ public class StandardHeaderView: ViewConstrainingView { public override func setupView() { super.setupView() - setupMoleculeFromJSON = true + shouldSetupMoleculeFromJSON = true if separatorView == nil, let separatorView = SeparatorView.separatorAdd(to: self, position: SeparatorPositionBot, withHorizontalPadding: 0) { separatorView.setAsHeavy() addSubview(separatorView) From b8b1e0ddba0cc7ad1976380c0cdfa0fb0242b4df Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Mon, 15 Jul 2019 11:43:42 -0400 Subject: [PATCH 4/4] Expose status bar color setting. --- MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h index 5f49eb13..9850cca3 100644 --- a/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h +++ b/MVMCoreUI/TopAlert/MVMCoreUITopAlertView.h @@ -50,4 +50,7 @@ // Get the background color based on the type - (nonnull UIColor *)getBackgroundColorForType:(nullable NSString *)type; +// Set the status bar color. Used for updating the status bar when the view changes. +- (void)setStatusBarColor:(nullable UIColor *)statusBarColor statusBarStyle:(UIStatusBarStyle)style; + @end