Skip to content

Commit

Permalink
Merge pull request #105 from VictorKabata/develop
Browse files Browse the repository at this point in the history
Develop -> Main
  • Loading branch information
VictorKabata authored Nov 7, 2023
2 parents 220ebad + 0508c91 commit 8f8a068
Show file tree
Hide file tree
Showing 82 changed files with 967 additions and 523 deletions.
104 changes: 17 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
<img src="https://img.shields.io/badge/-KOTLIN-E50914?logo=kotlin&logoColor=white&style=for-the-badge">
<img src="https://img.shields.io/badge/-ANDROID-E50914?logo=android&logoColor=white&style=for-the-badge">
<img src="https://img.shields.io/badge/-IOS-E50914?logo=ios&logoColor=white&style=for-the-badge">
<img src="https://img.shields.io/badge/-WINDOWS-CCCCCC?logo=windows&logoColor=606060&style=for-the-badge">
<img src="https://img.shields.io/badge/-LINUX-CCCCCC?logo=linux&logoColor=606060&style=for-the-badge">
<img src="https://img.shields.io/badge/-MACOS-CCCCCC?logo=apple&logoColor=606060&style=for-the-badge">
<img src="https://img.shields.io/badge/-DESKTOP-E50914?logo=desktop&logoColor=white&style=for-the-badge">
</p>

# Notflix

# 🛠️Migrating to Compose Multiplatform - [Develop Branch](https://youtu.be/dQw4w9WgXcQ)
# 🛠️Under constant refactor/development - [Develop Branch](https://youtu.be/dQw4w9WgXcQ)

An android and iOS app built using [Kotlin Multiplatforom](https://kotlinlang.org/docs/multiplatform.html) that consumes [TMDB API]("https://developers.themoviedb.org/3") to display current trending, upcoming and popular movies🍿 and tvshows🎬.

Expand All @@ -21,24 +19,13 @@ An android and iOS app built using [Kotlin Multiplatforom](https://kotlinlang.or

## Table Of Content

- [Screenshots](##screenshots)
- [Prerequisite](##prerequisite)
- [Running](##running)
- [Pros of KMP/KMM](##pros-of-kmpkmm)
- [App Structure](##app-structure)
- [1. androidApp](###1-androidapp)
- [2. desktopApp](###2-desktopapp)
- [3. iosApp](###3-iosApp)
- [4. shared](###4-shared)
- [__Domain__](###domain)
- [__Data__](###data)
- [__Presentation__](###presentation)
- [Libraries](##libraries)
- [Shared](###shared)
- [Android](###android)
- [Extras](##extras)
- [Demo](##demo)
- [Android App](##android-app)
- [Desktop](##desktop)
- [Related Resources](##related-resources)
- [Videos 📽️](###videos-️)
- [Articles/Blogs 📖](###articlesblogs-)
Expand All @@ -48,6 +35,20 @@ An android and iOS app built using [Kotlin Multiplatforom](https://kotlinlang.or
- [Articles/Blogs 📖](###articlesblogs--1)
- [Sample Projects 🤖](###sample-projects--1)

## Screenshots

## Android

<img src="screenshots/img1.png" width="250"/> <img src="screenshots/img2.png" width="250"/> <img src="screenshots/img3.png" width="250"/> <img src="screenshots/img4.png" width="250"/>

## iOS

<img src="screenshots/img7.png" width="250"/> <img src="screenshots/img5.png" width="250"/> <img src="screenshots/img6.png" width="250"/>

## Desktop

<img src="screenshots/img8.png" width="640"/> <img src="screenshots/img9.png" width="640"/>

## Prerequisite

// ToDo
Expand All @@ -66,67 +67,6 @@ Run with the following command:
./gradlew run
```

## Pros of KMP/KMM

- Faster development since you only need to write most of the business logic and tests only once.
- Improve code quality.
- Highly maintainable and testable code due to separation of concern in the codebase.

## App Structure

<p align="center"><img src="assets/project_structureee.png" alt="Project Structure"></p>

The project currently has 3 main modules:

### 1. [appAndroid](https://github.com/VictorKabata/Notflix/tree/main/androidApp)

This module contains the android application's UI built using [Jetpack compose](https://developer.android.com/jetpack/compose).


## 2. [appiOS](https://github.com/VictorKabata/Notflix/tree/main/iOSNotflix)
This module contains iOS code that holds the iosApp UI built using [Swift UI](https://developer.apple.com/xcode/swiftui/)


### 3 . [shared](https://github.com/VictorKabata/Notflix/tree/main/shared)
This module contains shared code that holds the domain and data layers and some part of the presentation logic ie.shared viewmodels


### __Domain__

This is the core layer of the application. The ```domain``` layer is independent of any other layers this means that changes in other layers will have no effect on domain layer eg. screen UI (presentation layer) or changing database (data layer) will not result in any code change withing domain layer.

Components of domain layer include:

- __Models__: Defines the core structure of the data that will be used within the application.

- __Repositories__: Interfaces used by the use cases. Implemented in the data layer.

### __Data__

The ```data``` layer is responsible for selecting the proper data source for the domain layer. It contains the implementations of the repositories declared in the domain layer.

Components of data layer include:

- __Models__

-__Dto Models__: Defines POJO of network responses.

-__Entity Models__: Defines the schema of the database.

- __Mappers__: They perform data transformation between ```domain```, ```dto``` and ```entity``` models.

- __Network__: This is responsible for performing network operations eg. defining API endpoints using [Ktor](https://ktor.io/).

- __Cache__: This is responsible for performing caching operations using [Realm](https://github.com/realm/realm-kotlin).

- __Data Sources__: Responsible for deciding which data source (network or cache) will be used when fetching data and presenting the data to viewmodels.

<p align="center"><img src="assets/clean_arch.png" alt="Clean Architecture Diagram"></p>

### __Presentation__

The `presentation` package contains shared viewmodels code.

## Libraries

### Shared
Expand All @@ -142,16 +82,6 @@ The `presentation` package contains shared viewmodels code.
- [BuildKonfig](https://github.com/yshrsmz/BuildKonfig) - Supports embedding values from gradle file.
- [Image Loader](https://github.com/qdsfdhvh/compose-imageloader) - Compose Image library for Kotlin Multiplatform

## Screenshots

## Android App

<img src="assets/img0.png" width="250"/> <img src="assets/img2.png" width="250"/>

## iOS App

<img src="assets/img9.0.png" width="250"/> <img src="assets/img11.png" width="250"/> <img src="assets/img12.png" width="250"/>

## Related Resources

In this section I've included some resources ie. articles and GitHub repositories that i used to learn about kotlin multiplatform mobile:
Expand Down
6 changes: 3 additions & 3 deletions appAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ plugins {
}

android {
compileSdk = 33
compileSdk = 34

defaultConfig {
applicationId = "com.vickikbt.notflix"

minSdk = 21
minSdk = 24
targetSdk = compileSdk
versionCode = 1
versionName = "1.0.0"
Expand Down Expand Up @@ -45,7 +45,7 @@ android {
}

composeOptions {
kotlinCompilerExtensionVersion = "1.4.5"
kotlinCompilerExtensionVersion = "1.5.3"
}
namespace = "com.vickikbt.notflix"
}
Expand Down
6 changes: 2 additions & 4 deletions appAndroid/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Notflix"
android:usesCleartextTraffic="true">
android:theme="@style/Theme.Notflix">

<activity
android:name=".ui.activity.MainActivity"
android:exported="true"
android:label="@string/app_name">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.vickikbt.notflix

import android.app.Application
import com.vickikbt.shared.di.initKoin
import com.vickikbt.shared.utils.ContextUtils
import org.koin.android.BuildConfig
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
Expand All @@ -12,6 +13,8 @@ class NotflixApplication : Application() {
override fun onCreate() {
super.onCreate()

ContextUtils.setContext(context = this)

initKoin {
androidLogger(level = if (BuildConfig.DEBUG) Level.ERROR else Level.NONE)
androidContext(androidContext = this@NotflixApplication)
Expand Down
4 changes: 3 additions & 1 deletion appAndroid/src/main/res/drawable/logo.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="280dp"
android:height="90dp"
android:viewportWidth="421.000000"
android:viewportHeight="127.000000">
android:viewportHeight="127.000000"
tools:ignore="VectorRaster">

<group
android:scaleX="0.100000"
Expand Down
8 changes: 0 additions & 8 deletions appAndroid/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Notflix</string>

<string name="title_home">Heim</string>
<string name="title_search">Suche</string>
<string name="title_favorites">Favoriten</string>
Expand All @@ -15,12 +13,6 @@

<string name="share">Share</string>

<string name="placeholder_movie_title" translatable="false">Pirates of The Caribbean: Some Villan\'s Revenge.</string>
<string name="placeholder_movie_duration" translatable="false">4hrs 20mins</string>
<string name="placeholder_movie_overview" translatable="false">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius neque odio, at tincidunt lacus auctor id. Aenean consequat, lectus vel rhoncus faucibus, lectus nulla pretium nunc, at suscipit libero nunc et sapien. Mauris a dolor et turpis tempus scelerisque.</string>
<string name="placeholder_genre" translatable="false">Action</string>
<string name="placeholder_actor_name" translatable="false">Johnny Cage</string>

<!--Preference Titles-->
<string name="title_personalisation">Personalisierung</string>
<string name="title_extras">Extras</string>
Expand Down
8 changes: 0 additions & 8 deletions appAndroid/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Notflix</string>

<string name="title_home">Casa</string>
<string name="title_search">Búsqueda</string>
<string name="title_favorites">Favoritos</string>
Expand All @@ -15,12 +13,6 @@

<string name="share">Share</string>

<string name="placeholder_movie_title" translatable="false">Pirates of The Caribbean: Some Villan\'s Revenge.</string>
<string name="placeholder_movie_duration" translatable="false">4hrs 20mins</string>
<string name="placeholder_movie_overview" translatable="false">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius neque odio, at tincidunt lacus auctor id. Aenean consequat, lectus vel rhoncus faucibus, lectus nulla pretium nunc, at suscipit libero nunc et sapien. Mauris a dolor et turpis tempus scelerisque.</string>
<string name="placeholder_genre" translatable="false">Action</string>
<string name="placeholder_actor_name" translatable="false">Johnny Cage</string>

<!--Preference Titles-->
<string name="title_personalisation">Personalización</string>
<string name="title_extras">Extras</string>
Expand Down
8 changes: 0 additions & 8 deletions appAndroid/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" translatable="false">Notflix</string>

<string name="title_home">Accueil</string>
<string name="title_search">Chercher</string>
<string name="title_favorites">Favoris</string>
Expand All @@ -15,12 +13,6 @@

<string name="share">Share</string>

<string name="placeholder_movie_title" translatable="false">Pirates of The Caribbean: Some Villan\'s Revenge.</string>
<string name="placeholder_movie_duration" translatable="false">4hrs 20mins</string>
<string name="placeholder_movie_overview" translatable="false">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius neque odio, at tincidunt lacus auctor id. Aenean consequat, lectus vel rhoncus faucibus, lectus nulla pretium nunc, at suscipit libero nunc et sapien. Mauris a dolor et turpis tempus scelerisque.</string>
<string name="placeholder_genre" translatable="false">Action</string>
<string name="placeholder_actor_name" translatable="false">Johnny Cage</string>

<!--Preference Titles-->
<string name="title_personalisation">Personalisation</string>
<string name="title_extras">Suppléments</string>
Expand Down
2 changes: 1 addition & 1 deletion appAndroid/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<item name="colorOnSecondary">@color/secondaryTextColor</item>

<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">@android:color/transparent</item>
<item name="android:statusBarColor" >@android:color/transparent</item>

</style>

Expand Down
3 changes: 2 additions & 1 deletion appAndroid/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<string name="placeholder_movie_duration" translatable="false">4hrs 20mins</string>
<string name="placeholder_movie_overview" translatable="false">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris varius neque odio, at tincidunt lacus auctor id. Aenean consequat, lectus vel rhoncus faucibus, lectus nulla pretium nunc, at suscipit libero nunc et sapien. Mauris a dolor et turpis tempus scelerisque.</string>
<string name="placeholder_genre" translatable="false">Action</string>
<string name="placeholder_actor_name" translatable="false">Johnny Cage</string>


<!--Preference Titles-->
<string name="title_personalisation">Personalisation</string>
Expand All @@ -39,7 +41,6 @@
<string name="popularity">Popularity</string>
<string name="overview">Overview</string>
<string name="cast">Cast</string>
<string name="placeholder_actor_name">Johnny Cage</string>
<string name="trailer">Trailer</string>
<string name="similar_movies">Similar Movies</string>

Expand Down
2 changes: 1 addition & 1 deletion appAndroid/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<item name="colorOnSecondary">@color/secondaryTextColor</item>

<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">@android:color/transparent</item>
<item name="android:statusBarColor" >@android:color/transparent</item>

</style>

Expand Down
16 changes: 16 additions & 0 deletions appDesktop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
alias(libs.plugins.jvm)
alias(libs.plugins.compose)
}

dependencies {
implementation(project(":shared"))

implementation(compose.desktop.currentOs)
}

compose.desktop {
application {
mainClass = "com.vickikbt.notflix.NotflixApplicationKt"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.vickbt.notflix

import androidx.compose.ui.window.application
import com.vickbt.notflix.ui.windows.MainWindow
import com.vickikbt.shared.di.initKoin
import org.koin.core.Koin

lateinit var koin: Koin

fun main() {
koin = initKoin(enableNetworkLogs = true).koin

return application {
MainWindow(applicationScope = this)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.vickbt.notflix.ui.windows

import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ApplicationScope
import androidx.compose.ui.window.WindowPosition
import androidx.compose.ui.window.rememberWindowState
import com.vickikbt.shared.ui.screens.main.MainScreen
import moe.tlaster.precompose.PreComposeWindow

@Composable
fun MainWindow(applicationScope: ApplicationScope) {
PreComposeWindow(
onCloseRequest = { applicationScope.exitApplication() },
title = "Notflix",
state = rememberWindowState(
position = WindowPosition.Aligned(Alignment.Center),
width = 1080.dp, // or Dp.Unspecified,
height = 800.dp, // or Dp.Unspecified,
)
) {
MainScreen()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>Notflix.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>2</integer>
</dict>
</dict>
</dict>
Expand Down
Binary file not shown.
Binary file removed assets/app_logo.png
Binary file not shown.
Binary file removed assets/clean_arch.png
Binary file not shown.
Binary file removed assets/img0.png
Binary file not shown.
Binary file removed assets/img11.png
Binary file not shown.
Binary file removed assets/img2.png
Binary file not shown.
Binary file removed assets/img9.0.png
Binary file not shown.
Binary file removed assets/logo_n.png
Binary file not shown.
Binary file removed assets/logo_notflix.png
Binary file not shown.
Binary file removed assets/project_structure.png
Binary file not shown.
Loading

0 comments on commit 8f8a068

Please sign in to comment.