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

Paolo Pinto SuperFormula Code Test #18

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8361b0c
feat: add environment configuration for API KEY
paolojoaquinp Sep 15, 2024
c91bdac
refactor: service yelp, folders restructured to clean
paolojoaquinp Sep 16, 2024
de3131c
feat: splash screen, flutter bloc, router navigation
paolojoaquinp Sep 16, 2024
6319fc0
feat: layer creation for loading effect with shimmer
paolojoaquinp Sep 16, 2024
863ae7d
refactor: added flutter bloc for home screen
paolojoaquinp Sep 16, 2024
0ef737d
feat: added structure of tabs for home page
paolojoaquinp Sep 16, 2024
df5a7be
feat: added skeleton card loaded
paolojoaquinp Sep 16, 2024
f262483
refactor: TabView widget splitted in smaller components
paolojoaquinp Sep 16, 2024
8560989
feat: added oxidized for functional programming in yelp repository
paolojoaquinp Sep 16, 2024
bffb5b0
feat: added null safety to json serializable objects in model restaurant
paolojoaquinp Sep 16, 2024
fd3797a
refactor: functional programming implementation in home bloc, screen
paolojoaquinp Sep 16, 2024
ac24dcf
feat: added loading indicator in data fetch home screen
paolojoaquinp Sep 16, 2024
269104a
feat: card restaurant, implementation dynamic display of data
paolojoaquinp Sep 16, 2024
f746f95
feat: added fake data into yelp repository
paolojoaquinp Sep 16, 2024
2073748
feat: added card restaurant, widget stars rate, status widget
paolojoaquinp Sep 16, 2024
2ae0e9d
feat: restaurant screen, bloc - added hero animation in card restaurant
paolojoaquinp Sep 16, 2024
089abdb
feat: restaurant screen detail - added reviews widget
paolojoaquinp Sep 16, 2024
e1248b5
feat: added hive helper for favorite items - added appInit class
paolojoaquinp Sep 16, 2024
b887378
feat: added hive local favorite and remove functions
paolojoaquinp Sep 16, 2024
1ec0fd5
feat: added method and widget restaurant to favorites
paolojoaquinp Sep 16, 2024
1c3e1bd
chore: clean architecture concepts applied on files and folders
paolojoaquinp Sep 16, 2024
193b66b
delete default test generated by sdk
paolojoaquinp Sep 16, 2024
6bd5caf
feat: added simple test home screen, refactoring home bloc
paolojoaquinp Sep 16, 2024
0a5bbb5
feat: added data and domain layers for home screen childrens-clean arch
paolojoaquinp Sep 16, 2024
7aed4b4
feat: added user comments to reviews
paolojoaquinp Sep 16, 2024
5b81c0f
feat: added unit testing for all restaurants and favorite restaurants
paolojoaquinp Sep 16, 2024
8b2e5b4
feat: added onTap action on card restaurant
paolojoaquinp Sep 16, 2024
0171d8b
feat: format fixes and typos
paolojoaquinp Sep 16, 2024
d952804
feat: added format to unit tests
paolojoaquinp Sep 16, 2024
2015ee6
chore: sealed class implementation
paolojoaquinp Sep 16, 2024
e621a17
change of typo in hour model typeDef
paolojoaquinp Sep 16, 2024
adbd5a8
feat: README update
paolojoaquinp Sep 16, 2024
d30bf5b
update readme
paolojoaquinp Sep 16, 2024
881ac96
fixed typo in onPressed event restaurant card
paolojoaquinp Sep 16, 2024
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
YEP_API_KEY=
3 changes: 1 addition & 2 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"flutterSdkVersion": "3.22.3",
"flavors": {}
"flutterSdkVersion": "3.22.3"
}
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,11 @@ app.*.map.json
/android/app/release

# fvm
.fvm/flutter_sdk

# FVM Version Cache
.fvm/
.fvmrc

# ENV
.env
test/.env.test
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"search.exclude": {
"**/.fvm": true
},
"files.watcherExclude": {
"**/.fvm": true
}
"dart.flutterSdkPath": ".fvm/flutter_sdk",
"search.exclude": {
"**/.fvm": true
},
"files.watcherExclude": {
"**/.fvm": true
}
}
213 changes: 19 additions & 194 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,202 +1,27 @@
# Restaurant Tour
# Superformula Mobile Test

Welcome to Superformula's Coding challenge, we are excited to see what you can build!
@paolojoaquinp

This take home test aims to evaluate your skills in building a Flutter application. We are looking for a well-structured and well-tested application that demonstrates your knowledge of Flutter and the Dart language.
## Summary
This initiative embraces Clean Architecture tenets with a Feature-First methodology, crafted for productive and systematic development. It leverages Yelp's GraphQL API for restaurant data retrieval, augmented by a JSON file containing cached information to address Yelp's daily query constraints. Subsequent establishment specifics and patron evaluations are obtained in real-time.

We are not looking for pixel perfect designs, but we are looking for a well-structured application that demonstrates your skills and best practices developing a flutter application. We know there are many ways to solve a problem, and we are interested in seeing how you approach this one. If you have any questions, please don't hesitate to ask.
## Code Structure
The source code is divided into several directories, mirroring the conceptual separation advocated by Clean Architecture guidelines:

Things we'll be looking on your submission:
- App structure for scalability
- Error and optional (?) handling
- Widget tree optimization
- State management
- Test coverage
- `core`: Encompasses fundamental utilities and facilitators such as `dio_helper.dart` for network communication and `hive_helper.dart` for local data retention.
- `models`: Encompasses data structures like `restaurant.dart`.
- `navigation`: Oversees application traversal via files such as `route_navigator.dart`.
- `services`: Facilitates initialization and service configuration through `app_init.dart`.
- `features`: Categorized by individual views/screens, e.g., `home_page` and `restaurant_page`, each feature encapsulating its own business rules, data handling, and UI logic.
- `repositories`: Houses `yelp_repository.dart` for interfacing with the Yelp API.
- `shared`: Accommodates reusable UI components like `single_restaurant_card` and utility elements such as `status_indicator.dart`.

Think of the app you'll be building as the final product, do not over engineer it for possible future features, but do not under engineer it either. We are looking for a balance. We want that the functionalities that you implement are well thought out and implemented.
Furthermore, the project utilizes `dotenv` for environment variable administration, enhancing security and adaptability.

As an example, for the favorites feature you can simply use SharedPreferences, you don't need to use a complex database solution, but we're looking for a solid shared preferences implementation.
## How to install it
Prior to executing the project, establish an `.env` file make a copy from the `.env.example` file in the project's root directory with the following entry:

YELP_API_KEY=<add_the_api_key_here>


Be sure to read **all** of this document carefully, and follow the guidelines within.

## Vendorized Flutter

3. We use [fvm](https://fvm.app/) for managing the flutter version within the project. Using terminal, while being on the test repository, install the tools dependencies by running the following commands:

```sh
dart pub global activate fvm
```

The output of the command will ask to add the folder `./pub-cache/bin` to your PATH variables, if you didn't already. If that is the case, add it to your environment variables, and restart the terminal.

```sh
export PATH="$PATH":"$HOME/.pub-cache/bin" # Add this to your environment variables
```

4. Install the project's flutter version using `fvm`.

```sh
fvm use
```

5. From now on, you will run all the flutter commands with the `fvm` prefix. Get all the projects dependencies.

```sh
fvm flutter pub get
```

More information on the approach can be found here:

> hhttps://fvm.app/docs/getting_started/installation

From the root directory:


### IDE Setup

<details>
<summary>Use with VSCode</summary>
<p>

If you're a VScode user link the new Flutter SDK path in your settings
`$projectRoot/.vscode/settings.json` (create if it doesn't exist yet)

```json
{
"dart.flutterSdkPath": ".fvm/flutter_sdk"
}
```


</p>
</details>

<details>
<summary>Use with IntelliJ / Android Studio</summary>
<p>

Go to `Preferences > Languages & Frameworks > Flutter` and set the Flutter SDK path to `$projectRoot/.fvm/flutter_sdk`

<img width="800" alt="IntelliJ Settings" src="https://user-images.githubusercontent.com/1096485/64658026-3a1fdd00-d436-11e9-9457-556059f68e2c.png">

</p>
</details>

## Requirements

### App Structure

#### Restaurant List Page

- Tab Bar
- List of favorites (stored client side)
- List of businesses
- Hero image
- Name
- Price
- Category
- Rating (rounded to the nearest value)
- Open/Closed

#### Restaurant Detail View

- Ability to favorite a business
- Name
- Hero image
- Price and category
- Address
- Rating
- Total reviews
- List of reviews
- User name
- Rating
- User image
- Review Text (These are just snippets of the full review, usually like 3-4 lines long)

#### Misc.

- Clear documentation on the structure and architecture of your application.
- Clear and logical commit messages.
- We suggest following [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)

## Test Coverage

To demonstrate your experience writing different types of tests in Flutter please do the following:

- We are looking to see how you write tests in Flutter. We are not looking for 100% coverage but we are looking for a good mix of unit and widget tests.
- We are specially looking for you to cover at least one file for each domain layer (interface, application, repositories, etc).

Feel free to add more tests as you see fit but the above is the minimum requirement.

## Design

- See this [Figma File](https://www.figma.com/file/KsEhQUp66m9yeVkvQ0hSZm/Flutter-Test?node-id=0%3A1) for design information related to the overall look and feel of the application. We do not expect pixel-perfection but would like the application to visually be close to what is specified in the Figma file.

![List View](screenshots/listview.png)
![Detail View](screenshots/detailview.png)

## API

The [Yelp GraphQL API](https://www.yelp.com/developers/graphql/guides/intro) is used as the API for this Application. We have provided the boilerplate of the API requests and backing data models to save you some time. To successfully make a request to the Yelp GraphQL API, please follow these steps:

1. Please go to https://www.yelp.com/signup and sign up for a developer account.
1. Once signed up, navigate to https://www.yelp.com/developers/v3/manage_app.
1. Create a new app by filling out the required information.
1. Once your app is created, scroll down and join the `Developer Beta`. This allows you to use the GraphQL API.
1. Copy your API Key from your app page and paste it on `line 5` [yelp_repository.dart](app/lib/yelp_repository.dart) replacing the `<PUT YOUR API KEY HERE>` with your key.
1. Run the app and tap the `Fetch Restaurants` button. If you see a log like `Fetched x restaurants` you are all set!

## Technical Requirements

### State Management

Please restrict your usage of state management or dependency injection to the following options:

1. [provider](https://pub.dev/packages/provider)
2. [Riverpod](https://pub.dev/packages/riverpod)
3. [bloc](https://pub.dev/packages/bloc)
4. [get_it](https://pub.dev/packages/get_it)/[get_it_mixins](https://pub.dev/packages/get_it_mixin)
5. [Mobx](https://pub.dev/packages/mobx)

We ask this because this challenge values consistency and efficiency over ingenuity. Using commonly used libraries ensures that we can review your code in a timely manner and allows us to provide better feedback.

## Coding Values

At **Superformula** we strive to build applications that have

- Consistent architecture
- Extensible, clean code
- Solid testing
- Good security & performance best practices

### Clear, consistent architecture

Approach your submission as if it were a real world app. This includes Use any libraries that you would normally choose.

_Please note: we're interested in your code & the way you solve the problem, not how well you can use a particular library or feature._

### Easy to understand

Writing boring code that is easy to follow is essential at **Superformula**.

We're interested in your method and how you approach the problem just as much as we're interested in the end result.

### Solid testing approach

While the purpose of this challenge is not to gauge whether you can achieve 100% test coverage, we do seek to evaluate whether you know how & what to test.

## Q&A

> Where should I send back the result when I'm done?

Please fork this repo and then send us a pull request to our repo when you think you are done. There is no deadline for this task unless otherwise noted to you directly.

> What if I have a question?

Just create a new issue in this repo and we will respond and get back to you quickly.

## Review

The coding challenge is a take-home test upon which we'll be conducting a thorough code review once complete. The review will consist of meeting some more of our mobile engineers and giving a review of the solution you have designed. Please be prepared to share your screen and run/demo the application to the group. During this process, the engineers will be asking questions.
## Code
This app use `oxidized` for functional programming constructs, fostering a more resilient, fault-tolerant development ecosystem.
Binary file added assets/images/restaurantour-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading