Skip to content

Commit ecae908

Browse files
committed
spotless
1 parent cd047c0 commit ecae908

23 files changed

Lines changed: 151 additions & 79 deletions

File tree

data/network/src/commonMain/kotlin/social/androiddev/common/network/MastodonApiKtor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ internal class MastodonApiKtor(
128128

129129
override suspend fun getHomeFeed(domain: String, accessToken: String): Result<List<Status>> {
130130
return runCatchingIgnoreCancelled {
131-
httpClient.get{
131+
httpClient.get {
132132
url {
133133
host = domain
134134
path("/api/v1/timelines/home")

data/network/src/commonMain/kotlin/social/androiddev/common/network/model/Application.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import kotlinx.serialization.Serializable
1818
@Serializable
1919
data class Application(
2020
val name: String,
21-
@SerialName("vapid_key") val vapidKey: String?=null,
21+
@SerialName("vapid_key") val vapidKey: String? = null,
2222

2323
// optional attributes
2424
val website: String? = null,

data/network/src/commonMain/kotlin/social/androiddev/common/network/model/Status.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ data class Status(
2727
@SerialName("sensitive") val sensitive: Boolean,
2828
@SerialName("spoiler_text") val spoilerText: String,
2929
@SerialName("media_attachments") val mediaAttachments: List<Attachment>? = emptyList(),
30-
@SerialName("application") val application: Application?=null,
30+
@SerialName("application") val application: Application? = null,
3131

3232
// rendering attributes
3333
@SerialName("mentions") val mentions: List<Mention>? = null,

data/network/src/commonMain/kotlin/social/androiddev/common/network/model/Tag.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ data class Tag(
2222
@SerialName("url") val url: String,
2323

2424
// optional attributes
25-
@SerialName("history") val history: List<History>?= emptyList(),
25+
@SerialName("history") val history: List<History>? = emptyList(),
2626
)

data/network/src/commonTest/kotlin/social/androiddev/common/network/MastodonApiTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import kotlin.test.assertNull
3030
import kotlin.test.assertTrue
3131

3232
@OptIn(ExperimentalCoroutinesApi::class)
33-
class MastodonApiTests {
33+
class MastodonApiTests {
3434

3535
@Test
3636
fun `instance list should be parsed correctly`() = runTest {
@@ -215,7 +215,7 @@ import kotlin.test.assertTrue
215215
// then
216216
assertTrue(actual = result.isSuccess)
217217
}
218-
//TODO MIKE: Harden tests to validate inputs
218+
// TODO MIKE: Harden tests to validate inputs
219219
@Test
220220
fun `view home feed should succeed`() = runTest {
221221
val mastodonApi = MastodonApiKtor(
@@ -225,7 +225,7 @@ import kotlin.test.assertTrue
225225
)
226226

227227
// when
228-
val result = mastodonApi.getHomeFeed("","")
228+
val result = mastodonApi.getHomeFeed("", "")
229229

230230
// then
231231
assertTrue(actual = result.isSuccess)

data/network/src/commonTest/kotlin/social/androiddev/common/network/fixtures/TestFixtures.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
/*
2+
* This file is part of Dodo.
3+
*
4+
* Dodo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5+
*
6+
* Dodo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7+
*
8+
* You should have received a copy of the GNU General Public License along with Dodo. If not, see <https://www.gnu.org/licenses/>.
9+
*/
110
package social.androiddev.common.network.fixtures
211

3-
val homeFeed = """
12+
val homeFeed = """
413
[
514
{
615
"id": "109518540195637455",
@@ -2400,4 +2409,4 @@ package social.androiddev.common.network.fixtures
24002409
"poll": null
24012410
}
24022411
]
2403-
""".trimIndent()
2412+
""".trimIndent()

data/repository/src/commonMain/kotlin/social/androiddev/common/repository/di/RepositoryModule.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ val repositoryModule: Module = module {
3131
)
3232
}
3333
}
34-

data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/ModelMappers.kt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of Dodo.
3+
*
4+
* Dodo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5+
*
6+
* Dodo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7+
*
8+
* You should have received a copy of the GNU General Public License along with Dodo. If not, see <https://www.gnu.org/licenses/>.
9+
*/
110
package social.androiddev.common.repository.timeline
211

312
import social.androiddev.common.network.model.Status
@@ -11,9 +20,9 @@ fun StatusDB.toLocal(
1120
remoteId = remoteId,
1221
feedType = key,
1322
createdAt = createdAt,
14-
repliesCount = repliesCount?:0,
15-
reblogsCount = favouritesCount?:0,
16-
favoritesCount = favouritesCount?:0,
23+
repliesCount = repliesCount ?: 0,
24+
reblogsCount = favouritesCount ?: 0,
25+
favoritesCount = favouritesCount ?: 0,
1726
content = content,
1827
sensitive = sensitive ?: false,
1928
spoilerText = spoilerText,
@@ -23,7 +32,6 @@ fun StatusDB.toLocal(
2332
userName = userName
2433
)
2534

26-
2735
fun Status.statusDB() =
2836
StatusDB(
2937
type = FeedType.Home.type,
@@ -39,7 +47,7 @@ fun Status.statusDB() =
3947
repliesCount = repliesCount?.toLong(),
4048
reblogsCount = reblogsCount?.toLong(),
4149
favouritesCount = favouritesCount?.toLong(),
42-
avatarUrl = account?.avatar?:"",
43-
accountAddress = account?.acct?:"",
44-
userName = account?.username?:" "
45-
)
50+
avatarUrl = account?.avatar ?: "",
51+
accountAddress = account?.acct ?: "",
52+
userName = account?.username ?: " "
53+
)

data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/HomeTimelineRepository.kt renamed to data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/RealHomeTimelineRepository.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of Dodo.
3+
*
4+
* Dodo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5+
*
6+
* Dodo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7+
*
8+
* You should have received a copy of the GNU General Public License along with Dodo. If not, see <https://www.gnu.org/licenses/>.
9+
*/
110
package social.androiddev.common.repository.timeline
211

312
import kotlinx.coroutines.flow.Flow
@@ -9,7 +18,6 @@ import social.androiddev.domain.timeline.FeedType
918
import social.androiddev.domain.timeline.HomeTimelineRepository
1019
import social.androiddev.domain.timeline.model.StatusLocal
1120

12-
1321
class RealHomeTimelineRepository(
1422
private val store: Store<FeedType, List<StatusLocal>>
1523
) : HomeTimelineRepository {
@@ -24,8 +32,6 @@ class RealHomeTimelineRepository(
2432
refresh: Boolean
2533
): Flow<StoreResponse<List<StatusLocal>>> {
2634
return store.stream(StoreRequest.cached(key = feedType, refresh = true))
27-
.distinctUntilChanged() }
28-
29-
30-
}
31-
35+
.distinctUntilChanged()
36+
}
37+
}

data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/TimelineFetcher.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of Dodo.
3+
*
4+
* Dodo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5+
*
6+
* Dodo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7+
*
8+
* You should have received a copy of the GNU General Public License along with Dodo. If not, see <https://www.gnu.org/licenses/>.
9+
*/
110
package social.androiddev.common.repository.timeline
211

312
import org.mobilenativefoundation.store.store5.Fetcher

0 commit comments

Comments
 (0)