Compare commits
11 Commits
7a0202689f
...
v125020581
Author | SHA1 | Date | |
---|---|---|---|
a90ccec707 | |||
2564b19726 | |||
61c7bb20cc | |||
6a0f5baf0a | |||
39f9505c00 | |||
6a6d447456 | |||
0bb4fe6aed | |||
7df4c3368c | |||
c69635b5ae | |||
3a829df70e | |||
b20f6888f5 |
@ -26,9 +26,10 @@ jobs:
|
|||||||
- uses: KengoTODA/actions-setup-docker-compose@v1
|
- uses: KengoTODA/actions-setup-docker-compose@v1
|
||||||
with:
|
with:
|
||||||
version: "2.23.3"
|
version: "2.23.3"
|
||||||
- name: run selfoss
|
# TESTS ARE RUN LOCALLY
|
||||||
run: |
|
# - name: run selfoss
|
||||||
docker compose -f .gitea/workflows/assets/docker-compose.yml up -d
|
# run: |
|
||||||
|
# docker compose -f .gitea/workflows/assets/docker-compose.yml up -d
|
||||||
- name: coverage
|
- name: coverage
|
||||||
run: |
|
run: |
|
||||||
./gradlew :koverHtmlReport
|
./gradlew :koverHtmlReport
|
||||||
@ -39,7 +40,8 @@ jobs:
|
|||||||
retention-days: 1
|
retention-days: 1
|
||||||
overwrite: true
|
overwrite: true
|
||||||
include-hidden-files: true
|
include-hidden-files: true
|
||||||
- name: Clean
|
# TESTS ARE RUN LOCALLY
|
||||||
if: always()
|
# - name: Clean
|
||||||
run: |
|
# if: always()
|
||||||
docker compose -f .gitea/workflows/assets/docker-compose.yml stop
|
# run: |
|
||||||
|
# docker compose -f .gitea/workflows/assets/docker-compose.yml stop
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -323,4 +323,6 @@ fabric.properties
|
|||||||
crowdin.properties
|
crowdin.properties
|
||||||
|
|
||||||
.kotlin/
|
.kotlin/
|
||||||
build-cache/
|
build-cache/
|
||||||
|
|
||||||
|
act
|
||||||
|
20
CHANGELOG.md
20
CHANGELOG.md
@ -1,3 +1,23 @@
|
|||||||
|
**v125020471
|
||||||
|
|
||||||
|
- chore: no more docker-compose.
|
||||||
|
- bump: gradle plugin.
|
||||||
|
- Merge pull request 'fix: check index exists.' (#183) from fix-index into master
|
||||||
|
- fix: check index exists.
|
||||||
|
- Changelog for v125020411
|
||||||
|
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
**v125020411
|
||||||
|
|
||||||
|
- Merge pull request 'bump' (#182) from bump into master
|
||||||
|
- chore: non transiant R classes.
|
||||||
|
- Merge pull request 'fix: One more missing context.' (#181) from fix-one-more-context into master
|
||||||
|
- bump
|
||||||
|
- fix: One more missing context.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
**v125010241
|
**v125010241
|
||||||
|
|
||||||
- Merge pull request 'fix: Link not opening.' (#178) from fix-open-link into master
|
- Merge pull request 'fix: Link not opening.' (#178) from fix-open-link into master
|
||||||
|
@ -56,7 +56,7 @@ class HomeActivityTest {
|
|||||||
fun testMenuActions() {
|
fun testMenuActions() {
|
||||||
onView(withId(R.id.action_search)).perform(click())
|
onView(withId(R.id.action_search)).perform(click())
|
||||||
onView(
|
onView(
|
||||||
withId(R.id.search_src_text),
|
withId(com.google.android.material.R.id.search_src_text),
|
||||||
).check(matches(isFocused()))
|
).check(matches(isFocused()))
|
||||||
onView(isRoot()).perform(ViewActions.pressBack())
|
onView(isRoot()).perform(ViewActions.pressBack())
|
||||||
|
|
||||||
|
@ -161,12 +161,14 @@ class ReaderActivity :
|
|||||||
override fun onPageSelected(position: Int) {
|
override fun onPageSelected(position: Int) {
|
||||||
super.onPageSelected(position)
|
super.onPageSelected(position)
|
||||||
|
|
||||||
if (allItems[position].starred) {
|
if (!allItems.isNullOrEmpty() && allItems.size >= position) {
|
||||||
canRemoveFromFavorite()
|
if (allItems[position].starred) {
|
||||||
} else {
|
canRemoveFromFavorite()
|
||||||
canFavorite()
|
} else {
|
||||||
|
canFavorite()
|
||||||
|
}
|
||||||
|
readItem(allItems[position])
|
||||||
}
|
}
|
||||||
readItem(allItems[position])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
@ -75,7 +75,7 @@ class ArticleFragment :
|
|||||||
private var colorSurface: Int = 0
|
private var colorSurface: Int = 0
|
||||||
private var fontSize: Int = DEFAULT_FONT_SIZE
|
private var fontSize: Int = DEFAULT_FONT_SIZE
|
||||||
private lateinit var item: SelfossModel.Item
|
private lateinit var item: SelfossModel.Item
|
||||||
private lateinit var url: String
|
private var url: String? = null
|
||||||
private lateinit var contentText: String
|
private lateinit var contentText: String
|
||||||
private lateinit var contentSource: String
|
private lateinit var contentSource: String
|
||||||
private lateinit var contentImage: String
|
private lateinit var contentImage: String
|
||||||
@ -118,8 +118,8 @@ class ArticleFragment :
|
|||||||
e.sendSilentlyWithAcra()
|
e.sendSilentlyWithAcra()
|
||||||
}
|
}
|
||||||
|
|
||||||
colorOnSurface = getColorFromAttr(R.attr.colorOnSurface)
|
colorOnSurface = getColorFromAttr(com.google.android.material.R.attr.colorOnSurface)
|
||||||
colorSurface = getColorFromAttr(R.attr.colorSurface)
|
colorSurface = getColorFromAttr(com.google.android.material.R.attr.colorSurface)
|
||||||
|
|
||||||
contentText = item.content
|
contentText = item.content
|
||||||
contentTitle = item.title.getHtmlDecoded()
|
contentTitle = item.title.getHtmlDecoded()
|
||||||
@ -168,8 +168,8 @@ class ArticleFragment :
|
|||||||
|
|
||||||
private fun handleContent() {
|
private fun handleContent() {
|
||||||
if (contentText.isEmptyOrNullOrNullString()) {
|
if (contentText.isEmptyOrNullOrNullString()) {
|
||||||
if (repository.isNetworkAvailable()) {
|
if (repository.isNetworkAvailable() && url.isUrlValid()) {
|
||||||
getContentFromMercury()
|
getContentFromMercury(url!!)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.titleView.text = contentTitle
|
binding.titleView.text = contentTitle
|
||||||
@ -271,7 +271,7 @@ class ArticleFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("detekt:SwallowedException")
|
@Suppress("detekt:SwallowedException")
|
||||||
private fun getContentFromMercury() {
|
private fun getContentFromMercury(url: String) {
|
||||||
binding.progressBar.visibility = View.VISIBLE
|
binding.progressBar.visibility = View.VISIBLE
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
@ -424,10 +424,10 @@ class ArticleFragment :
|
|||||||
|
|
||||||
var baseUrl: String? = null
|
var baseUrl: String? = null
|
||||||
try {
|
try {
|
||||||
val itemUrl = URL(url)
|
val itemUrl = URL(url.orEmpty())
|
||||||
baseUrl = itemUrl.protocol + "://" + itemUrl.host
|
baseUrl = itemUrl.protocol + "://" + itemUrl.host
|
||||||
} catch (e: MalformedURLException) {
|
} catch (e: MalformedURLException) {
|
||||||
e.sendSilentlyWithAcraWithName("htmlToWebview > $url")
|
e.sendSilentlyWithAcraWithName("htmlToWebview > ${url.orEmpty()}")
|
||||||
}
|
}
|
||||||
|
|
||||||
val fontName: String =
|
val fontName: String =
|
||||||
|
@ -83,7 +83,15 @@ class FilterSheetFragment :
|
|||||||
val sourceGroup = binding.sourcesGroup
|
val sourceGroup = binding.sourcesGroup
|
||||||
|
|
||||||
repository.getSourcesDetailsOrStats().forEachIndexed { _, source ->
|
repository.getSourcesDetailsOrStats().forEachIndexed { _, source ->
|
||||||
val c = Chip(context)
|
val c: Chip? =
|
||||||
|
maybeIfContext {
|
||||||
|
Chip(it)
|
||||||
|
} as Chip?
|
||||||
|
|
||||||
|
if (c == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c.ellipsize = TextUtils.TruncateAt.END
|
c.ellipsize = TextUtils.TruncateAt.END
|
||||||
|
|
||||||
maybeIfContext {
|
maybeIfContext {
|
||||||
@ -145,7 +153,11 @@ class FilterSheetFragment :
|
|||||||
val tags = repository.getTags()
|
val tags = repository.getTags()
|
||||||
|
|
||||||
tags.forEachIndexed { _, tag ->
|
tags.forEachIndexed { _, tag ->
|
||||||
val c = Chip(context)
|
val c: Chip? = maybeIfContext { Chip(it) } as Chip?
|
||||||
|
if (c == null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
c.ellipsize = TextUtils.TruncateAt.END
|
c.ellipsize = TextUtils.TruncateAt.END
|
||||||
c.text = tag.tag
|
c.text = tag.tag
|
||||||
|
|
||||||
|
@ -11,22 +11,24 @@ import bou.amine.apps.readerforselfossv2.android.utils.acra.sendSilentlyWithAcra
|
|||||||
import bou.amine.apps.readerforselfossv2.utils.toStringUriWithHttp
|
import bou.amine.apps.readerforselfossv2.utils.toStringUriWithHttp
|
||||||
|
|
||||||
fun Context.shareLink(
|
fun Context.shareLink(
|
||||||
itemUrl: String,
|
itemUrl: String?,
|
||||||
itemTitle: String,
|
itemTitle: String,
|
||||||
) {
|
) {
|
||||||
val sendIntent = Intent()
|
if (itemUrl.isUrlValid()) {
|
||||||
sendIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
val sendIntent = Intent()
|
||||||
sendIntent.action = Intent.ACTION_SEND
|
sendIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
sendIntent.putExtra(Intent.EXTRA_TEXT, itemUrl.toStringUriWithHttp())
|
sendIntent.action = Intent.ACTION_SEND
|
||||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, itemTitle)
|
sendIntent.putExtra(Intent.EXTRA_TEXT, itemUrl!!.toStringUriWithHttp())
|
||||||
sendIntent.type = "text/plain"
|
sendIntent.putExtra(Intent.EXTRA_SUBJECT, itemTitle)
|
||||||
startActivity(
|
sendIntent.type = "text/plain"
|
||||||
Intent
|
startActivity(
|
||||||
.createChooser(
|
Intent
|
||||||
sendIntent,
|
.createChooser(
|
||||||
getString(R.string.share),
|
sendIntent,
|
||||||
).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
getString(R.string.share),
|
||||||
)
|
).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
|
@ -15,12 +15,12 @@ import android.widget.Toast
|
|||||||
import bou.amine.apps.readerforselfossv2.android.R
|
import bou.amine.apps.readerforselfossv2.android.R
|
||||||
import bou.amine.apps.readerforselfossv2.android.ReaderActivity
|
import bou.amine.apps.readerforselfossv2.android.ReaderActivity
|
||||||
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
import bou.amine.apps.readerforselfossv2.model.SelfossModel
|
||||||
import bou.amine.apps.readerforselfossv2.utils.toStringUriWithHttp
|
import bou.amine.apps.readerforselfossv2.utils.isEmptyOrNullOrNullString
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
|
|
||||||
fun Context.openItemUrl(
|
fun Context.openItemUrl(
|
||||||
currentItem: Int,
|
currentItem: Int,
|
||||||
linkDecoded: String,
|
linkDecoded: String?,
|
||||||
articleViewer: Boolean,
|
articleViewer: Boolean,
|
||||||
app: Activity,
|
app: Activity,
|
||||||
) {
|
) {
|
||||||
@ -37,12 +37,13 @@ fun Context.openItemUrl(
|
|||||||
intent.putExtra("currentItem", currentItem)
|
intent.putExtra("currentItem", currentItem)
|
||||||
app.startActivity(intent)
|
app.startActivity(intent)
|
||||||
} else {
|
} else {
|
||||||
this.openUrlInBrowserAsNewTask(linkDecoded)
|
this.openUrlInBrowserAsNewTask(linkDecoded!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun String.isUrlValid(): Boolean = this.toHttpUrlOrNull() != null && Patterns.WEB_URL.matcher(this).matches()
|
fun String?.isUrlValid(): Boolean =
|
||||||
|
!this.isEmptyOrNullOrNullString() && this!!.toHttpUrlOrNull() != null && Patterns.WEB_URL.matcher(this).matches()
|
||||||
|
|
||||||
fun String.isBaseUrlInvalid(): Boolean {
|
fun String.isBaseUrlInvalid(): Boolean {
|
||||||
val baseUrl = this.toHttpUrlOrNull()
|
val baseUrl = this.toHttpUrlOrNull()
|
||||||
@ -56,14 +57,16 @@ fun String.isBaseUrlInvalid(): Boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Context.openItemUrlInBrowserAsNewTask(i: SelfossModel.Item) {
|
fun Context.openItemUrlInBrowserAsNewTask(i: SelfossModel.Item) {
|
||||||
this.openUrlInBrowserAsNewTask(i.getLinkDecoded().toStringUriWithHttp())
|
this.openUrlInBrowserAsNewTask(i.getLinkDecoded())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.openUrlInBrowserAsNewTask(url: String) {
|
fun Context.openUrlInBrowserAsNewTask(url: String?) {
|
||||||
val intent = Intent(Intent.ACTION_VIEW)
|
if (url.isUrlValid()) {
|
||||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
val intent = Intent(Intent.ACTION_VIEW)
|
||||||
intent.data = Uri.parse(url)
|
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
this.mayBeStartActivity(intent)
|
intent.data = Uri.parse(url)
|
||||||
|
this.mayBeStartActivity(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.openUrlInBrowser(url: String) {
|
fun Context.openUrlInBrowser(url: String) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
// trick: for the same plugin versions in all sub-modules
|
// trick: for the same plugin versions in all sub-modules
|
||||||
id("com.android.application").version("8.8.0").apply(false)
|
id("com.android.application").version("8.8.1").apply(false)
|
||||||
id("com.android.library").version("8.8.0").apply(false)
|
id("com.android.library").version("8.8.1").apply(false)
|
||||||
id("org.jetbrains.kotlin.android").version("2.1.0").apply(false)
|
id("org.jetbrains.kotlin.android").version("2.1.0").apply(false)
|
||||||
kotlin("multiplatform").version("2.1.0").apply(false)
|
kotlin("multiplatform").version("2.1.0").apply(false)
|
||||||
id("com.mikepenz.aboutlibraries.plugin").version("10.5.1").apply(false)
|
id("com.mikepenz.aboutlibraries.plugin").version("10.5.1").apply(false)
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
**v125020411**
|
||||||
|
|
||||||
|
- Merge pull request 'bump' (#182) from bump into master
|
||||||
|
- chore: non transiant R classes.
|
||||||
|
- Merge pull request 'fix: One more missing context.' (#181) from fix-one-more-context into master
|
||||||
|
- bump
|
||||||
|
- fix: One more missing context.
|
@ -0,0 +1,7 @@
|
|||||||
|
**v125020471**
|
||||||
|
|
||||||
|
- chore: no more docker-compose.
|
||||||
|
- bump: gradle plugin.
|
||||||
|
- Merge pull request 'fix: check index exists.' (#183) from fix-index into master
|
||||||
|
- fix: check index exists.
|
||||||
|
- Changelog for v125020411
|
@ -19,11 +19,11 @@ kotlin.code.style=official
|
|||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
#android.nonTransitiveRClass=true
|
#android.nonTransitiveRClass=true
|
||||||
android.enableJetifier=false
|
android.enableJetifier=false
|
||||||
android.nonTransitiveRClass=false
|
android.nonTransitiveRClass=true
|
||||||
#MPP
|
#MPP
|
||||||
kotlin.mpp.enableCInteropCommonization=true
|
kotlin.mpp.enableCInteropCommonization=true
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
ignoreGitVersion=false
|
ignoreGitVersion=false
|
||||||
kotlin.native.cacheKind.iosX64=none
|
kotlin.native.cacheKind.iosX64=none
|
||||||
org.gradle.configureondemand=true
|
org.gradle.configureondemand=true
|
||||||
|
@ -127,8 +127,8 @@ class SelfossModel {
|
|||||||
val tags: List<String>,
|
val tags: List<String>,
|
||||||
val author: String? = null,
|
val author: String? = null,
|
||||||
) {
|
) {
|
||||||
fun getLinkDecoded(): String {
|
fun getLinkDecoded(): String? {
|
||||||
var stringUrl: String
|
var stringUrl: String?
|
||||||
stringUrl =
|
stringUrl =
|
||||||
if (link.contains("//news.google.com/news/") && link.contains("&url=")) {
|
if (link.contains("//news.google.com/news/") && link.contains("&url=")) {
|
||||||
link.substringAfter("&url=")
|
link.substringAfter("&url=")
|
||||||
@ -146,11 +146,7 @@ class SelfossModel {
|
|||||||
stringUrl = "http:$stringUrl"
|
stringUrl = "http:$stringUrl"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stringUrl.isEmptyOrNullOrNullString()) {
|
return if (stringUrl.isEmptyOrNullOrNullString()) null else stringUrl
|
||||||
throw ModelException("Link $link was translated to $stringUrl, but was empty. Handle this.")
|
|
||||||
}
|
|
||||||
|
|
||||||
return stringUrl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun sourceAuthorAndDate(): String {
|
fun sourceAuthorAndDate(): String {
|
||||||
|
Reference in New Issue
Block a user