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

Feat/explore #7

Merged
merged 6 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ Demoya gif veya bağlantı ekleyin

- Minimum SDK level 24+
- 100% [Kotlin](https://kotlinlang.org/)
based [Coroutines](https://github.com/Kotlin/kotlinx.coroutines)
+ [Flow](https://developer.android.com/kotlin/flow) for asynchronous.
based [Coroutines](https://github.com/Kotlin/kotlinx.coroutines) [Flow](https://developer.android.com/kotlin/flow) for asynchronous.

- [Android Architecture Components](https://developer.android.com/topic/architecture) - Collection
of libraries that help you design robust, testable, and maintainable apps.
Expand Down Expand Up @@ -85,11 +84,12 @@ Demoya gif veya bağlantı ekleyin
- [Truth](https://truth.dev/) - A library for performing assertions in tests
## Upcoming

- To able to searching movies and TvSeries
- To able to add favorite list and watch list
- To able to watching trailer for movie and TvSeries
- To able to see the detail of actors and directors
- UI and Unit Tests
- Modularization
- CI Support
- To able to add favorite list and watch list
- To able to watching trailer for movie and TvSeries
- To able to see the detail of actors and directors
- UI and Unit Tests
## Find this repository useful?
Don't forget give a star. ⭐

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import com.google.common.truth.Truth.assertThat
import com.prmto.mova_movieapp.data.repository.DataOperationsImpl
import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.data.repository.DataOperationsImpl
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import kotlinx.coroutines.ExperimentalCoroutinesApi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.prmto.mova_movieapp.data.repository

import androidx.appcompat.app.AppCompatDelegate
import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.prmto.mova_movieapp.data.repository

import com.prmto.mova_movieapp.domain.repository.ConnectivityObserver
import com.prmto.mova_movieapp.core.domain.repository.ConnectivityObserver
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.test.core.app.ApplicationProvider
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.withId
import com.prmto.mova_movieapp.R
import com.prmto.mova_movieapp.feature_splash.presentation.splash.SplashFragment
import com.prmto.mova_movieapp.launchFragmentInHiltContainer
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.prmto.mova_movieapp.util

import com.prmto.mova_movieapp.core.util.DispatchersProvider
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:theme="@style/Theme.MovaMovieApp"
tools:targetApi="31">
<activity
android:name=".presentation.MainActivity"
android:name=".MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.prmto.mova_movieapp.presentation
package com.prmto.mova_movieapp

import android.os.Bundle
import android.view.LayoutInflater
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.isVisible
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.setupWithNavController
import com.prmto.mova_movieapp.R
import com.prmto.mova_movieapp.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.prmto.mova_movieapp.data.remote
package com.prmto.mova_movieapp.core.data.data_source.remote

import com.prmto.mova_movieapp.util.Constants.IMAGE_BASE_URL
import com.prmto.mova_movieapp.core.util.Constants.IMAGE_BASE_URL

object ImageApi {
fun getImage(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.data.remote
package com.prmto.mova_movieapp.core.data.data_source.remote

import com.prmto.mova_movieapp.BuildConfig
import okhttp3.Interceptor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.prmto.mova_movieapp.core.data.data_source.remote

import com.prmto.mova_movieapp.core.data.dto.GenreList
import retrofit2.http.GET
import retrofit2.http.Query


interface TMDBApi {

@GET("genre/movie/list")
suspend fun getMovieGenreList(
@Query("language") language: String
): GenreList

@GET("genre/tv/list")
suspend fun getTvGenreList(
@Query("language") language: String
): GenreList

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.data.models
package com.prmto.mova_movieapp.core.data.dto

import com.squareup.moshi.Json

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.prmto.mova_movieapp.data.models
package com.prmto.mova_movieapp.core.data.dto


data class Genre(
val id: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.prmto.mova_movieapp.core.data.models.enums

enum class Category {
MOVIE,
TV,
SEARCH
}

fun Category.isMovie(): Boolean {
return this == Category.MOVIE
}

fun Category.isTv(): Boolean {
return this == Category.TV
}

fun Category.isSearch(): Boolean {
return this == Category.SEARCH
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.data.models.enums
package com.prmto.mova_movieapp.core.data.models.enums

enum class MoviesApiFunction {
NOW_PLAYING_MOVIES(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.prmto.mova_movieapp.core.data.models.enums

enum class Sort(val value: String) {
Popularity(value = "popularity"),
LatestRelease(value = "release_date")
}

fun Sort.isPopularity(): Boolean {
return this.value == Sort.Popularity.value
}

fun Sort.isLatestRelease(): Boolean {
return this.value == Sort.LatestRelease.value
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.data.models.enums
package com.prmto.mova_movieapp.core.data.models.enums

enum class TvSeriesApiFunction {
POPULAR_TV(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.prmto.mova_movieapp.data.repository
package com.prmto.mova_movieapp.core.data.repository

import androidx.appcompat.app.AppCompatDelegate
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.*
import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.util.Constants.LOCALE_KEY
import com.prmto.mova_movieapp.util.Constants.UI_MODE_KEY
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.util.Constants.LOCALE_KEY
import com.prmto.mova_movieapp.core.util.Constants.UI_MODE_KEY
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.prmto.mova_movieapp.data.repository
package com.prmto.mova_movieapp.core.data.repository

import android.content.Context
import android.net.ConnectivityManager
import android.net.Network
import com.prmto.mova_movieapp.domain.repository.ConnectivityObserver
import com.prmto.mova_movieapp.core.domain.repository.ConnectivityObserver
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.prmto.mova_movieapp.core.data.repository

import com.prmto.mova_movieapp.core.data.data_source.remote.TMDBApi
import com.prmto.mova_movieapp.core.data.dto.GenreList
import com.prmto.mova_movieapp.core.domain.repository.RemoteRepository
import javax.inject.Inject

class RemoteRepositoryImpl @Inject constructor(
private val tmdbApi: TMDBApi
) : RemoteRepository {
override suspend fun getMovieGenreList(language: String): GenreList {

return try {
tmdbApi.getMovieGenreList(language = language)
} catch (e: Exception) {
throw e
}


}

override suspend fun getTvGenreList(language: String): GenreList {
return try {
tmdbApi.getTvGenreList(language = language)
} catch (e: Exception) {
throw e
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.domain.models
package com.prmto.mova_movieapp.core.domain

import androidx.annotation.StringRes
import com.prmto.mova_movieapp.R
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.domain.repository
package com.prmto.mova_movieapp.core.domain.repository

import kotlinx.coroutines.flow.Flow

Expand All @@ -13,4 +13,8 @@ interface ConnectivityObserver {
Losing,
Lost
}
}

fun ConnectivityObserver.Status.isAvaliable(): Boolean {
return this == ConnectivityObserver.Status.Avaliable
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.prmto.mova_movieapp.domain.repository
package com.prmto.mova_movieapp.core.domain.repository

import kotlinx.coroutines.flow.Flow

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.prmto.mova_movieapp.core.domain.repository

import com.prmto.mova_movieapp.core.data.dto.GenreList

interface RemoteRepository {

suspend fun getMovieGenreList(
language: String
): GenreList

suspend fun getTvGenreList(
language: String
): GenreList
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.prmto.mova_movieapp.domain.use_case.get_language_iso_code
package com.prmto.mova_movieapp.core.domain.use_case

import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.prmto.mova_movieapp.core.domain.use_case

import com.prmto.mova_movieapp.core.data.dto.Genre
import com.prmto.mova_movieapp.core.domain.repository.RemoteRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class GetMovieGenreListUseCase @Inject constructor(
private val repository: RemoteRepository
) {

operator fun invoke(language: String): Flow<List<Genre>> {
return flow {
emit(repository.getMovieGenreList(language).genres)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.prmto.mova_movieapp.core.domain.use_case

import com.prmto.mova_movieapp.core.data.dto.Genre
import com.prmto.mova_movieapp.core.domain.repository.RemoteRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject


class GetTvGenreListUseCase @Inject constructor(
private val repository: RemoteRepository
) {
operator fun invoke(language: String): Flow<List<Genre>> {
return flow {
emit(repository.getTvGenreList(language = language.lowercase()).genres)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.prmto.mova_movieapp.domain.use_case.get_ui_mode
package com.prmto.mova_movieapp.core.domain.use_case

import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.prmto.mova_movieapp.domain.use_case.update_current_language_iso_code
package com.prmto.mova_movieapp.core.domain.use_case

import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import javax.inject.Inject

class UpdateLanguageIsoCodeUseCase @Inject constructor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.prmto.mova_movieapp.domain.use_case.update_ui_mode
package com.prmto.mova_movieapp.core.domain.use_case

import com.prmto.mova_movieapp.domain.repository.DataStoreOperations
import com.prmto.mova_movieapp.core.domain.repository.DataStoreOperations
import javax.inject.Inject

class UpdateUIModeUseCase @Inject constructor(
Expand Down
Loading