Skip to content

Add FetchLocationsUseCase#2484

Merged
amy-at-kickstarter merged 2 commits into
mainfrom
feat/adyer/fetch-locations-use-case
Jun 23, 2025
Merged

Add FetchLocationsUseCase#2484
amy-at-kickstarter merged 2 commits into
mainfrom
feat/adyer/fetch-locations-use-case

Conversation

@amy-at-kickstarter

Copy link
Copy Markdown
Contributor

📲 What

Add FetchLocationsUseCase.

This is a small use case for getting default and suggested locations from the server. It will be used by SearchFiltersUseCase.

🤔 Why

Pulling this behavior out into its own use case makes it easy to test these network calls, and easier to test and hook up SearchFiltersUseCase.

@amy-at-kickstarter amy-at-kickstarter force-pushed the feat/adyer/fetch-locations-use-case branch from 2fea861 to bcb1c3b Compare June 18, 2025 20:45
@amy-at-kickstarter amy-at-kickstarter marked this pull request as ready for review June 20, 2025 14:45
@amy-at-kickstarter amy-at-kickstarter requested review from a team, jovaniks and scottkicks and removed request for a team June 20, 2025 14:46

@scottkicks scottkicks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cool! I wonder if this could be adapted for the locations selector on the rewards screen.

@amy-at-kickstarter

Copy link
Copy Markdown
Contributor Author

Cool! I wonder if this could be adapted for the locations selector on the rewards screen.

Good idea!

@jovaniks jovaniks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Love this new usecase ❤️. Just a couple of suggestion, not blockers!

} else {
nil
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just a minor suggestion, not a big deal at all. This version might look a bit cleaner/fancier from my perspective:

  return nodes.compactMap { node in
    guard let fragment = node?.fragments.locationFragment else { return nil }
    return KsApi.Location.location(from: fragment)
  }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I like that better too! Will fix.

nil
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same thing here, but again - just my inclination/preference

}

/// A use case for fetching locations for the purpose of filtering projects.
public final class FetchLocationsUseCase: FetchLocationsUseCaseType, FetchLocationsUseCaseInputs,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Love this FetchLocationsUseCase

This is a small use case for getting default and suggested locations. It will be used by SearchFiltersUseCase.
@amy-at-kickstarter amy-at-kickstarter force-pushed the feat/adyer/fetch-locations-use-case branch from bcb1c3b to e0a6fb0 Compare June 23, 2025 17:29
@amy-at-kickstarter amy-at-kickstarter merged commit 231ab94 into main Jun 23, 2025
5 checks passed
@amy-at-kickstarter amy-at-kickstarter deleted the feat/adyer/fetch-locations-use-case branch June 23, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants