-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added displaying the list of OPDS server entries [#3]
* Added dependency on Napier for logging. * Bumped JDK to 17.
- Loading branch information
Showing
6 changed files
with
189 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
composeApp/src/commonMain/kotlin/org/comixedproject/variant/model/OPDSServerEntry.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Variant - A digital comic book reading application for iPad, Android, and desktops. | ||
* Copyright (C) 2023, The ComiXed Project | ||
* | ||
* This program 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. | ||
* | ||
* This program 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. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
package org.comixedproject.variant.model; | ||
|
||
/** | ||
* <code>OPDSServerEntry</code> represents a single OPDS server. | ||
* | ||
* @author Darryl L. Pierce | ||
*/ | ||
data class OPDSServerEntry(val name: String, val url: String, val username: String, val password: String) { | ||
} |
95 changes: 95 additions & 0 deletions
95
...seApp/src/commonMain/kotlin/org/comixedproject/variant/repository/OPDSServerRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Variant - A digital comic book reading application for iPad, Android, and desktops. | ||
* Copyright (C) 2023, The ComiXed Project | ||
* | ||
* This program 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. | ||
* | ||
* This program 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. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
package org.comixedproject.variant.repository; | ||
|
||
import io.github.aakira.napier.Napier | ||
import org.comixedproject.variant.model.OPDSServerEntry | ||
|
||
/** | ||
* <code>OPDSServerRepository</code> provides methods for storing and retrieving instanes of {@link OPDSServerEntry}. | ||
* | ||
* @author Darryl L. Pierce | ||
*/ | ||
class OPDSServerRepository { | ||
fun getAllEntries(): List<OPDSServerEntry> { | ||
Napier.d { "Loading the list of server entries" } | ||
return listOf( | ||
OPDSServerEntry( | ||
"First Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Second Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Third Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Fourth Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Fifth Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Sixth Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Seventh Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Eighth Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Ninth Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
), | ||
OPDSServerEntry( | ||
"Tenth Entry", | ||
"http://localhost:7171/opds", | ||
"comixedreader@localhost", | ||
"comixedreader" | ||
) | ||
); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...p/src/commonTest/kotlin/org.comixedproject.variant.repository/OPDSServerRepositoryTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Variant - A digital comic book reading application for iPad, Android, and desktops. | ||
* Copyright (C) 2023, The ComiXed Project | ||
* | ||
* This program 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. | ||
* | ||
* This program 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. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses> | ||
*/ | ||
|
||
package org.comixedproject.variant.repository; | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertFalse | ||
import kotlin.test.assertNotNull | ||
|
||
class OPDSServerRepositoryTest { | ||
|
||
@Test fun testGetAllEntries() { | ||
val result = OPDSServerRepository().getAllEntries() | ||
|
||
assertNotNull(result) | ||
assertFalse(result.isEmpty()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters