Skip to content

Commit

Permalink
fix: Comments clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuz0u committed Aug 22, 2021
1 parent 71b05fe commit b355820
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
8 changes: 4 additions & 4 deletions EhPanda.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 80;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ShareExtension/Info.plist;
Expand All @@ -988,7 +988,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 80;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ShareExtension/Info.plist;
Expand Down Expand Up @@ -1138,7 +1138,7 @@
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 80;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
ENABLE_PREVIEWS = YES;
Expand Down Expand Up @@ -1168,7 +1168,7 @@
CODE_SIGN_ENTITLEMENTS = EhPanda/EhPanda.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 80;
CURRENT_PROJECT_VERSION = 81;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 9SKQ7QTZ74;
ENABLE_PREVIEWS = YES;
Expand Down
25 changes: 18 additions & 7 deletions EhPanda/View/Detail/CommentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private struct CommentCell: View {
)
}
}
.padding(.top, 1)
.fixedSize(horizontal: false, vertical: true)
}
.padding()
}
Expand All @@ -332,26 +332,26 @@ private struct CommentCell: View {
let secondLink = secondLink
{
KFImage(URL(string: imgURL))
.defaultModifier()
.commentDefaultModifier()
.scaledToFit()
.frame(width: windowW / 4)
.onTapGesture {
linkAction(link.safeURL())
}
KFImage(URL(string: secondImgURL))
.defaultModifier()
.commentDefaultModifier()
.scaledToFit()
.frame(width: windowW / 4)
.onTapGesture {
linkAction(secondLink.safeURL())
}
} else {
KFImage(URL(string: imgURL))
.defaultModifier()
.commentDefaultModifier()
.scaledToFit()
.frame(width: windowW / 4)
KFImage(URL(string: secondImgURL))
.defaultModifier()
.commentDefaultModifier()
.scaledToFit()
.frame(width: windowW / 4)
}
Expand All @@ -361,22 +361,33 @@ private struct CommentCell: View {
else if let imgURL = imgURL {
if let link = link {
KFImage(URL(string: imgURL))
.defaultModifier()
.commentDefaultModifier()
.scaledToFit()
.frame(width: windowW / 2)
.onTapGesture {
linkAction(link.safeURL())
}
} else {
KFImage(URL(string: imgURL))
.defaultModifier()
.commentDefaultModifier()
.scaledToFit()
.frame(width: windowW / 2)
}
}
}
}

private extension KFImage {
func commentDefaultModifier() -> KFImage {
defaultModifier()
.placeholder {
Placeholder(
style: .activity(ratio: 1)
)
}
}
}

// MARK: Definition
enum CommentViewSheetState: Identifiable {
var id: Int { hashValue }
Expand Down

0 comments on commit b355820

Please sign in to comment.