mirror of https://github.com/readrops/Readrops.git
Rename some Nextcloud News and FreshRSS files
This commit is contained in:
parent
49fc62edc2
commit
aa3a835756
|
@ -2,18 +2,18 @@ package com.readrops.api
|
|||
|
||||
import com.readrops.api.localfeed.LocalRSSDataSource
|
||||
import com.readrops.api.services.Credentials
|
||||
import com.readrops.api.services.freshrss.NewFreshRSSDataSource
|
||||
import com.readrops.api.services.freshrss.NewFreshRSSService
|
||||
import com.readrops.api.services.freshrss.FreshRSSDataSource
|
||||
import com.readrops.api.services.freshrss.FreshRSSService
|
||||
import com.readrops.api.services.freshrss.adapters.FreshRSSFeedsAdapter
|
||||
import com.readrops.api.services.freshrss.adapters.FreshRSSFoldersAdapter
|
||||
import com.readrops.api.services.freshrss.adapters.FreshRSSItemsAdapter
|
||||
import com.readrops.api.services.freshrss.adapters.FreshRSSItemsIdsAdapter
|
||||
import com.readrops.api.services.freshrss.adapters.FreshRSSUserInfoAdapter
|
||||
import com.readrops.api.services.nextcloudnews.NewNextcloudNewsDataSource
|
||||
import com.readrops.api.services.nextcloudnews.NewNextcloudNewsService
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextNewsFeedsAdapter
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextNewsFoldersAdapter
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextNewsItemsAdapter
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsDataSource
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsService
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextcloudNewsFeedsAdapter
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextcloudNewsFoldersAdapter
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextcloudNewsItemsAdapter
|
||||
import com.readrops.api.utils.AuthInterceptor
|
||||
import com.readrops.api.utils.ErrorInterceptor
|
||||
import com.readrops.db.entities.Item
|
||||
|
@ -46,7 +46,7 @@ val apiModule = module {
|
|||
|
||||
//region freshrss
|
||||
|
||||
factory { params -> NewFreshRSSDataSource(get(parameters = { params })) }
|
||||
factory { params -> FreshRSSDataSource(get(parameters = { params })) }
|
||||
|
||||
factory { (credentials: Credentials) ->
|
||||
Retrofit.Builder()
|
||||
|
@ -54,7 +54,7 @@ val apiModule = module {
|
|||
.client(get())
|
||||
.addConverterFactory(MoshiConverterFactory.create(get(named("freshrssMoshi"))))
|
||||
.build()
|
||||
.create(NewFreshRSSService::class.java)
|
||||
.create(FreshRSSService::class.java)
|
||||
}
|
||||
|
||||
single(named("freshrssMoshi")) {
|
||||
|
@ -71,7 +71,7 @@ val apiModule = module {
|
|||
|
||||
//region nextcloud news
|
||||
|
||||
factory { params -> NewNextcloudNewsDataSource(get(parameters = { params })) }
|
||||
factory { params -> NextcloudNewsDataSource(get(parameters = { params })) }
|
||||
|
||||
factory { (credentials: Credentials) ->
|
||||
Retrofit.Builder()
|
||||
|
@ -79,14 +79,14 @@ val apiModule = module {
|
|||
.client(get())
|
||||
.addConverterFactory(MoshiConverterFactory.create(get(named("nextcloudNewsMoshi"))))
|
||||
.build()
|
||||
.create(NewNextcloudNewsService::class.java)
|
||||
.create(NextcloudNewsService::class.java)
|
||||
}
|
||||
|
||||
single(named("nextcloudNewsMoshi")) {
|
||||
Moshi.Builder()
|
||||
.add(NextNewsFeedsAdapter())
|
||||
.add(NextNewsFoldersAdapter())
|
||||
.add(Types.newParameterizedType(List::class.java, Item::class.java), NextNewsItemsAdapter())
|
||||
.add(NextcloudNewsFeedsAdapter())
|
||||
.add(NextcloudNewsFoldersAdapter())
|
||||
.add(Types.newParameterizedType(List::class.java, Item::class.java), NextcloudNewsItemsAdapter())
|
||||
.build()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.readrops.api.services
|
||||
|
||||
import com.readrops.api.services.freshrss.FreshRSSCredentials
|
||||
import com.readrops.api.services.freshrss.NewFreshRSSService
|
||||
import com.readrops.api.services.nextcloudnews.NewNextcloudNewsService
|
||||
import com.readrops.api.services.nextcloudnews.NextNewsCredentials
|
||||
import com.readrops.api.services.freshrss.FreshRSSService
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsService
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsCredentials
|
||||
import com.readrops.db.entities.account.Account
|
||||
import com.readrops.db.entities.account.AccountType
|
||||
|
||||
|
@ -15,7 +15,7 @@ abstract class Credentials(val authorization: String?, val url: String) {
|
|||
val endPoint = getEndPoint(account.accountType!!)
|
||||
|
||||
return when (account.accountType) {
|
||||
AccountType.NEXTCLOUD_NEWS -> NextNewsCredentials(account.login, account.password, account.url + endPoint)
|
||||
AccountType.NEXTCLOUD_NEWS -> NextcloudNewsCredentials(account.login, account.password, account.url + endPoint)
|
||||
AccountType.FRESHRSS -> FreshRSSCredentials(account.token, account.url + endPoint)
|
||||
else -> throw IllegalArgumentException("Unknown account type")
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ abstract class Credentials(val authorization: String?, val url: String) {
|
|||
|
||||
private fun getEndPoint(accountType: AccountType): String {
|
||||
return when (accountType) {
|
||||
AccountType.FRESHRSS -> NewFreshRSSService.END_POINT
|
||||
AccountType.NEXTCLOUD_NEWS -> NewNextcloudNewsService.END_POINT
|
||||
AccountType.FRESHRSS -> FreshRSSService.END_POINT
|
||||
AccountType.NEXTCLOUD_NEWS -> NextcloudNewsService.END_POINT
|
||||
else -> throw IllegalArgumentException("Unknown account type")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import okhttp3.MultipartBody
|
|||
import java.io.StringReader
|
||||
import java.util.Properties
|
||||
|
||||
class NewFreshRSSDataSource(private val service: NewFreshRSSService) {
|
||||
class FreshRSSDataSource(private val service: FreshRSSService) {
|
||||
|
||||
suspend fun login(login: String, password: String): String {
|
||||
val requestBody = MultipartBody.Builder()
|
|
@ -13,7 +13,7 @@ import retrofit2.http.GET
|
|||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface NewFreshRSSService {
|
||||
interface FreshRSSService {
|
||||
|
||||
@POST("accounts/ClientLogin")
|
||||
suspend fun login(@Body body: RequestBody?): ResponseBody
|
|
@ -1,7 +1,7 @@
|
|||
package com.readrops.api.services.freshrss.adapters
|
||||
|
||||
import com.readrops.api.services.freshrss.NewFreshRSSDataSource.Companion.GOOGLE_READ
|
||||
import com.readrops.api.services.freshrss.NewFreshRSSDataSource.Companion.GOOGLE_STARRED
|
||||
import com.readrops.api.services.freshrss.FreshRSSDataSource.Companion.GOOGLE_READ
|
||||
import com.readrops.api.services.freshrss.FreshRSSDataSource.Companion.GOOGLE_STARRED
|
||||
import com.readrops.api.utils.exceptions.ParseException
|
||||
import com.readrops.api.utils.extensions.nextNonEmptyString
|
||||
import com.readrops.api.utils.extensions.nextNullableString
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.readrops.api.services.nextcloudnews
|
|||
|
||||
import com.readrops.api.services.Credentials
|
||||
|
||||
class NextNewsCredentials(login: String?, password: String?, url: String):
|
||||
class NextcloudNewsCredentials(login: String?, password: String?, url: String):
|
||||
Credentials(if (login != null && password != null) {
|
||||
okhttp3.Credentials.basic(login, password)
|
||||
} else null, url)
|
|
@ -3,7 +3,7 @@ package com.readrops.api.services.nextcloudnews
|
|||
import com.gitlab.mvysny.konsumexml.konsumeXml
|
||||
import com.readrops.api.services.SyncResult
|
||||
import com.readrops.api.services.SyncType
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextNewsUserAdapter
|
||||
import com.readrops.api.services.nextcloudnews.adapters.NextcloudNewsUserAdapter
|
||||
import com.readrops.db.entities.Feed
|
||||
import com.readrops.db.entities.Folder
|
||||
import com.readrops.db.entities.Item
|
||||
|
@ -15,7 +15,7 @@ import kotlinx.coroutines.awaitAll
|
|||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
|
||||
class NewNextcloudNewsDataSource(private val service: NewNextcloudNewsService) {
|
||||
class NextcloudNewsDataSource(private val service: NextcloudNewsService) {
|
||||
|
||||
suspend fun login(client: OkHttpClient, account: Account): String {
|
||||
val request = Request.Builder()
|
||||
|
@ -26,7 +26,7 @@ class NewNextcloudNewsDataSource(private val service: NewNextcloudNewsService) {
|
|||
val response = client.newCall(request)
|
||||
.execute()
|
||||
|
||||
val displayName = NextNewsUserAdapter().fromXml(response.body!!.byteStream().konsumeXml())
|
||||
val displayName = NextcloudNewsUserAdapter().fromXml(response.body!!.byteStream().konsumeXml())
|
||||
response.close()
|
||||
|
||||
return displayName
|
|
@ -11,7 +11,7 @@ import retrofit2.http.PUT
|
|||
import retrofit2.http.Path
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface NewNextcloudNewsService {
|
||||
interface NextcloudNewsService {
|
||||
|
||||
@GET("folders")
|
||||
suspend fun getFolders(): List<Folder>
|
|
@ -11,7 +11,7 @@ import com.squareup.moshi.JsonReader
|
|||
import com.squareup.moshi.ToJson
|
||||
import java.net.URI
|
||||
|
||||
class NextNewsFeedsAdapter {
|
||||
class NextcloudNewsFeedsAdapter {
|
||||
|
||||
@ToJson
|
||||
fun toJson(feeds: List<Feed>): String = ""
|
|
@ -8,7 +8,7 @@ import com.squareup.moshi.FromJson
|
|||
import com.squareup.moshi.JsonReader
|
||||
import com.squareup.moshi.ToJson
|
||||
|
||||
class NextNewsFoldersAdapter {
|
||||
class NextcloudNewsFoldersAdapter {
|
||||
|
||||
@ToJson
|
||||
fun toJson(folders: List<Folder>): String = ""
|
|
@ -12,7 +12,7 @@ import com.squareup.moshi.JsonWriter
|
|||
import org.joda.time.DateTimeZone
|
||||
import org.joda.time.LocalDateTime
|
||||
|
||||
class NextNewsItemsAdapter : JsonAdapter<List<Item>>() {
|
||||
class NextcloudNewsItemsAdapter : JsonAdapter<List<Item>>() {
|
||||
|
||||
override fun toJson(writer: JsonWriter, value: List<Item>?) {
|
||||
// no need of this
|
|
@ -6,7 +6,7 @@ import com.readrops.api.localfeed.XmlAdapter
|
|||
import com.readrops.api.utils.exceptions.ParseException
|
||||
import com.readrops.api.utils.extensions.nonNullText
|
||||
|
||||
class NextNewsUserAdapter : XmlAdapter<String> {
|
||||
class NextcloudNewsUserAdapter : XmlAdapter<String> {
|
||||
|
||||
override fun fromXml(konsumer: Konsumer): String {
|
||||
var displayName: String? = null
|
|
@ -1,7 +1,7 @@
|
|||
package com.readrops.api.services
|
||||
|
||||
import com.readrops.api.services.freshrss.FreshRSSCredentials
|
||||
import com.readrops.api.services.nextcloudnews.NextNewsCredentials
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsCredentials
|
||||
import org.junit.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
|
@ -17,7 +17,7 @@ class CredentialsTest {
|
|||
|
||||
@Test
|
||||
fun nextcloudNewsCredentialsTest() {
|
||||
val credentials = NextNewsCredentials("login", "password", "https://freshrss.org")
|
||||
val credentials = NextcloudNewsCredentials("login", "password", "https://freshrss.org")
|
||||
|
||||
assertEquals(credentials.authorization!!, "Basic bG9naW46cGFzc3dvcmQ=")
|
||||
assertEquals(credentials.url, "https://freshrss.org")
|
||||
|
|
|
@ -24,7 +24,7 @@ import kotlin.test.assertTrue
|
|||
|
||||
class FreshRSSDataSourceTest : KoinTest {
|
||||
|
||||
private lateinit var freshRSSDataSource: NewFreshRSSDataSource
|
||||
private lateinit var freshRSSDataSource: FreshRSSDataSource
|
||||
private val mockServer = MockWebServer()
|
||||
|
||||
@get:Rule
|
||||
|
@ -36,7 +36,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
.client(get())
|
||||
.addConverterFactory(MoshiConverterFactory.create(get(named("freshrssMoshi"))))
|
||||
.build()
|
||||
.create(NewFreshRSSService::class.java)
|
||||
.create(FreshRSSService::class.java)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
@Before
|
||||
fun before() {
|
||||
mockServer.start(8080)
|
||||
freshRSSDataSource = NewFreshRSSDataSource(get())
|
||||
freshRSSDataSource = FreshRSSDataSource(get())
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -122,13 +122,13 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
.setResponseCode(HttpURLConnection.HTTP_OK)
|
||||
.setBody(Buffer().readFrom(stream)))
|
||||
|
||||
val items = freshRSSDataSource.getItems(listOf(NewFreshRSSDataSource.GOOGLE_READ, NewFreshRSSDataSource.GOOGLE_STARRED), 100, 21343321321321)
|
||||
val items = freshRSSDataSource.getItems(listOf(FreshRSSDataSource.GOOGLE_READ, FreshRSSDataSource.GOOGLE_STARRED), 100, 21343321321321)
|
||||
assertTrue { items.size == 2 }
|
||||
|
||||
val request = mockServer.takeRequest()
|
||||
|
||||
with(request.requestUrl!!) {
|
||||
assertEquals(listOf(NewFreshRSSDataSource.GOOGLE_READ, NewFreshRSSDataSource.GOOGLE_STARRED), queryParameterValues("xt"))
|
||||
assertEquals(listOf(FreshRSSDataSource.GOOGLE_READ, FreshRSSDataSource.GOOGLE_STARRED), queryParameterValues("xt"))
|
||||
assertEquals("100", queryParameter("n"))
|
||||
assertEquals("21343321321321", queryParameter("ot"))
|
||||
|
||||
|
@ -157,13 +157,13 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
.setResponseCode(HttpURLConnection.HTTP_OK)
|
||||
.setBody(Buffer().readFrom(stream)))
|
||||
|
||||
val ids = freshRSSDataSource.getItemsIds(NewFreshRSSDataSource.GOOGLE_READ, NewFreshRSSDataSource.GOOGLE_READING_LIST, 100)
|
||||
val ids = freshRSSDataSource.getItemsIds(FreshRSSDataSource.GOOGLE_READ, FreshRSSDataSource.GOOGLE_READING_LIST, 100)
|
||||
assertTrue { ids.size == 5 }
|
||||
|
||||
val request = mockServer.takeRequest()
|
||||
with(request.requestUrl!!) {
|
||||
assertEquals(NewFreshRSSDataSource.GOOGLE_READ, queryParameter("xt"))
|
||||
assertEquals(NewFreshRSSDataSource.GOOGLE_READING_LIST, queryParameter("s"))
|
||||
assertEquals(FreshRSSDataSource.GOOGLE_READ, queryParameter("xt"))
|
||||
assertEquals(FreshRSSDataSource.GOOGLE_READING_LIST, queryParameter("s"))
|
||||
assertEquals("100", queryParameter("n"))
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
|
||||
with(request.body.readUtf8()) {
|
||||
assertTrue { contains("T=token") }
|
||||
assertTrue { contains("s=${URLEncoder.encode("${NewFreshRSSDataSource.FEED_PREFIX}https://feed.url", "UTF-8")}") }
|
||||
assertTrue { contains("s=${URLEncoder.encode("${FreshRSSDataSource.FEED_PREFIX}https://feed.url", "UTF-8")}") }
|
||||
assertTrue { contains("ac=subscribe") }
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
|
||||
with(request.body.readUtf8()) {
|
||||
assertTrue { contains("T=token") }
|
||||
assertTrue { contains("s=${URLEncoder.encode("${NewFreshRSSDataSource.FEED_PREFIX}https://feed.url", "UTF-8")}") }
|
||||
assertTrue { contains("s=${URLEncoder.encode("${FreshRSSDataSource.FEED_PREFIX}https://feed.url", "UTF-8")}") }
|
||||
assertTrue { contains("ac=unsubscribe") }
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
|
||||
with(request.body.readUtf8()) {
|
||||
assertTrue { contains("T=token") }
|
||||
assertTrue { contains("s=${URLEncoder.encode("${NewFreshRSSDataSource.FEED_PREFIX}https://feed.url", "UTF-8")}") }
|
||||
assertTrue { contains("s=${URLEncoder.encode("${FreshRSSDataSource.FEED_PREFIX}https://feed.url", "UTF-8")}") }
|
||||
assertTrue { contains("t=title") }
|
||||
assertTrue { contains("a=folderId") }
|
||||
assertTrue { contains("ac=edit") }
|
||||
|
@ -225,7 +225,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
|
||||
with(request.body.readUtf8()) {
|
||||
assertTrue { contains("T=token") }
|
||||
assertTrue { contains("a=${URLEncoder.encode("${NewFreshRSSDataSource.FOLDER_PREFIX}folder", "UTF-8")}") }
|
||||
assertTrue { contains("a=${URLEncoder.encode("${FreshRSSDataSource.FOLDER_PREFIX}folder", "UTF-8")}") }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ class FreshRSSDataSourceTest : KoinTest {
|
|||
with(request.body.readUtf8()) {
|
||||
assertTrue { contains("T=token") }
|
||||
assertTrue { contains("s=folderId") }
|
||||
assertTrue { contains("dest=${URLEncoder.encode("${NewFreshRSSDataSource.FOLDER_PREFIX}folder", "UTF-8")}") }
|
||||
assertTrue { contains("dest=${URLEncoder.encode("${FreshRSSDataSource.FOLDER_PREFIX}folder", "UTF-8")}") }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import kotlin.test.assertTrue
|
|||
|
||||
class NextcloudNewsDataSourceTest : KoinTest {
|
||||
|
||||
private lateinit var nextcloudNewsDataSource: NewNextcloudNewsDataSource
|
||||
private lateinit var nextcloudNewsDataSource: NextcloudNewsDataSource
|
||||
private val mockServer = MockWebServer()
|
||||
private val moshi = Moshi.Builder()
|
||||
.build()
|
||||
|
@ -39,7 +39,7 @@ class NextcloudNewsDataSourceTest : KoinTest {
|
|||
.client(get())
|
||||
.addConverterFactory(MoshiConverterFactory.create(get(named("nextcloudNewsMoshi"))))
|
||||
.build()
|
||||
.create(NewNextcloudNewsService::class.java)
|
||||
.create(NextcloudNewsService::class.java)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class NextcloudNewsDataSourceTest : KoinTest {
|
|||
@Before
|
||||
fun before() {
|
||||
mockServer.start(8080)
|
||||
nextcloudNewsDataSource = NewNextcloudNewsDataSource(get())
|
||||
nextcloudNewsDataSource = NextcloudNewsDataSource(get())
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -93,7 +93,7 @@ class NextcloudNewsDataSourceTest : KoinTest {
|
|||
val stream = TestUtils.loadResource("services/nextcloudnews/adapters/items.json")
|
||||
mockServer.enqueueStream(stream)
|
||||
|
||||
val items = nextcloudNewsDataSource.getItems(NewNextcloudNewsDataSource.ItemQueryType.ALL.value, false, 10)
|
||||
val items = nextcloudNewsDataSource.getItems(NextcloudNewsDataSource.ItemQueryType.ALL.value, false, 10)
|
||||
val request = mockServer.takeRequest()
|
||||
|
||||
assertTrue { items.size == 3 }
|
||||
|
@ -110,7 +110,7 @@ class NextcloudNewsDataSourceTest : KoinTest {
|
|||
mockServer.enqueueStream(stream)
|
||||
|
||||
val items =
|
||||
nextcloudNewsDataSource.getNewItems(1512, NewNextcloudNewsDataSource.ItemQueryType.ALL)
|
||||
nextcloudNewsDataSource.getNewItems(1512, NextcloudNewsDataSource.ItemQueryType.ALL)
|
||||
val request = mockServer.takeRequest()
|
||||
|
||||
assertTrue { items.size == 3 }
|
||||
|
|
|
@ -9,10 +9,10 @@ import org.junit.Assert.assertEquals
|
|||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class NextNewsFeedsAdapterTest {
|
||||
class NextcloudNewsFeedsAdapterTest {
|
||||
|
||||
private val adapter = Moshi.Builder()
|
||||
.add(NextNewsFeedsAdapter())
|
||||
.add(NextcloudNewsFeedsAdapter())
|
||||
.build()
|
||||
.adapter<List<Feed>>(Types.newParameterizedType(List::class.java, Feed::class.java))
|
||||
|
|
@ -10,10 +10,10 @@ import okio.Buffer
|
|||
import org.junit.Assert.assertThrows
|
||||
import org.junit.Test
|
||||
|
||||
class NextNewsFoldersAdapterTest {
|
||||
class NextcloudNewsFoldersAdapterTest {
|
||||
|
||||
private val adapter = Moshi.Builder()
|
||||
.add(NextNewsFoldersAdapter())
|
||||
.add(NextcloudNewsFoldersAdapter())
|
||||
.build()
|
||||
.adapter<List<Folder>>(Types.newParameterizedType(List::class.java, Folder::class.java))
|
||||
|
|
@ -9,10 +9,10 @@ import okio.Buffer
|
|||
import org.joda.time.LocalDateTime
|
||||
import org.junit.Test
|
||||
|
||||
class NextNewsItemsAdapterTest {
|
||||
class NextcloudNewsItemsAdapterTest {
|
||||
|
||||
private val adapter = Moshi.Builder()
|
||||
.add(Types.newParameterizedType(List::class.java, Item::class.java), NextNewsItemsAdapter())
|
||||
.add(Types.newParameterizedType(List::class.java, Item::class.java), NextcloudNewsItemsAdapter())
|
||||
.build()
|
||||
.adapter<List<Item>>(Types.newParameterizedType(List::class.java, Item::class.java))
|
||||
|
|
@ -5,9 +5,9 @@ import com.readrops.api.TestUtils
|
|||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class NextNewsUserAdapterTest {
|
||||
class NextcloudNewsUserAdapterTest {
|
||||
|
||||
private val adapter = NextNewsUserAdapter()
|
||||
private val adapter = NextcloudNewsUserAdapter()
|
||||
|
||||
@Test
|
||||
fun validXmlTest() {
|
|
@ -4,7 +4,7 @@ import com.readrops.api.services.Credentials
|
|||
import com.readrops.api.services.SyncResult
|
||||
import com.readrops.api.services.SyncType
|
||||
import com.readrops.api.services.freshrss.FreshRSSSyncData
|
||||
import com.readrops.api.services.freshrss.NewFreshRSSDataSource
|
||||
import com.readrops.api.services.freshrss.FreshRSSDataSource
|
||||
import com.readrops.api.utils.AuthInterceptor
|
||||
import com.readrops.app.util.Utils
|
||||
import com.readrops.db.Database
|
||||
|
@ -19,7 +19,7 @@ import org.koin.core.component.KoinComponent
|
|||
class FreshRSSRepository(
|
||||
database: Database,
|
||||
account: Account,
|
||||
private val dataSource: NewFreshRSSDataSource,
|
||||
private val dataSource: FreshRSSDataSource,
|
||||
) : BaseRepository(database, account), KoinComponent {
|
||||
|
||||
override suspend fun login(account: Account) {
|
||||
|
@ -113,7 +113,7 @@ class FreshRSSRepository(
|
|||
|
||||
override suspend fun updateFolder(folder: Folder) {
|
||||
dataSource.updateFolder(account.writeToken!!, folder.remoteId!!, folder.name!!)
|
||||
folder.remoteId = NewFreshRSSDataSource.FOLDER_PREFIX + folder.name
|
||||
folder.remoteId = FreshRSSDataSource.FOLDER_PREFIX + folder.name
|
||||
|
||||
super.updateFolder(folder)
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.readrops.app.repositories
|
|||
import com.readrops.api.services.Credentials
|
||||
import com.readrops.api.services.SyncResult
|
||||
import com.readrops.api.services.SyncType
|
||||
import com.readrops.api.services.nextcloudnews.NewNextcloudNewsDataSource
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsDataSource
|
||||
import com.readrops.api.services.nextcloudnews.NextcloudNewsSyncData
|
||||
import com.readrops.api.utils.AuthInterceptor
|
||||
import com.readrops.app.util.Utils
|
||||
|
@ -24,7 +24,7 @@ import org.koin.core.component.get
|
|||
class NextcloudNewsRepository(
|
||||
database: Database,
|
||||
account: Account,
|
||||
private val dataSource: NewNextcloudNewsDataSource,
|
||||
private val dataSource: NextcloudNewsDataSource,
|
||||
private val dispatcher: CoroutineDispatcher = Dispatchers.IO
|
||||
) : BaseRepository(database, account), KoinComponent {
|
||||
|
||||
|
|
Loading…
Reference in New Issue