Skip to content

Commit ebbc134

Browse files
committed
fix
1 parent 67b58e7 commit ebbc134

File tree

19 files changed

+298
-314
lines changed

19 files changed

+298
-314
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_size=2
5+
end_of_line=lf
6+
charset=utf-8
7+
trim_trailing_whitespace=true
8+
insert_final_newline=true
9+
10+
[*.{kt,kts}]
11+
ij_kotlin_imports_layout=*

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ plugins {
66
}
77

88
android {
9-
compileSdkVersion 30
10-
buildToolsVersion "30.0.2"
9+
compileSdkVersion 31
10+
buildToolsVersion "31.0.0"
1111

1212
defaultConfig {
1313
applicationId "com.hoc081098.paginationmviflow"
1414
minSdkVersion 23
15-
targetSdkVersion 30
15+
targetSdkVersion 31
1616
versionCode 1
1717
versionName "1.0"
1818

@@ -33,49 +33,48 @@ android {
3333
jvmTarget = '1.8'
3434
freeCompilerArgs += ['-Xopt-in=kotlin.RequiresOptIn']
3535
}
36-
buildFeatures { viewBinding = true }
36+
buildFeatures { viewBinding true }
3737
}
3838

3939
dependencies {
4040

4141
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
42-
implementation 'androidx.core:core-ktx:1.3.2'
43-
implementation 'androidx.appcompat:appcompat:1.2.0'
44-
implementation 'com.google.android.material:material:1.2.1'
45-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
46-
implementation "androidx.recyclerview:recyclerview:1.2.0-alpha06"
42+
implementation 'androidx.core:core-ktx:1.7.0'
43+
implementation 'androidx.appcompat:appcompat:1.4.0'
44+
implementation 'com.google.android.material:material:1.4.0'
45+
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
46+
implementation "androidx.recyclerview:recyclerview:1.3.0-alpha01"
4747
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
4848

4949
// Coroutines
50-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1"
51-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1"
50+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
51+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
5252

5353
// Hilt
5454
implementation "com.google.dagger:hilt-android:2.40.2"
5555
kapt "com.google.dagger:hilt-android-compiler:2.40.2"
56-
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha02'
57-
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha02'
5856

5957
// Navigation
60-
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.1'
61-
implementation 'androidx.navigation:navigation-ui-ktx:2.3.1'
58+
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
59+
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
6260

6361
// Retrofit, Moshi Converter, OkHttp Logging
64-
implementation 'com.squareup.moshi:moshi-kotlin:1.10.0'
62+
implementation 'com.squareup.moshi:moshi-kotlin:1.12.0'
6563
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
6664
implementation 'com.squareup.retrofit2:converter-moshi:2.9.0'
67-
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
65+
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
6866

69-
implementation "io.coil-kt:coil:1.0.0"
67+
implementation "io.coil-kt:coil:1.2.1"
7068

7169
// Navigation
72-
def nav_version = "2.2.0-rc02"
70+
def nav_version = "2.3.5"
7371
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
7472
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
7573

76-
implementation 'com.github.hoc081098:ViewBindingDelegate:1.0.0-alpha01'
74+
implementation 'com.github.hoc081098:ViewBindingDelegate:1.2.0'
75+
implementation "io.github.hoc081098:FlowExt:0.1.0"
7776

78-
testImplementation 'junit:junit:4.13.1'
79-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
80-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
81-
}
77+
testImplementation 'junit:junit:4.13.2'
78+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
79+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
80+
}

app/src/main/java/com/hoc081098/paginationmviflow/data/PhotoRepositoryImpl.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ import com.hoc081098.paginationmviflow.data.remote.ApiService
44
import com.hoc081098.paginationmviflow.domain.dispatchers_schedulers.CoroutinesDispatchersProvider
55
import com.hoc081098.paginationmviflow.domain.entity.Photo
66
import com.hoc081098.paginationmviflow.domain.repository.PhotoRepository
7-
import kotlinx.coroutines.withContext
87
import javax.inject.Inject
98
import javax.inject.Singleton
9+
import kotlinx.coroutines.withContext
1010

1111
@Singleton
1212
class PhotoRepositoryImpl @Inject constructor(
13-
private val apiService: ApiService,
14-
private val dispatchersProvider: CoroutinesDispatchersProvider
13+
private val apiService: ApiService,
14+
private val dispatchersProvider: CoroutinesDispatchersProvider
1515
) : PhotoRepository {
1616
override suspend fun getPhotos(start: Int, limit: Int): List<Photo> {
1717
return withContext(dispatchersProvider.io) {
1818
apiService.getPhotos(start = start, limit = limit).map {
1919
Photo(
20-
id = it.id,
21-
title = it.title,
22-
albumId = it.albumId,
23-
thumbnailUrl = it.thumbnailUrl,
24-
url = it.url
20+
id = it.id,
21+
title = it.title,
22+
albumId = it.albumId,
23+
thumbnailUrl = it.thumbnailUrl,
24+
url = it.url
2525
)
2626
}
2727
}
2828
}
29-
}
29+
}

app/src/main/java/com/hoc081098/paginationmviflow/data/PostRepositoryImpl.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ import com.hoc081098.paginationmviflow.data.remote.ApiService
44
import com.hoc081098.paginationmviflow.domain.dispatchers_schedulers.CoroutinesDispatchersProvider
55
import com.hoc081098.paginationmviflow.domain.entity.Post
66
import com.hoc081098.paginationmviflow.domain.repository.PostRepository
7-
import kotlinx.coroutines.withContext
87
import javax.inject.Inject
98
import javax.inject.Singleton
9+
import kotlinx.coroutines.withContext
1010

1111
@Singleton
1212
class PostRepositoryImpl @Inject constructor(
13-
private val apiService: ApiService,
14-
private val dispatchersProvider: CoroutinesDispatchersProvider
13+
private val apiService: ApiService,
14+
private val dispatchersProvider: CoroutinesDispatchersProvider
1515
) : PostRepository {
1616
override suspend fun getPosts(start: Int, limit: Int): List<Post> {
1717
return withContext(dispatchersProvider.io) {
1818
apiService.getPosts(start = start, limit = limit).map {
1919
Post(
20-
body = it.body,
21-
title = it.title,
22-
id = it.id,
23-
userId = it.userId
20+
body = it.body,
21+
title = it.title,
22+
id = it.id,
23+
userId = it.userId
2424
)
2525
}
2626
}
2727
}
2828

29-
}
29+
}

app/src/main/java/com/hoc081098/paginationmviflow/di/modules/DataModule.kt

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
88
import dagger.Module
99
import dagger.Provides
1010
import dagger.hilt.InstallIn
11-
import dagger.hilt.android.components.ApplicationComponent
11+
import dagger.hilt.components.SingletonComponent
12+
import java.util.concurrent.TimeUnit
13+
import javax.inject.Singleton
1214
import okhttp3.OkHttpClient
1315
import okhttp3.logging.HttpLoggingInterceptor
1416
import retrofit2.Retrofit
1517
import retrofit2.converter.moshi.MoshiConverterFactory
16-
import java.util.concurrent.TimeUnit
17-
import javax.inject.Singleton
1818

1919
@Module
20-
@InstallIn(ApplicationComponent::class)
20+
@InstallIn(SingletonComponent::class)
2121
class DataModule {
2222
@Singleton
2323
@Provides
@@ -29,33 +29,33 @@ class DataModule {
2929
@Provides
3030
fun provideRetrofit(client: OkHttpClient): Retrofit {
3131
return Retrofit.Builder()
32-
.baseUrl(BASE_URL)
33-
.client(client)
34-
.addConverterFactory(
35-
MoshiConverterFactory.create(
36-
Moshi
37-
.Builder()
38-
.add(KotlinJsonAdapterFactory())
39-
.build()
40-
)
32+
.baseUrl(BASE_URL)
33+
.client(client)
34+
.addConverterFactory(
35+
MoshiConverterFactory.create(
36+
Moshi
37+
.Builder()
38+
.add(KotlinJsonAdapterFactory())
39+
.build()
4140
)
42-
.build()
41+
)
42+
.build()
4343
}
4444

4545
@Singleton
4646
@Provides
4747
fun provideOkHttpClient(): OkHttpClient {
4848
return OkHttpClient.Builder()
49-
.connectTimeout(15, TimeUnit.SECONDS)
50-
.readTimeout(15, TimeUnit.SECONDS)
51-
.writeTimeout(15, TimeUnit.SECONDS)
52-
.apply {
53-
if (BuildConfig.DEBUG) {
54-
HttpLoggingInterceptor()
55-
.setLevel(HttpLoggingInterceptor.Level.BODY)
56-
.let(::addInterceptor)
57-
}
49+
.connectTimeout(15, TimeUnit.SECONDS)
50+
.readTimeout(15, TimeUnit.SECONDS)
51+
.writeTimeout(15, TimeUnit.SECONDS)
52+
.apply {
53+
if (BuildConfig.DEBUG) {
54+
HttpLoggingInterceptor()
55+
.setLevel(HttpLoggingInterceptor.Level.BODY)
56+
.let(::addInterceptor)
5857
}
59-
.build()
58+
}
59+
.build()
6060
}
61-
}
61+
}

app/src/main/java/com/hoc081098/paginationmviflow/di/modules/DomainModule.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import com.hoc081098.paginationmviflow.domain.repository.PostRepository
99
import dagger.Binds
1010
import dagger.Module
1111
import dagger.hilt.InstallIn
12-
import dagger.hilt.android.components.ApplicationComponent
12+
import dagger.hilt.components.SingletonComponent
1313

1414
@Module
15-
@InstallIn(ApplicationComponent::class)
15+
@InstallIn(SingletonComponent::class)
1616
interface DomainModule {
1717
@Binds
1818
fun provideCoroutinesDispatchersProvider(coroutinesDispatchersProviderImpl: CoroutinesDispatchersProviderImpl): CoroutinesDispatchersProvider
@@ -22,4 +22,4 @@ interface DomainModule {
2222

2323
@Binds
2424
fun providePostRepository(postRepositoryImpl: PostRepositoryImpl): PostRepository
25-
}
25+
}

0 commit comments

Comments
 (0)