Skip to content

Commit 1021690

Browse files
committed
Merge branch 'dev'
2 parents a53cad3 + 75afa02 commit 1021690

File tree

86 files changed

+60340
-903
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+60340
-903
lines changed

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<img src="https://img.shields.io/github/license/nsh07/wikireader?logo=gnu&color=blue&labelColor=1a1a1a">
2424
</a>
2525
<img src="https://img.shields.io/badge/API-26+-blue?logo=android&labelColor=1a1a1a">
26+
<br/><br/>
2627

2728
A lightweight Android app for reading Wikipedia articles distraction-free
2829

@@ -91,12 +92,32 @@ You can contribute to this project even if you are not a developer by helping in
9192
translating this project into languages you know.
9293

9394
<a href="https://hosted.weblate.org/engage/wikireader/">
94-
<img src="https://hosted.weblate.org/widget/wikireader/open-graph.png" alt="Translation status" width="400" />
95-
</a>
96-
<a href="https://hosted.weblate.org/engage/wikireader/">
97-
<img src="https://hosted.weblate.org/widget/wikireader/multi-auto.svg" alt="Translation statistics" />
95+
<img src="https://hosted.weblate.org/widget/wikireader/horizontal-auto.svg" alt="Translation status" />
9896
</a>
9997

98+
## Download
99+
100+
- **F-Droid** (recommended): WikiReader is available for download on the
101+
official [F-Droid app store repository](https://f-droid.org/). Updates on F-Droid are generally a
102+
week late. To get faster updates, you can download WikiReader from
103+
the [IzzyOnDroid repository](https://apt.izzysoft.de/fdroid/)
104+
- **Obtainium** (recommended): You can add this GitHub repository
105+
on [Obtainium](https://obtainium.imranr.dev/) to get updates directly from GitHub releases. This
106+
is the fastest way to install and update WikiReader.
107+
- **GitHub releases**: Alternatively, you can manually download and install APKs from
108+
the [Releases](https://github.com/nsh07/WikiReader/releases/latest) section of this repo (This
109+
method is not recommended, use Obtainium instead).
110+
111+
> [!TIP]
112+
> To [verify](https://developer.android.com/studio/command-line/apksigner#usage-verify) the APK
113+
> downloaded from Obtainium/GitHub, use the following signing certificate fingerprints:
114+
> ```
115+
> SHA1: B1:4E:17:93:11:E8:DB:D5:35:EF:8D:E9:FB:8F:FF:08:F8:EC:65:08
116+
> SHA256: 07:BE:F3:05:81:BA:EE:8F:45:EC:93:E4:7E:E6:8E:F2:08:74:E5:0E:F5:70:9C:78:B2:EE:67:AC:86:BE:4C:3D
117+
> ```
118+
> The SHA256 and MD5 hashes of the individual APK files are also available in the `checksum.txt`
119+
> file for each release.
120+
100121
## Special Thanks
101122
102123
- [Wikimedia Foundation](https://wikimediafoundation.org/): For

app/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/build
2-
release
1+
/build

app/build.gradle.kts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
alias(libs.plugins.jetbrains.kotlin.android)
44
alias(libs.plugins.jetbrains.compose.compiler)
55
alias(libs.plugins.jetbrains.kotlin.serialization)
6+
alias(libs.plugins.baselineprofile)
67
}
78

89
android {
@@ -13,8 +14,8 @@ android {
1314
applicationId = "org.nsh07.wikireader"
1415
minSdk = 26
1516
targetSdk = 36
16-
versionCode = 39
17-
versionName = "2.2.1"
17+
versionCode = 42
18+
versionName = "2.3.0"
1819

1920
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2021
vectorDrawables {
@@ -85,12 +86,14 @@ dependencies {
8586
implementation(libs.retrofit2.kotlinx.serialization.converter)
8687
implementation(libs.retrofit2.retrofit)
8788
implementation(libs.latex2unicode.x.x3)
89+
implementation(libs.androidx.profileinstaller)
8890

8991
testImplementation(libs.junit)
9092
androidTestImplementation(libs.androidx.junit)
9193
androidTestImplementation(libs.androidx.espresso.core)
9294
androidTestImplementation(platform(libs.androidx.compose.bom))
9395
androidTestImplementation(libs.androidx.ui.test.junit4)
96+
"baselineProfile"(project(":baselineprofile"))
9497
debugImplementation(libs.androidx.ui.tooling)
9598
debugImplementation(libs.androidx.ui.test.manifest)
9699
}

app/src/main/java/org/nsh07/wikireader/MainActivity.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ class MainActivity : ComponentActivity() {
2828

2929
override fun onCreate(savedInstanceState: Bundle?) {
3030
super.onCreate(savedInstanceState)
31-
viewModel.startAnimDuration()
32-
installSplashScreen().setKeepOnScreenCondition {
33-
!viewModel.isReady || !viewModel.isAnimDurationComplete
34-
}
31+
installSplashScreen().setKeepOnScreenCondition { !viewModel.isReady }
3532
viewModel.setFilesDir(filesDir.path)
3633
viewModel.migrateArticles()
3734
enableEdgeToEdge()
@@ -69,5 +66,6 @@ class MainActivity : ComponentActivity() {
6966
}
7067
}
7168
}
69+
reportFullyDrawn()
7270
}
7371
}

app/src/main/java/org/nsh07/wikireader/data/WikiApiPageData.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data class WikiApiPage(
1919
val extract: String? = null,
2020
@SerialName(value = "pageid") val pageId: Int? = null,
2121
@SerialName(value = "original") val photo: WikiPhoto? = null,
22-
@SerialName(value = "terms") val photoDesc: WikiPhotoDesc? = null,
22+
@SerialName(value = "description") val photoDesc: String? = null,
2323
@SerialName(value = "langlinks") val langs: List<WikiLang>? = null
2424
)
2525

@@ -30,12 +30,6 @@ data class WikiPhoto(
3030
val height: Int
3131
)
3232

33-
@Serializable
34-
data class WikiPhotoDesc(
35-
val label: List<String>? = null,
36-
val description: List<String>? = null
37-
)
38-
3933
@Serializable
4034
data class WikiLang(
4135
val lang: String,

app/src/main/java/org/nsh07/wikireader/network/WikipediaApiService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import retrofit2.http.Path
99
import retrofit2.http.Query
1010

1111
private const val API_QUERY =
12-
"w/api.php?format=json&action=query&prop=pageimages|pageterms|langlinks&piprop=original&pilicense=any&lllimit=max&redirects=1&formatversion=2&maxage=900&smaxage=900"
12+
"w/api.php?format=json&action=query&prop=pageimages|description|langlinks&piprop=original&pilicense=any&lllimit=max&redirects=1&formatversion=2&maxage=900&smaxage=900"
1313

1414
private const val CONTENT_QUERY =
1515
"wiki/{title}?action=raw&maxage=900&smaxage=900"

app/src/main/java/org/nsh07/wikireader/parser/cleanUpWikitext.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
package org.nsh07.wikireader.parser
22

33
/**
4-
* Remove parts of a Wikitext section that are not to be rendered
4+
* Remove/simplify parts of wikitext
55
*
66
* @param wikitext Source Wikitext to clean up
77
*/
88
fun cleanUpWikitext(wikitext: String): String {
99
return wikitext
10-
.replace(
11-
"<ref[^/]*?>.+?</ref>|<ref.*?/>".toRegex(RegexOption.DOT_MATCHES_ALL),
12-
""
13-
)
1410
.replace(
1511
"\\{\\{nobility table header.*?\\}\\}"
1612
.toRegex(setOf(RegexOption.IGNORE_CASE, RegexOption.DOT_MATCHES_ALL)),

app/src/main/java/org/nsh07/wikireader/parser/parseWikitable.kt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ fun parseWikitable(
5555
colorScheme,
5656
typography,
5757
loadPage,
58-
fontSize
58+
fontSize,
59+
showRef = {}
5960
)
6061
}
6162

@@ -110,7 +111,8 @@ fun parseWikitable(
110111
colorScheme,
111112
typography,
112113
loadPage,
113-
fontSize
114+
fontSize,
115+
showRef = {}
114116
)
115117
)
116118
repeat(colspan - 1) {
@@ -142,7 +144,8 @@ fun parseWikitable(
142144
colorScheme,
143145
typography,
144146
loadPage,
145-
fontSize
147+
fontSize,
148+
showRef = {}
146149
)
147150
)
148151
repeat(colspan - 1) {
@@ -185,7 +188,8 @@ fun parseWikitable(
185188
colorScheme,
186189
typography,
187190
loadPage,
188-
fontSize
191+
fontSize,
192+
showRef = {}
189193
)
190194
)
191195
}
@@ -221,7 +225,8 @@ fun parseWikitable(
221225
colorScheme,
222226
typography,
223227
loadPage,
224-
fontSize
228+
fontSize,
229+
showRef = {}
225230
)
226231
)
227232
}
@@ -238,7 +243,13 @@ fun parseWikitable(
238243
val lastIndex = currentRow.lastIndex
239244
if (lastIndex != -1)
240245
currentRow[lastIndex] += line.trim()
241-
.toWikitextAnnotatedString(colorScheme, typography, loadPage, fontSize)
246+
.toWikitextAnnotatedString(
247+
colorScheme,
248+
typography,
249+
loadPage,
250+
fontSize,
251+
showRef = {}
252+
)
242253
}
243254
}
244255
}

0 commit comments

Comments
 (0)