Product Hunt Android app using Jetpack Compose

Related tags

App product-hunt
Overview

Product Hunt

Product Hunt app preview

Product Hunt Android app using Jetpack Compose. The app supports both day mode and night mode.

๐Ÿ‘‰ Check the article on my blog https://sarpex.com/2022/07-product-hunt-app-jetpack-compose

โšก๏ธ A runnable debug version of the app is available in apk/app-debug.apk, just copy it in your Android device to see it in action!

๐Ÿ‘€ Before running the project it's important to set the API Key and API Secret in the Apollo.kt file. Refer to the OAuth section for all the steps.

๐Ÿ’ป Requirements

To try out the Product Hunt sample app, you need to use Android Studio Arctic Fox or greater.

๐Ÿงฌ Architecture

The project uses an MVVM architecture built in a Redux-style, where each UI 'screen' has its own ViewModel. Each ViewModel is responsible for subscribing to any data streams required for the view, as well as exposing functions which allow the UI to send events.

The app uses the latest tech stack, like Kotlin coroutines, flows, and an optimized blazing-fast pagination logic based upon the Jetpack Paging library for compose.

Images are loaded in a separate thread pool, optimized for I/O using Coil.

๐Ÿ“ฆ Package structure

  • model Contains the data models.
  • ui Contains UI controllers and view models.
    • theme
      • Color.kt
      • Shape.kt
      • Theme.kt
      • Type.kt
  • util Util package containing all the util functions.
  • data Additional data structure package used by UI controllers and view models.
  • network Classes network related for authentication operations and requests.

๐Ÿ”— Useful Links

  • https://api.producthunt.com/v2/docs - Starting point with all the info
  • https://api.producthunt.com/v2/docs/oauth_client_only_authentication/oauth_token_ask_for_client_level_token - OAuth Client Only Authentication
  • https://ph-graph-api-explorer.herokuapp.com/ - API Explorer
  • http://api-v2-docs.producthunt.com.s3-website-us-east-1.amazonaws.com/operation/query/ - GraphQL Query
  • https://www.howtographql.com/ - Learn GraphQL

๐Ÿ”‘ OAuth

Navigate to https://www.producthunt.com/v2/oauth/applications and select "ADD AN APPLICATION".

Set the redirect URI to https://producthunt.com.
Save API Key and API Secret and set them in the Apollo.kt file.

Extra info from the starting point URL:

Get a token without user context. (E.g. before a user logs in).

Follow the steps explained in OAuth Client Only Authentication oauth#token Please remember that this tokens limit you to public endpoints that don't require user context.

If you want to access our API without any user context this is the right authentication for you. Typical usecases might be your mobile app that wants to show the current posts to not-yet-logged-in users.

๐Ÿ•ธ GraphQL

Generated using:

get-graphql-schema -h 'Authorization=Bearer {token}' https://api.producthunt.com/v2/api/graphql -j > schema.json

Check schema.json.

Apollo GraphQL for Android

From https://www.apollographql.com/docs/android/

Version 3 for Android is still in alpha, so we'll stick to the latest major for the version 2 (2.5.9).

Note: Farewell JCenter, welcome back Maven Central.

Cache Support

HTTP Cache: https://www.apollographql.com/docs/android/essentials/http-cache/.

Normalized Cache https://www.apollographql.com/docs/android/essentials/normalized-cache/

Without knowing all the use cases it's best to stick with the simplest solution, so I'd go for a cache first approach with CACHE_FIRST.

๐Ÿง‘โ€๐Ÿซ Project Overview

The app has the following screens:

โ€ข Home Screen: it contains the list of daily post items; the list should load more as the user scrolls.
โ€ข Post item: it shows post name, thumbnail, tagline, vote count, and hunter.
โ€ข Post details screen: opens after the user tap on the post item and shows post info: name, thumbnail, tagline, description, vote count, hunter, list of makers (users), media only showing images, not video.
โ€ข User profile screen: it opens when user tap on user avatar, hunter or maker and it shows user info, user name, username, avatar and has an infinite scroll list of post items the user has voted.

You might also like...
Movie listing app using Jetpack Compose and Tmdb api
Movie listing app using Jetpack Compose and Tmdb api

Jetflix A Movie listing app using TheMovieDb api and Jetpack Compose. Based on MVVM architecture with Dagger Hilt. Screenshots Download Go to Releases

E- commerce app๐Ÿ‘•  built with Jetpack Compose and Compose Destinations. The design was inspired by Sajjad Mohammadi Nia
E- commerce app๐Ÿ‘• built with Jetpack Compose and Compose Destinations. The design was inspired by Sajjad Mohammadi Nia

E-Commerce Clothing App ๐Ÿ‘• This a Jetpack Compose app that replicates of an E-commerce app design I was inspired by on Dribble. It's an E-Commerce app

Tesla App Clone built in Kotlin, using Compose. The project was initially designed by Clinton using Flutter.

Tesla Tesla App Clone built in Kotlin, using Compose. The project was initially designed by Clinton using Flutter. We are keeping this repo as a singl

A feed for GitHub, written in Kotlin using Jetpack Compose.

Gimmick A while back, I noticed that the official GitHub app doesn't have a feed similar to the one can find on the GitHub homepage. Naturally I had t

Visualizing some advent of code puzzles using Jetpack compose for web

AdventOfCodeComposeWeb Visualizing some advent of code puzzles using Jetpack com

Pokedex - Pokedex demo application developed using Hilt, Coroutines, Jetpack Compose, View Model, Coil, Accompanist, Material Design based on MVVM atchitecture Sample application to show state management & unidirectional data flow using Jetpack compose.
Sample application to show state management & unidirectional data flow using Jetpack compose.

Jetpack Compose State Management A sample project to demonstrate State Management in Jetpack compose by following This CodeLab. Through the project yo

A simple NewsApp built using Jetpack Compose, MVVM Architecture, Dagger Hilt and Kotlin Flow
A simple NewsApp built using Jetpack Compose, MVVM Architecture, Dagger Hilt and Kotlin Flow

NewsApp is simple App which uses NewsAPI to get top headlines for country you live in or you can search for a specific news. Focus of this app is to d

Android Bitcoin market app base on Jetpack Compose and MVI. The app displays current bitcoin market price and history price k-line charts.

compose-bitcoin Android Bitcoin market app base on Jetpack Compose and MVVM & MVI. Features Current bitcoin market price. K-line charts of history pri

Owner
Simone Arpe
Android Developer, pragmatic thinker, LibGdx enthusiast
Simone Arpe
Mobile App that that enables users to manager product listing IProcure Ltd Senior Android Engineer Role interview solution

Mobile App that that enables users to manager product listing (in and e-commerce environment) IProcure Ltd Senior Android Engineer Role interview solution

Daniel Waiguru 6 Nov 1, 2022
Product Flavours for Android

Product Flavors If you need to develop more than one app for one project one might think of building two different android projects, fortunately, Andr

Ronnie Otieno 19 Oct 13, 2022
Application that allows to search some products and display them in a list, also allows to add some product to the shopping cart and remove it

Application that allows to search some products and display them in a list, also allows to add some product to the shopping cart and remove it

Victor 3 Aug 18, 2022
Online Shopping Application which uses Augmented Reality(AR) for product trials, thus completely changing shopping experiences.

ShopOn This is an Android Native application which is developed as a solution for HackOn with Amazon 2022 for the problem statement related to shoppin

Akshat Kumar Verma 17 Dec 23, 2022
Implement Text Recognition using MLKit in Jetpack Compose using Kotlin

Implement Text Recognition using MLKit in Jetpack Compose using Kotlin. The application is built using Kotlin Programming Language with Jetpack Compose Navigation.

mohamed tamer 5 Jul 22, 2022
MVVM + Kotlin + Jetpack Compose +Navigation Compose + Hilt + Retrofit + Unit Testing + Compose Testing + Coroutines + Kotlin Flow + Io mockK

MvvmKotlinJetpackCompose Why do we need an architecture even when you can make an app without it? let's say you created a project without any architec

Sayyed Rizwan 46 Nov 29, 2022
Dose a Android app that reminds you medications exactly when your body needs them, building entirely using Kotlin and Jetpack Compose with MVVM + Clean Architecture

??โฐ Dose is a work-in-progress Android app that reminds you medications exactly when your body needs them, building entirely using Kotlin and Jetpack Compose with MVVM + Clean Architecture

Waseef Akhtar 195 Jan 1, 2023
A daily horoscopes listing. App using my personality project's API and Jetpack Compose

A daily horoscopes listing. App using my personality project's API and Jetpack Compose. Application architecture based on MVVM and Clean Architecture

Hรผseyin Serkan ร–zaydin 9 Aug 13, 2021
Easy Note: Building a Notes app using MVVM, JetPack Compose with a clean multi-module architecture approach.

Easy Note Easy Note: Notes app using JetPack Compose and MVVM with a clean architecture approach. This app shows the usage of the new Navigation Archi

Akhilesh Patil 10 Dec 17, 2022