Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
6 changes: 1 addition & 5 deletions Resell.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1540;
LastUpgradeCheck = 1540;
LastUpgradeCheck = 1620;
TargetAttributes = {
2C9B4CC62C8FB7B70029DF61 = {
CreatedOnToolsVersion = 15.4;
Expand Down Expand Up @@ -1230,7 +1230,6 @@
2C9B4CEF2C8FB7B80029DF61 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -1250,7 +1249,6 @@
2C9B4CF02C8FB7B80029DF61 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
Expand All @@ -1270,7 +1268,6 @@
2C9B4CF22C8FB7B80029DF61 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ZGMCXU7X3U;
Expand All @@ -1288,7 +1285,6 @@
2C9B4CF32C8FB7B80029DF61 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ZGMCXU7X3U;
Expand Down
2 changes: 1 addition & 1 deletion Resell.xcodeproj/xcshareddata/xcschemes/Resell.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
LastUpgradeVersion = "1620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Resell/Models/Listing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct Listing: Codable {

enum CodingKeys: String, CodingKey {
case id, title, description, categories
case originalPrice = "original_price"
case originalPrice = "originalPrice"
case images, user
}
}
Expand Down
2 changes: 1 addition & 1 deletion Resell/Models/Post.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct PostBody: Codable {
case description
case categories
case condition
case original_price = "original_price"
case original_price = "originalPrice"
case imagesBase64
case userId
}
Expand Down
4 changes: 2 additions & 2 deletions Resell/Models/Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ struct PostSummary: Codable, Hashable {

private enum CodingKeys: String, CodingKey {
case id, title, images, description, condition, sold
case originalPrice = "original_price"
case alteredPrice = "altered_price"
case originalPrice = "originalPrice"
case alteredPrice = "alteredPrice"
}
}

Expand Down
70 changes: 35 additions & 35 deletions Resell/Views/Components/DraggableSheetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,45 @@ struct DraggableSheetView<Content: View>: View {
let halfScreen = screenHeight / 2

let travelDistance = startY - (halfScreen - 10)

VStack(spacing: 0) {
content()
}
.frame(maxWidth: .infinity)
.background(Color.white)
.cornerRadius(40)
.offset(y: startY + dragOffset + lastDragOffset)
.gesture(
DragGesture()
.onChanged { value in
let translation = value.translation.height
let potential = lastDragOffset + translation

if potential < -travelDistance {
dragOffset = (-travelDistance - lastDragOffset) + (translation - (-travelDistance - lastDragOffset)) * 0.2
}
else if potential > 0 {
dragOffset = (0 - lastDragOffset) + (translation - (0 - lastDragOffset)) * 0.2
}
else {
dragOffset = translation

content()
.frame(maxWidth: .infinity)
.background(
RoundedRectangle(cornerRadius: 40)
.fill(Color.white)
)
.offset(y: startY + dragOffset + lastDragOffset)
.gesture(
DragGesture()
.onChanged { value in
let translation = value.translation.height
let potential = lastDragOffset + translation

if potential < -travelDistance {
dragOffset = (-travelDistance - lastDragOffset) + (translation - (-travelDistance - lastDragOffset)) * 0.2
}
else if potential > 0 {
dragOffset = (0 - lastDragOffset) + (translation - (0 - lastDragOffset)) * 0.2
}
else {
dragOffset = translation
}
}
}
.onEnded { value in
let velocity = value.predictedEndTranslation.height
let finalPos = lastDragOffset + dragOffset + (velocity * 0.5)
.onEnded { value in
let velocity = value.predictedEndTranslation.height
let finalPos = lastDragOffset + dragOffset + (velocity * 0.5)

withAnimation(.spring(response: 0.4, dampingFraction: 0.8)) {
// If user flicked or dragged more than 30% of the way up
if finalPos < -travelDistance * 0.3 {
lastDragOffset = -travelDistance
} else {
lastDragOffset = 0
withAnimation(.spring(response: 0.4, dampingFraction: 0.8)) {
// If user flicked or dragged more than 30% of the way up
if finalPos < -travelDistance * 0.3 {
lastDragOffset = -travelDistance
} else {
lastDragOffset = 0
}
dragOffset = 0
}
dragOffset = 0
}
}
)
)
}
.ignoresSafeArea()
}
Expand Down
2 changes: 1 addition & 1 deletion Resell/Views/Components/OptionsMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct OptionsMenuView: View {
}
}

VStack {
VStack (spacing: 0) {
ForEach(options.indices, id: \.self) { index in
switch options[index] {
case .share(let url, let item):
Expand Down
39 changes: 20 additions & 19 deletions Resell/Views/Home/ForYouView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,35 @@ struct ForYouView: View {
.font(.custom("Rubik-Medium", size: 22))
.foregroundStyle(.black)
.padding(.leading, 24)

ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 20) {
if !viewModel.savedItems.isEmpty || !recentPosts.isEmpty {
if !viewModel.savedItems.isEmpty || !recentPosts.isEmpty {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 20) {
if !viewModel.savedItems.isEmpty {
forYouCard(title: titles[0], posts: viewModel.savedItems, loaded: $savedLoadedStates)
}
if !recentPosts.isEmpty {
forYouCard(title: titles[1], posts: recentPosts, loaded: $recentLoadedStates)
}
} else {
ZStack {
RoundedRectangle(cornerRadius: 8)
.stroke(Color.gray, lineWidth: 1)
.frame(width: 378, height: 110)
.foregroundStyle(.white)
}
.padding(.leading, 24)
}
} else {
ZStack {
RoundedRectangle(cornerRadius: 8)
.stroke(Color.gray, lineWidth: 1)
.foregroundStyle(.white)

VStack {
Text("You haven't saved any listings yet.")
.foregroundStyle(Constants.Colors.black)

Text("Tap \(Image(systemName: "bookmark")) on a listing to save.")
.foregroundStyle(Constants.Colors.black)
}
}
VStack {
Text("You haven't saved any listings yet.")
.foregroundStyle(Constants.Colors.black)

Text("Tap \(Image(systemName: "bookmark")) on a listing to save.")
.foregroundStyle(Constants.Colors.black)
}
}
.padding(.leading, 24)
.frame(height: 110)
.padding(.horizontal, 24)
Comment on lines +56 to +57
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid fixed-height empty-state container for Dynamic Type.

frame(height: 110) can clip text at larger accessibility sizes. Prefer a flexible height so the empty state remains readable.

Suggested adjustment
-                .frame(height: 110)
+                .frame(minHeight: 110)
+                .frame(maxWidth: .infinity, alignment: .leading)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.frame(height: 110)
.padding(.horizontal, 24)
.frame(minHeight: 110)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal, 24)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Resell/Views/Home/ForYouView.swift` around lines 56 - 57, The empty-state
container in ForYouView currently uses a fixed .frame(height: 110) which can
clip at larger Dynamic Type sizes; remove the fixed height and make the
container flexible (for example replace the fixed height with a
.frame(minHeight: 110) or let the view size itself by removing the frame and
using padding/flexible layout), ensure the empty-state view (the view with the
modifier chain containing .frame(height: 110) and .padding(.horizontal, 24)) can
grow for accessibility by using minHeight or intrinsic sizing so text isn't
clipped.

}
}
.onAppear() {
Expand Down
Loading