Skip to content

Commit e2d6dc9

Browse files
#5 - mudando estrutura de pacotes
1 parent 8c7ea02 commit e2d6dc9

File tree

16 files changed

+244
-0
lines changed

16 files changed

+244
-0
lines changed

app/src/main/java/di/AppModule.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package di
2+
3+
import android.content.res.Resources
4+
import org.koin.android.ext.koin.androidContext
5+
import org.koin.dsl.module
6+
7+
object AppModule {
8+
9+
val module = module {
10+
single<Resources> { androidContext().resources }
11+
}
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.codandotv.streamplayerapp.corenetworking
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.codandotv.streamplayerapp.corenetworking.test", appContext.packageName)
23+
}
24+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.codandotv.streamplayerapp.corenetworking
2+
3+
import org.junit.Test
4+
5+
import org.junit.Assert.*
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* See [testing documentation](http://d.android.com/tools/testing).
11+
*/
12+
class ExampleUnitTest {
13+
@Test
14+
fun addition_isCorrect() {
15+
assertEquals(4, 2 + 2)
16+
}
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.data
2+
3+
import com.codandotv.streamplayerapp.feature_list_streams.domain.model.ListStream
4+
5+
interface ListStreamRepository {
6+
fun getMovies() : ListStream
7+
}
8+
9+
class ListStreamRepositoryImpl(
10+
// private val service : ListStreamService
11+
) : ListStreamRepository {
12+
13+
override fun getMovies(): ListStream = ListStream("")
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.data
2+
3+
import com.codandotv.streamplayerapp.feature_list_streams.data.model.ListStreamResponse
4+
5+
interface ListStreamService {
6+
fun getMovies() : ListStreamResponse
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.data.model
2+
3+
data class ListStreamResponse(
4+
val name : String
5+
)
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.di
2+
3+
import com.codandotv.streamplayerapp.feature_list_streams.data.ListStreamRepositoryImpl
4+
import com.codandotv.streamplayerapp.feature_list_streams.domain.ListStreamAnalytics
5+
import com.codandotv.streamplayerapp.feature_list_streams.domain.ListStreamAnalyticsImpl
6+
import com.codandotv.streamplayerapp.feature_list_streams.domain.ListStreamUseCase
7+
import com.codandotv.streamplayerapp.feature_list_streams.domain.ListStreamUseCaseImpl
8+
import com.codandotv.streamplayerapp.feature_list_streams.presentation.ListMovieViewModel
9+
import com.codandotv.streamplayerapp.feature_list_streams.presentation.ListStreamUiModelImpl
10+
import org.koin.androidx.viewmodel.dsl.viewModel
11+
import org.koin.dsl.module
12+
13+
object ListStreamModule {
14+
val module = module {
15+
viewModel {
16+
ListMovieViewModel(
17+
uiModel = get(),
18+
useCase = get(),
19+
analytics = get()
20+
)
21+
}
22+
factory<ListStreamUseCase> {
23+
ListStreamUseCaseImpl(
24+
repository = get()
25+
)
26+
}
27+
28+
factory<ListStreamAnalytics> {
29+
ListStreamAnalyticsImpl()
30+
}
31+
32+
factory<com.codandotv.streamplayerapp.feature_list_streams.data.ListStreamRepository> {
33+
ListStreamRepositoryImpl()
34+
}
35+
36+
37+
factory<com.codandotv.streamplayerapp.feature_list_streams.presentation.ListStreamUimodel> {
38+
ListStreamUiModelImpl(
39+
resources = get()
40+
)
41+
}
42+
}
43+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.domain
2+
3+
import com.codandotv.streamplayerapp.feature_list_streams.data.ListStreamRepository
4+
import com.codandotv.streamplayerapp.feature_list_streams.domain.model.ListStream
5+
6+
interface ListStreamUseCase {
7+
fun getMovies() : ListStream
8+
}
9+
10+
class ListStreamUseCaseImpl(
11+
private val repository: ListStreamRepository
12+
) : ListStreamUseCase {
13+
14+
override fun getMovies(): ListStream {
15+
println(">>>>>>> Curta o video!!!")
16+
return repository.getMovies()
17+
}
18+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.domain
2+
3+
interface ListStreamAnalytics{}
4+
5+
class ListStreamAnalyticsImpl : ListStreamAnalytics {
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.codandotv.streamplayerapp.feature_list_streams.domain
2+
3+
import com.codandotv.streamplayerapp.feature_list_streams.data.model.ListStreamResponse
4+
import com.codandotv.streamplayerapp.feature_list_streams.domain.model.ListStream
5+
6+
fun ListStreamResponse.toListStream() : ListStream =
7+
ListStream(
8+
name = this.name
9+
)

0 commit comments

Comments
 (0)