Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Marcelo Sanchez - Code challenge for SuperFormula #14

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4e848f4
chore: include .env to manage environment variables
MarceKalEl Feb 16, 2024
c5fa85d
feat: implement dynamic Yelp API key handling via env variables
MarceKalEl Feb 16, 2024
897f67b
chore: update FVM to latest stable Flutter version
MarceKalEl Feb 16, 2024
1424e45
refactor: restructure project files to adhere to Clean Architecture
MarceKalEl Feb 16, 2024
233a228
feat: add bloc, equatable, oxidized libs and implement splash screen
MarceKalEl Feb 16, 2024
de643f1
feat: add shimmer for TrSkeleton loading effect
MarceKalEl Feb 16, 2024
7e67895
refactor: integrate BlocProvider, Listener, Builder with HomeBloc
MarceKalEl Feb 16, 2024
dc2b46c
feat(homePage): add TabBar for restaurant categories
MarceKalEl Feb 16, 2024
b5af395
feat: add singleRestaurant skeleton loader
MarceKalEl Feb 16, 2024
f919b28
refactor: split TabView widget into smaller components
MarceKalEl Feb 16, 2024
41d3fcc
feat(YelpRepository): integrate oxidized for functional result handling
MarceKalEl Feb 16, 2024
7360e38
feat: add JSON serializable models with null safety for restaurant data
MarceKalEl Feb 16, 2024
7c093ae
refactor(home_bloc): implement Result pattern for data fetching
MarceKalEl Feb 16, 2024
81dbe30
feat: implement loading indicator during data fetch
MarceKalEl Feb 16, 2024
d64431f
feat: added fake JSON response for restaurant data
MarceKalEl Feb 16, 2024
c7f4715
feat: Implement dynamic ListView builder for restaurant data display
MarceKalEl Feb 16, 2024
dc0a6bd
Auto stash before merge of "master" and "origin/master"
MarceKalEl Feb 16, 2024
9ea5f0e
added SingleRestaurantCard
MarceKalEl Feb 16, 2024
ca07647
feat: added single restaurant card widget
MarceKalEl Feb 16, 2024
c9dd308
feat(restaurant-page): add hero image and detail widgets
MarceKalEl Feb 16, 2024
d00c21f
feat: added reviews area
MarceKalEl Feb 16, 2024
ff25687
feat: add AppInit and HiveHelper for app initialization and data pers…
MarceKalEl Feb 16, 2024
432fef7
feat: add AppInit and HiveHelper for app initialization and data pers…
MarceKalEl Feb 16, 2024
379d08a
feat: added appInit and hiveHelper
MarceKalEl Feb 16, 2024
664ec17
feat: add local favorite addition and removal functionality
MarceKalEl Feb 16, 2024
38d02e6
adding restaurant to favorites
MarceKalEl Feb 17, 2024
243c2ef
chore: organizing files and folders
MarceKalEl Feb 17, 2024
52e4098
added test
MarceKalEl Feb 17, 2024
e91d234
delete default test
MarceKalEl Feb 17, 2024
b7d4844
chore: dart fix applied
MarceKalEl Feb 17, 2024
c60011e
feat: implement significant architectural enhancements in the applica…
MarceKalEl Feb 17, 2024
a31fbee
feat(reviews): add user comments to restaurant reviews
MarceKalEl Feb 17, 2024
0648dec
test: remove outdated tests and add new unit tests for updated structure
MarceKalEl Feb 17, 2024
982a5b4
refactor: restructure shared widgets and add context-aware onTap hand…
MarceKalEl Feb 18, 2024
5818f15
chore: typo amend
MarceKalEl Feb 18, 2024
9e20f91
feat: update GPC due not runing on Android settings and apply stashed…
MarceKalEl Feb 18, 2024
947771c
chore: yelpRepository being used insted vairiable.
MarceKalEl Mar 2, 2024
6e9eaaa
modified pubspec.yml
MarceKalEl Mar 2, 2024
821436e
replaced class entity to typedef
MarceKalEl Mar 2, 2024
369fc28
fix tests
MarceKalEl Mar 3, 2024
e4a00db
chore: change class to sealed
MarceKalEl Mar 3, 2024
e2cbbb2
fix hour model and entity
MarceKalEl Mar 4, 2024
5eec08b
changed class entity to typeDef entity
MarceKalEl Mar 5, 2024
a5688aa
ReadmeUpdated and adde empty .env file
MarceKalEl Mar 6, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
YELP_API_KEY=KEYyouMUSTADD
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.13.9",
"flutterSdkVersion": "stable",
"flavors": {}
}
185 changes: 17 additions & 168 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,183 +1,32 @@
# RestauranTour
# Superformula Mobile Test

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

## Vendorized Flutter
This project adopts Clean Architecture principles with a Feature First approach, designed for efficient and organized development. It integrates Yelp's GraphQL API to fetch restaurant data, complemented with a JSON containing preloaded information due to Yelp's daily request limits. Subsequent detail and review data for each restaurant are fetched in real-time.

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:
## Project Structure

```sh
dart pub global activate fvm
```
The codebase is structured into several directories, reflecting the logical separation of concerns as per Clean Architecture guidelines:

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.
- `core`: Contains core functionality and helpers like `dio_helper.dart` for HTTP requests and `hive_helper.dart` for local persistence.
- `models`: Includes entity models such as `restaurant.dart`.
- `navigation`: Manages app routing with files like `route_navigator.dart`.
- `services`: Provides initialization and service setup through `app_init.dart`.
- `features`: Organized by individual screens/pages, e.g., `home_page` and `restaurant_page`, with each feature containing its own domain, data, and presentation logic.
- `repositories`: Contains `yelp_repository.dart` for fetching data from the Yelp API.
- `shared`: Houses reusable widgets such as `single_restaurant_card` and utility widgets like `status_indicator.dart`.

```sh
export PATH="$PATH":"$HOME/.pub-cache/bin" # Add this to your environment variables
```
Additionally, the project makes use of `dotenv` to manage environment variables, enhancing security and configurability.

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

```sh
fvm use
```
Prior to running the project, create or update the `.env` file at the root of the project with the following key: YELP_API_KEY=thisISanApiKEYYouMUSTAdd

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
```
## Programming Paradigm

More information on the approach can be found here:
The application utilizes `oxidized` for functional programming, promoting a more robust, error-resistant development experience.

> 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:

- Choose ONE portion of your state management and write a unit test.
- Choose ONE widget and write a widget test.

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.
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
Binary file added assets/images/restaurant_tour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading