File tree Expand file tree Collapse file tree 7 files changed +17
-35
lines changed
androidInstrumentedTest/kotlin/ui
commonTest/kotlin/domain/mapper Expand file tree Collapse file tree 7 files changed +17
-35
lines changed Original file line number Diff line number Diff line change 39
39
<ID >MagicNumber:MjImagesApp.kt$24f</ID >
40
40
<ID >MagicNumber:String0.commonMain.kt$10</ID >
41
41
<ID >MagicNumber:String0.commonMain.kt$109</ID >
42
- <ID >MagicNumber:String0.commonMain.kt$84 </ID >
43
- <ID >MagicNumber:String0.commonMain.kt$95 </ID >
42
+ <ID >MagicNumber:String0.commonMain.kt$120 </ID >
43
+ <ID >MagicNumber:String0.commonMain.kt$131 </ID >
44
44
<ID >UnusedPrivateProperty:build.gradle.kts$val androidInstrumentedTest by getting { dependencies { implementation(libs.androidxUiTestJunit4) implementation(libs.androidxUiTestManifest) } }</ID >
45
45
<ID >UnusedPrivateProperty:build.gradle.kts$val jsMain by getting { dependencies { implementation(compose.runtime) implementation(compose.foundation) implementation(project(":shared")) } }</ID >
46
46
<ID >UnusedPrivateProperty:build.gradle.kts$val jvmMain by getting { dependencies { implementation(project(":shared")) implementation(compose.desktop.currentOs) } }</ID >
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ class MjImagesScreenTest {
63
63
}
64
64
65
65
composeTestRule
66
- .onNodeWithText(" offline" , substring = true )
66
+ .onNodeWithText(" offline" , substring = true , ignoreCase = true )
67
67
.assertIsDisplayed()
68
68
}
69
69
Original file line number Diff line number Diff line change 1
1
<resources >
2
2
<string name =" snack_message" >1) Click image to open in browser\n2) Long click to preview image</string >
3
- <string name =" failed_fetch_message" >Failed to fetch images, using offline mode </string >
3
+ <string name =" failed_fetch_message" >Offline mode is being utilised as latest photos cannot be collected.. </string >
4
4
</resources >
Original file line number Diff line number Diff line change 1
1
package domain.model
2
2
3
- data class MjImage (
3
+ import kotlin.uuid.ExperimentalUuidApi
4
+ import kotlin.uuid.Uuid
5
+
6
+ data class MjImage @OptIn(ExperimentalUuidApi ::class ) constructor(
7
+ val id : String = Uuid .random().toString(),
4
8
val date : String ,
5
9
val imageUrl : String ,
6
10
val hqImageUrl : String ,
Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ data class MjImages(
11
11
12
12
fun isEmpty () = images.isEmpty()
13
13
14
- operator fun plus (images : MjImages ): MjImages =
14
+ operator fun plus (other : MjImages ): MjImages =
15
15
MjImages (
16
- currentPage = images .currentPage,
17
- images = (this .images + images .images).distinct( ),
18
- totalPages = images .totalPages
16
+ currentPage = other .currentPage,
17
+ images = (this .images + other .images).distinctBy( MjImage ::imageUrl ),
18
+ totalPages = other .totalPages
19
19
)
20
20
}
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ fun MjImagesList(
219
219
) {
220
220
items(
221
221
items = images.images,
222
- key = MjImage ::imageUrl
222
+ key = MjImage ::id,
223
223
) { image ->
224
224
MjImageItem (
225
225
image = image,
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package domain.mapper
2
2
3
3
import data.source.remote.model.MjImageResponse
4
4
import data.source.remote.model.MjImagesResponse
5
- import domain.model.MjImage
6
5
import kotlin.test.BeforeTest
7
6
import kotlin.test.Test
8
7
import kotlin.test.assertEquals
@@ -133,15 +132,8 @@ class MjImagesMapperTest {
133
132
134
133
// then
135
134
assertEquals(
136
- listOf (
137
- MjImage (
138
- date = " 2023-21-04" ,
139
- imageUrl = " https://mj.akgns.com" ,
140
- ratio = 1.0 ,
141
- hqImageUrl = " https://mj.akgns.com/hq" ,
142
- )
143
- ),
144
- result.images
135
+ 1 ,
136
+ result.images.size
145
137
)
146
138
}
147
139
@@ -169,21 +161,7 @@ class MjImagesMapperTest {
169
161
170
162
// then
171
163
assertEquals(
172
- listOf (
173
- MjImage (
174
- date = " 2024-21-04" ,
175
- imageUrl = " https://mj.akgns.com" ,
176
- ratio = 1.0 ,
177
- hqImageUrl = " https://mj.akgns.com/hq" ,
178
- ),
179
- MjImage (
180
- date = " 2023-21-04" ,
181
- imageUrl = " https://mj.akgns.com/images" ,
182
- hqImageUrl = " https://mj.akgns.com/hq" ,
183
- ratio = 1.0
184
- )
185
- ),
186
- result.images
164
+ result.images.size, 2
187
165
)
188
166
}
189
167
You can’t perform that action at this time.
0 commit comments