Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover screen in SwiftUI #1082

Merged
merged 14 commits into from
Jan 17, 2023
Merged

Discover screen in SwiftUI #1082

merged 14 commits into from
Jan 17, 2023

Conversation

martindsq
Copy link
Member

@martindsq martindsq commented Jan 11, 2023

Closes #587 and #1066

  • Implement DiscoverView
  • Implement a reusable InfinitGrid mimiking InfiniteList but using a Grid instead
  • Implement SearchResultsView reusing UniversalSearchResults (that is coupled by UIKit) as much as possible
  • Implement identity and message cards that can be used by the InfinitGrid
  • Refactor Message and Identity views to reuse code that loads the needed info from sqlite. Right now I defined CompactIdentityView and CompactPostView to use them in lists and GoldenIdentityView and GoldenPostView to use them in grids, so lets better share duplicate code to match something like:
graph TD
    AB[MessageButton] --> A
    A[MessageCard] --> B{Content}
    B --> |Contact|E
    B --> |Post|D{Style}
    D --> |Compact|I[CompactPostView]
    D --> |Post|K[GoldenPostView]
    EB[IdentityButton] --> E
    E[IdentityCard] --> F{Style}
    F --> |Compact|J[GoldenPostView]
    F --> |Golden|L[GoldenIdentityView]
Loading

Bonus:

  • Make the search to use profile's bios when filtering

@martindsq martindsq changed the base branch from main to home_swiftui_reuse January 12, 2023 18:27
@martindsq martindsq marked this pull request as ready for review January 12, 2023 18:28
Base automatically changed from home_swiftui_reuse to main January 12, 2023 19:40
@martindsq martindsq linked an issue Jan 13, 2023 that may be closed by this pull request
Copy link
Member

@mplorentz mplorentz left a comment

Choose a reason for hiding this comment

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

This looks really nice. I left a few comments. I found myself wishing for more SwiftUIPreviews. I know we don't have a great way to add preview data to the FakeBot. Maybe we need PreviewBot that loads Feed_big.sqlite or something. But that's probably a task for the future.

Source/UI/Cards/CardStyle.swift Show resolved Hide resolved
Source/UI/Discover/DiscoverView.swift Show resolved Hide resolved
Source/UI/Discover/DiscoverView.swift Outdated Show resolved Hide resolved
Source/UI/Discover/DiscoverView.swift Outdated Show resolved Hide resolved
Source/UI/Discover/DiscoverView.swift Show resolved Hide resolved
Source/UI/Identity/GoldenIdentityView.swift Show resolved Hide resolved
Source/UI/Identity/GoldenIdentityView.swift Show resolved Hide resolved
Source/UI/Identity/IdentityButton.swift Show resolved Hide resolved
Source/UI/Search/SearchResultsView.swift Outdated Show resolved Hide resolved
Source/UI/Search/SearchResultsView.swift Outdated Show resolved Hide resolved
@martindsq
Copy link
Member Author

Thanks for looking at this.
As a general comment, I agree with you on the previews. I'm adding preview in each view I create as a general rule. The last refactor around the hierarchy of CompactIdentityView and CompactPostView (and moved the source of truth one level above) had the big advantage that I could play with different values in the previews.
However, once we reach the view that has the source of truth, we lose this capability. I'd love to do that, I already thought about it and I left it as it is because of the damn BotRepository we have now, once we get rid if that and use Bot directly, it will be a breeze to have a StubBot or a FakeBot with prefilled data.

Copy link
Member

@mplorentz mplorentz left a comment

Choose a reason for hiding this comment

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

This looks great. I see your point about changing BotRepository to just be a Bot. Let's try to prioritize that after the retreat.

@martindsq martindsq merged commit 12d3b9d into main Jan 17, 2023
@martindsq martindsq deleted the swiftui-discover branch January 17, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create new Discovery screen for Swift UI Redesign discovery screen
2 participants