Skip to content

Commit

Permalink
Comment view update and bug fixes
Browse files Browse the repository at this point in the history
Showing replying comment before the content; Adjust maximum scale factor for image viewer
  • Loading branch information
liang2kl committed May 16, 2021
1 parent daab7a1 commit 1f3553c
Show file tree
Hide file tree
Showing 18 changed files with 262 additions and 125 deletions.
24 changes: 12 additions & 12 deletions Source/Hollow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
0E42907B263A8584008DA046 /* AppCenterAnalytics in Frameworks */ = {isa = PBXBuildFile; productRef = 0E42907A263A8584008DA046 /* AppCenterAnalytics */; };
0E42907D263A8584008DA046 /* AppCenterCrashes in Frameworks */ = {isa = PBXBuildFile; productRef = 0E42907C263A8584008DA046 /* AppCenterCrashes */; };
0E42907F263A8584008DA046 /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 0E42907E263A8584008DA046 /* Kingfisher */; };
0E429081263A8584008DA046 /* ImageScrollView in Frameworks */ = {isa = PBXBuildFile; productRef = 0E429080263A8584008DA046 /* ImageScrollView */; };
0E429083263A8584008DA046 /* Cache in Frameworks */ = {isa = PBXBuildFile; productRef = 0E429082263A8584008DA046 /* Cache */; };
0E4E4BC52634619A00B32F7F /* View+roundedCorner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4E4BC42634619A00B32F7F /* View+roundedCorner.swift */; };
0E58810F25EA0F47006F6A94 /* View+presentPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E58810E25EA0F47006F6A94 /* View+presentPopover.swift */; };
Expand Down Expand Up @@ -313,10 +312,12 @@
0ED1A16726346CB1001453A7 /* ReCAPTCHAPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1A16626346CB1001453A7 /* ReCAPTCHAPageView.swift */; };
0ED1A16826346CB1001453A7 /* ReCAPTCHAPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1A16626346CB1001453A7 /* ReCAPTCHAPageView.swift */; };
0ED1A16B26346D28001453A7 /* ViewLayouts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E415AF625CD772200351672 /* ViewLayouts.swift */; };
0ED1BF58264E664C005483C1 /* View+keyboardShortCut.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED1BF57264E664C005483C1 /* View+keyboardShortCut.swift */; };
0ED81A25263D4C2300939B82 /* View+defaultToggleStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED81A24263D4C2300939B82 /* View+defaultToggleStyle.swift */; };
0ED82F0026103FB600A799C0 /* View+defaultPadding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ED82EFF26103FB600A799C0 /* View+defaultPadding.swift */; };
0EDA262725D22C8600B67292 /* DeviceListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDA262625D22C8600B67292 /* DeviceListView.swift */; };
0EDA263125D2465100B67292 /* LoadingIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDA263025D2465100B67292 /* LoadingIndicator.swift */; };
0EDEC0E52650E5A6003112BA /* View+makeButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EDEC0E42650E5A6003112BA /* View+makeButton.swift */; };
0EE60EFD25FCCCD700D97E7A /* CheckmarkButtonImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE60EFC25FCCCD700D97E7A /* CheckmarkButtonImage.swift */; };
0EF10F6626330F29004D6538 /* HollowDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EF10F6526330F29004D6538 /* HollowDetailViewController.swift */; };
0EFA3DDE25D3A03D0003C76B /* LoadingLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFA3DDD25D3A03D0003C76B /* LoadingLabel.swift */; };
Expand Down Expand Up @@ -551,10 +552,12 @@
0ED087D026354556003C2E11 /* PostListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostListView.swift; sourceTree = "<group>"; };
0ED1A15F26346C37001453A7 /* ReCAPTCHAWebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReCAPTCHAWebView.swift; sourceTree = "<group>"; };
0ED1A16626346CB1001453A7 /* ReCAPTCHAPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReCAPTCHAPageView.swift; sourceTree = "<group>"; };
0ED1BF57264E664C005483C1 /* View+keyboardShortCut.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+keyboardShortCut.swift"; sourceTree = "<group>"; };
0ED81A24263D4C2300939B82 /* View+defaultToggleStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+defaultToggleStyle.swift"; sourceTree = "<group>"; };
0ED82EFF26103FB600A799C0 /* View+defaultPadding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+defaultPadding.swift"; sourceTree = "<group>"; };
0EDA262625D22C8600B67292 /* DeviceListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceListView.swift; sourceTree = "<group>"; };
0EDA263025D2465100B67292 /* LoadingIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingIndicator.swift; sourceTree = "<group>"; };
0EDEC0E42650E5A6003112BA /* View+makeButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+makeButton.swift"; sourceTree = "<group>"; };
0EE60EFC25FCCCD700D97E7A /* CheckmarkButtonImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckmarkButtonImage.swift; sourceTree = "<group>"; };
0EF10F6526330F29004D6538 /* HollowDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HollowDetailViewController.swift; sourceTree = "<group>"; };
0EFA3DDD25D3A03D0003C76B /* LoadingLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingLabel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -597,7 +600,6 @@
0E429079263A8584008DA046 /* Alamofire in Frameworks */,
0E429077263A8584008DA046 /* Defaults in Frameworks */,
0E429075263A8584008DA046 /* WaterfallGrid in Frameworks */,
0E429081263A8584008DA046 /* ImageScrollView in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -853,6 +855,8 @@
0E36F54525D0F0FB001AE852 /* GetFrame.swift */,
0E6721D525DE2DDB00A84311 /* GetSafeAreaInsets.swift */,
0E186C38262C60A1001A5855 /* View+showToast.swift */,
0ED1BF57264E664C005483C1 /* View+keyboardShortCut.swift */,
0EDEC0E42650E5A6003112BA /* View+makeButton.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down Expand Up @@ -1315,7 +1319,6 @@
0E42907A263A8584008DA046 /* AppCenterAnalytics */,
0E42907C263A8584008DA046 /* AppCenterCrashes */,
0E42907E263A8584008DA046 /* Kingfisher */,
0E429080263A8584008DA046 /* ImageScrollView */,
0E429082263A8584008DA046 /* Cache */,
);
productName = HollowMac;
Expand Down Expand Up @@ -1441,6 +1444,7 @@
0E415B5425CD772200351672 /* ImageButtonModifier.swift in Sources */,
0E6721DD25DE326400A84311 /* View+conditionalPadding.swift in Sources */,
0EFE13F4262876FE007B0045 /* View+imageSaver.swift in Sources */,
0EDEC0E52650E5A6003112BA /* View+makeButton.swift in Sources */,
0EC2458126340311001AFC4B /* SystemMessage.swift in Sources */,
0E3E6960260E3676005E8DA2 /* SplitView.swift in Sources */,
0E6721D625DE2DDB00A84311 /* GetSafeAreaInsets.swift in Sources */,
Expand Down Expand Up @@ -1468,6 +1472,7 @@
0EC245FF26340312001AFC4B /* PostCache.swift in Sources */,
0E1DD7D625D983BE000D27BA /* Avatar.swift in Sources */,
0EC245D326340312001AFC4B /* Request+publisher.swift in Sources */,
0ED1BF58264E664C005483C1 /* View+keyboardShortCut.swift in Sources */,
0EC2458D26340311001AFC4B /* HollowImage.swift in Sources */,
0EC2462E2634040D001AFC4B /* LoginStore.swift in Sources */,
0EC245A526340311001AFC4B /* DefaultRequest.swift in Sources */,
Expand Down Expand Up @@ -1856,7 +1861,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Hollow/Hollow.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 47;
CURRENT_PROJECT_VERSION = 48;
DEVELOPMENT_TEAM = C5UH93T368;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Hollow/Info.plist;
Expand All @@ -1865,7 +1870,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.9;
MARKETING_VERSION = 3.0.10;
PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand All @@ -1882,7 +1887,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Hollow/Hollow.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 47;
CURRENT_PROJECT_VERSION = 48;
DEVELOPMENT_TEAM = C5UH93T368;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Hollow/Info.plist;
Expand All @@ -1891,7 +1896,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.9;
MARKETING_VERSION = 3.0.10;
PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand Down Expand Up @@ -2127,11 +2132,6 @@
package = 0E429068263A8524008DA046 /* XCRemoteSwiftPackageReference "Kingfisher" */;
productName = Kingfisher;
};
0E429080263A8584008DA046 /* ImageScrollView */ = {
isa = XCSwiftPackageProductDependency;
package = 0E42906E263A8557008DA046 /* XCRemoteSwiftPackageReference "ImageScrollView" */;
productName = ImageScrollView;
};
0E429082263A8584008DA046 /* Cache */ = {
isa = XCSwiftPackageProductDependency;
package = 0E429071263A8572008DA046 /* XCRemoteSwiftPackageReference "Cache" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0xB2",
"green" : "0xA5",
"red" : "0xA6"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0x8D",
"green" : "0x7B",
"red" : "0x7C"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
1 change: 1 addition & 0 deletions Source/Hollow/View/Customization/CustomColors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ extension Color {

static var tint: Color { customColor(prefix: "tint") }

static let hollowCommentQuoteText = Color("hollow.content.comment.quote.text")
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct HollowCommentContentView: View {
var postColorIndex: Int
var postHash: Int
var imageReloadHandler: ((HollowImage) -> Void)? = nil
var jumpToReplyingHandler: (() -> Void)? = nil
private let compactLineLimit = 3
private var nameLabelWidth: CGFloat {
return compact ? labelWidth : body45
Expand Down Expand Up @@ -85,6 +86,31 @@ struct HollowCommentContentView: View {
}
}

if let commentInfo = commentData.replyToCommentInfo, !compact {
let nameText = Text(verbatim: "\(commentInfo.name) ").bold()
Group {
if commentInfo.text != "" {
nameText + Text(commentInfo.text)
} else if commentInfo.hasImage {
nameText + Text(Image(systemName: "photo"))
} else {
nameText
}
}
.leading()
.dynamicFont(size: 14)
.lineLimit(3)
.lineSpacing(0.8)
.padding(4)
.padding(.horizontal, 2)
.foregroundColor(.hollowCommentQuoteText)
.background(Color.hollowCommentQuoteText.opacity(0.09))
.cornerRadius(3)
.padding(.vertical, 2)
.makeButton(action: { jumpToReplyingHandler?() })
.buttonStyle(PlainButtonStyle())
}

if commentData.image != nil && !compact {
HollowImageView(
hollowImage: commentData.image,
Expand All @@ -94,34 +120,33 @@ struct HollowCommentContentView: View {
)
.roundedCorner(4)
.padding(.top, UIDevice.isMac ? 10 : 5)
.padding(.bottom, UIDevice.isMac ? 13 : 10)
.fixedSize(horizontal: false, vertical: true)
}
Group {
let replyText = (commentData.replyTo != -1 ?
Text(Image(systemName: "arrow.turn.up.right")) + Text(" ") :
Text("")
)
.foregroundColor(Color.hollowCardStarUnselected.opacity(colorScheme == .light ? 0.3 : 0.8))

if commentData.text != "" {

if compact || !commentData.renderHighlight {
replyText + Text(commentData.text)
} else {
replyText + Text.highlightLinksAndCitation(commentData.text, modifiers: {
$0.underline()
.foregroundColor(.hollowContentText)
})

if commentData.text != "" || (commentData.image != nil && compact) {
if commentData.image != nil && !compact {
Spacer(minLength: UIDevice.isMac ? 10 : 5).fixedSize()
}
Group {
if commentData.text != "" {
if compact || !commentData.renderHighlight {
Text(commentData.text)
} else {
Text.highlightLinksAndCitation(commentData.text, modifiers: {
$0.underline()
.foregroundColor(.hollowContentText)
})
}
} else if commentData.image != nil && compact {
(Text(verbatim: "[") + Text("TEXTVIEW_PHOTO_PLACEHOLDER_TEXT") + Text(verbatim: "]"))
.foregroundColor(.uiColor(.secondaryLabel))
}
} else if commentData.image != nil && compact {
(replyText + Text("[") + Text("TEXTVIEW_PHOTO_PLACEHOLDER_TEXT") + Text("]"))
.foregroundColor(.uiColor(.secondaryLabel))
}
.leading()
.lineLimit(compact ? compactLineLimit : nil)
.layoutPriority(1)
}
.leading()
.lineLimit(compact ? compactLineLimit : nil)
.layoutPriority(1)

}
}

Expand Down
Loading

0 comments on commit 1f3553c

Please sign in to comment.