Skip to content

Commit

Permalink
Fix list row height
Browse files Browse the repository at this point in the history
  • Loading branch information
liang2kl committed Sep 27, 2021
1 parent f2fa891 commit db26370
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 40 deletions.
16 changes: 8 additions & 8 deletions Source/Hollow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Hollow/Hollow.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = C5UH93T368;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Hollow/Info.plist;
Expand All @@ -1442,7 +1442,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.0.1;
MARKETING_VERSION = 4.0.2;
PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand All @@ -1459,7 +1459,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = Hollow/Hollow.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = C5UH93T368;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Hollow/Info.plist;
Expand All @@ -1468,7 +1468,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 4.0.1;
MARKETING_VERSION = 4.0.2;
PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
Expand All @@ -1484,7 +1484,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = HollowWidget/HollowWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = C5UH93T368;
INFOPLIST_FILE = HollowWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -1493,7 +1493,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 4.0.1;
MARKETING_VERSION = 4.0.2;
OTHER_SWIFT_FLAGS = "-DWIDGET";
PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow.HollowWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1511,7 +1511,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = HollowWidget/HollowWidgetExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 77;
CURRENT_PROJECT_VERSION = 78;
DEVELOPMENT_TEAM = C5UH93T368;
INFOPLIST_FILE = HollowWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -1520,7 +1520,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 4.0.1;
MARKETING_VERSION = 4.0.2;
OTHER_SWIFT_FLAGS = "-DWIDGET";
PRODUCT_BUNDLE_IDENTIFIER = treehollow.Hollow.HollowWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
45 changes: 14 additions & 31 deletions Source/Hollow/View/Hierarchy/Main/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,38 +53,21 @@ struct SearchView: View {
.verticalCenter()
.horizontalCenter()
} else {
let listView = {
PostListView(
postDataWrappers: $store.posts,
detailStore: $detailStore,
revealFoldedTags: store.type != .searchTrending,
voteHandler: store.vote,
starHandler: store.star,
imageReloadHandler: { _ in store.fetchImages() }
)
.defaultPadding(.horizontal)
}
Group {
if store.type == .search {
// FIXME: List
// Use ScrollView rather than List for search
// because when row height changes (by the loading
// of extra comments), List will not update the
// height correspondingly
CustomScrollView(
didScrollToBottom: store.loadMorePosts,
refresh: store.refresh) {
LazyVStack(spacing: 0) { listView() }
}
} else {
CustomList(
didScrollToBottom: store.loadMorePosts,
refresh: store.refresh,
content: listView)
CustomList(
didScrollToBottom: store.loadMorePosts,
refresh: store.refresh) {
PostListView(
postDataWrappers: $store.posts,
detailStore: $detailStore,
revealFoldedTags: store.type != .searchTrending,
voteHandler: store.vote,
starHandler: store.star,
imageReloadHandler: { _ in store.fetchImages() }
)
.defaultPadding(.horizontal)
}
}
.proposedIgnoringSafeArea(edges: .bottom)
.modifier(LoadingIndicator(isLoading: store.isLoading))
.proposedIgnoringSafeArea(edges: .bottom)
.modifier(LoadingIndicator(isLoading: store.isLoading))
}
} else {
Spacer()
Expand Down
9 changes: 8 additions & 1 deletion Source/Hollow/ViewModel/Hollow/HollowDetailStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ class HollowDetailStore: ObservableObject, ImageCompressStore, HollowErrorHandle
// source of truth when the detail view exists.
bindingCancellable = $postDataWrapper
.receive(on: DispatchQueue.main)
.assign(to: \.bindingPostWrapper.wrappedValue, on: self)
.sink { post in
var post = post
// FIXME: Updating Comments
// Use original comments, as comments change will cause
// the post card to be misplaced in List.
post.post.comments = bindingPostWrapper.post.comments.wrappedValue
bindingPostWrapper.wrappedValue = post
}
}

func cancelAll() {
Expand Down

0 comments on commit db26370

Please sign in to comment.