-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
133 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.cinema.classic.common | ||
|
||
object Constants { | ||
const val BASE_URL = "https://www.googleapis.com/youtube/v3/search/" | ||
const val NAVER_URL = "https://openapi.naver.com/v1/search/movie.json" | ||
const val KMDB_URL = | ||
"https://api.koreafilm.or.kr/openapi-data2/wisenut/search_api/search_json2.jsp" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.cinema.classic.common | ||
|
||
sealed class Resource<T>(val data: T? = null, val message: String? = "") { | ||
class Success | ||
class Error | ||
class Loading() | ||
} |
32 changes: 0 additions & 32 deletions
32
app/src/main/java/com/cinema/classic/data/MovieClipRepository.kt
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
app/src/main/java/com/cinema/classic/data/MovieRepository.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...a/com/cinema/classic/data/MovieClipDao.kt β ...cinema/classic/data/local/MovieClipApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...inema/classic/works/SeedDatabaseWorker.kt β .../classic/data/local/SeedDatabaseWorker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...java/com/cinema/classic/data/MovieClip.kt β ...inema/classic/data/local/dto/MovieClip.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 34 additions & 0 deletions
34
app/src/main/java/com/cinema/classic/data/repository/MovieClipRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.cinema.classic.data.repository | ||
|
||
import com.cinema.classic.data.local.MovieClipApi | ||
import com.cinema.classic.data.local.dto.MovieClip | ||
import kotlinx.coroutines.flow.Flow | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class MovieClipRepository @Inject constructor( | ||
private val movieClipApi: MovieClipApi | ||
) { | ||
fun get(videoId: String) = movieClipApi.get(videoId) | ||
|
||
suspend fun delete(movieClip: MovieClip) { | ||
movieClipApi.delete(movieClip) | ||
} | ||
|
||
suspend fun insert(movieClip: MovieClip) { | ||
movieClipApi.insert(movieClip) | ||
} | ||
|
||
fun getLastVideo() : Flow<MovieClip> = movieClipApi.getLastVideo() | ||
|
||
companion object { | ||
@Volatile | ||
private var instance: MovieClipRepository? = null | ||
|
||
fun getInstance(movieClipApi: MovieClipApi) = | ||
instance ?: synchronized(this) { | ||
instance ?: MovieClipRepository(movieClipApi).also { instance = it } | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/cinema/classic/data/repository/MovieRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.cinema.classic.data.repository | ||
|
||
import com.cinema.classic.common.Constants | ||
import com.cinema.classic.data.KmdbResult | ||
import com.cinema.classic.data.NaverResult | ||
import com.cinema.classic.data.Youtube | ||
import com.cinema.classic.data.remote.MovieApi | ||
import retrofit2.Response | ||
import javax.inject.Inject | ||
|
||
class MovieRepository @Inject constructor( | ||
private val service: MovieApi | ||
) { | ||
suspend fun load(): Response<Youtube> { | ||
return service.get(Constants.BASE_URL) | ||
} | ||
|
||
suspend fun get(title: String, year: Int): Response<NaverResult> { | ||
return service.get2(Constants.NAVER_URL, title, year, year) | ||
} | ||
|
||
suspend fun get2(title: String): Response<KmdbResult> { | ||
return service.get3(Constants.KMDB_URL, title) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...inema/classic/viewmodels/MainViewModel.kt β ...c/presentation/main_list/MainViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.