Compare commits
1 Commits
v124123651
...
6a36179171
Author | SHA1 | Date | |
---|---|---|---|
6a36179171 |
@ -3,7 +3,7 @@ on:
|
|||||||
workflow_call:
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
BuildAndTestAndCoverage:
|
BuildAndTest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
@ -17,18 +17,35 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
cache: gradle
|
cache: gradle
|
||||||
- uses: gradle/actions/setup-gradle@v3
|
- name: Setup Android SDK
|
||||||
- uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
- name: Configure gradle...
|
- name: Configure gradle...
|
||||||
run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true" >> ~/.gradle/gradle.properties
|
run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true" >> ~/.gradle/gradle.properties
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: ./gradlew build -x testReleaseUnitTest -x testDebugUnitTest -x testGithubConfigReleaseUnitTest -x testGithubConfigDebugUnitTest # These tests will be done
|
run: ./gradlew build -x testReleaseUnitTest -x testDebugUnitTest -x testGithubConfigReleaseUnitTest -x testGithubConfigDebugUnitTest # These tests will be done in the next step
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Fetch tags
|
||||||
|
run: git fetch --tags -p
|
||||||
- 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
|
- name: run selfoss
|
||||||
run: |
|
run: |
|
||||||
docker compose -f .gitea/workflows/assets/docker-compose.yml up -d
|
docker compose -f .gitea/workflows/assets/docker-compose.yml up -d
|
||||||
|
- uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '17'
|
||||||
|
cache: gradle
|
||||||
|
- uses: gradle/actions/setup-gradle@v3
|
||||||
|
- uses: android-actions/setup-android@v3
|
||||||
|
- name: Configure gradle...
|
||||||
|
run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true" >> ~/.gradle/gradle.properties
|
||||||
- name: coverage
|
- name: coverage
|
||||||
run: |
|
run: |
|
||||||
./gradlew :koverHtmlReport
|
./gradlew :koverHtmlReport
|
||||||
|
@ -52,7 +52,6 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.acra.ktx.sendSilentlyWithAcra
|
|
||||||
import org.kodein.di.DI
|
import org.kodein.di.DI
|
||||||
import org.kodein.di.DIAware
|
import org.kodein.di.DIAware
|
||||||
import org.kodein.di.android.x.closestDI
|
import org.kodein.di.android.x.closestDI
|
||||||
@ -104,12 +103,7 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
try {
|
try {
|
||||||
binding = FragmentArticleBinding.inflate(inflater, container, false)
|
binding = FragmentArticleBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
try {
|
url = item.getLinkDecoded()
|
||||||
url = item.getLinkDecoded()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
e.sendSilentlyWithAcra()
|
|
||||||
}
|
|
||||||
|
|
||||||
contentText = item.content
|
contentText = item.content
|
||||||
contentTitle = item.title.getHtmlDecoded()
|
contentTitle = item.title.getHtmlDecoded()
|
||||||
contentImage = item.getThumbnail(repository.baseUrl)
|
contentImage = item.getThumbnail(repository.baseUrl)
|
||||||
@ -163,7 +157,7 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
)
|
)
|
||||||
} catch (e: InflateException) {
|
} catch (e: InflateException) {
|
||||||
e.sendSilentlyWithAcraWithName("webview not available")
|
e.sendSilentlyWithAcraWithName("webview not available")
|
||||||
try {
|
if (context != null) {
|
||||||
AlertDialog.Builder(requireContext())
|
AlertDialog.Builder(requireContext())
|
||||||
.setMessage(requireContext().getString(R.string.webview_dialog_issue_message))
|
.setMessage(requireContext().getString(R.string.webview_dialog_issue_message))
|
||||||
.setTitle(requireContext().getString(R.string.webview_dialog_issue_title))
|
.setTitle(requireContext().getString(R.string.webview_dialog_issue_title))
|
||||||
@ -175,8 +169,6 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
}
|
}
|
||||||
.create()
|
.create()
|
||||||
.show()
|
.show()
|
||||||
} catch (e: IllegalStateException) {
|
|
||||||
e.sendSilentlyWithAcraWithName("Context required is null")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,14 +218,14 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
R.id.share_action -> requireActivity().shareLink(url, contentTitle)
|
R.id.share_action -> requireActivity().shareLink(url, contentTitle)
|
||||||
R.id.open_action -> requireActivity().openItemUrlInBrowserAsNewTask(this@ArticleFragment.item)
|
R.id.open_action -> requireActivity().openItemUrlInBrowserAsNewTask(this@ArticleFragment.item)
|
||||||
R.id.unread_action ->
|
R.id.unread_action ->
|
||||||
try {
|
if (context != null) {
|
||||||
if (this@ArticleFragment.item.unread) {
|
if (this@ArticleFragment.item.unread) {
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
repository.markAsRead(this@ArticleFragment.item)
|
repository.markAsRead(this@ArticleFragment.item)
|
||||||
}
|
}
|
||||||
this@ArticleFragment.item.unread = false
|
this@ArticleFragment.item.unread = false
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
requireContext(),
|
context,
|
||||||
R.string.marked_as_read,
|
R.string.marked_as_read,
|
||||||
Toast.LENGTH_LONG,
|
Toast.LENGTH_LONG,
|
||||||
).show()
|
).show()
|
||||||
@ -248,8 +240,6 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
Toast.LENGTH_LONG,
|
Toast.LENGTH_LONG,
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
} catch (e: IllegalStateException) {
|
|
||||||
e.sendSilentlyWithAcraWithName("Context required is null")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> Unit
|
else -> Unit
|
||||||
@ -399,7 +389,7 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun htmlToWebview() {
|
private fun htmlToWebview() {
|
||||||
try {
|
if (context != null) {
|
||||||
val attrs: IntArray = intArrayOf(android.R.attr.fontFamily)
|
val attrs: IntArray = intArrayOf(android.R.attr.fontFamily)
|
||||||
val a: TypedArray = requireContext().obtainStyledAttributes(resId, attrs)
|
val a: TypedArray = requireContext().obtainStyledAttributes(resId, attrs)
|
||||||
|
|
||||||
@ -544,8 +534,6 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
"utf-8",
|
"utf-8",
|
||||||
null,
|
null,
|
||||||
)
|
)
|
||||||
} catch (e: IllegalStateException) {
|
|
||||||
e.sendSilentlyWithAcraWithName("Context required is null")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,10 +549,10 @@ class ArticleFragment : Fragment(), DIAware {
|
|||||||
|
|
||||||
private fun openInBrowserAfterFailing() {
|
private fun openInBrowserAfterFailing() {
|
||||||
binding.progressBar.visibility = View.GONE
|
binding.progressBar.visibility = View.GONE
|
||||||
try {
|
if (context != null) {
|
||||||
requireContext().openItemUrlInBrowserAsNewTask(this@ArticleFragment.item)
|
requireContext().openItemUrlInBrowserAsNewTask(this@ArticleFragment.item)
|
||||||
} catch (e: IllegalStateException) {
|
} else {
|
||||||
e.sendSilentlyWithAcraWithName("Context required is null")
|
Exception("openInBrowserAfterFailing context is null").sendSilentlyWithAcraWithName("openInBrowserAfterFailing > $context")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,17 +52,19 @@ class FilterSheetFragment : BottomSheetDialogFragment(), DIAware {
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
val context: Context? = context
|
||||||
|
|
||||||
|
if (context == null) {
|
||||||
|
dismiss()
|
||||||
|
Exception("FilterSheetFragment context is null").sendSilentlyWithAcraWithName("FilterSheetFragment > onCreateView")
|
||||||
|
} else {
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
handleTagChips(requireContext())
|
handleTagChips(context)
|
||||||
handleSourceChips(requireContext())
|
handleSourceChips(context)
|
||||||
|
|
||||||
binding.progressBar2.visibility = GONE
|
binding.progressBar2.visibility = GONE
|
||||||
binding.filterView.visibility = VISIBLE
|
binding.filterView.visibility = VISIBLE
|
||||||
}
|
}
|
||||||
} catch (e: IllegalStateException) {
|
|
||||||
dismiss()
|
|
||||||
e.sendSilentlyWithAcraWithName("FilterSheetFragment > onCreateView")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.floatingActionButton2.setOnClickListener {
|
binding.floatingActionButton2.setOnClickListener {
|
||||||
|
@ -3,4 +3,11 @@ files:
|
|||||||
translation: /androidApp/src/main/res/values-%android_code%/%original_file_name%
|
translation: /androidApp/src/main/res/values-%android_code%/%original_file_name%
|
||||||
translate_attributes: '0'
|
translate_attributes: '0'
|
||||||
content_segmentation: '0'
|
content_segmentation: '0'
|
||||||
|
translation_replace": {
|
||||||
|
"/master/app": "/androidApp",
|
||||||
|
"/master/androidApp": "/androidApp"
|
||||||
|
}
|
||||||
|
"ignore": [
|
||||||
|
"/gl/**"
|
||||||
|
]
|
||||||
preserve_hierarchy: true
|
preserve_hierarchy: true
|
@ -2,7 +2,6 @@ package bou.amine.apps.readerforselfossv2.model
|
|||||||
|
|
||||||
import bou.amine.apps.readerforselfossv2.utils.DateUtils
|
import bou.amine.apps.readerforselfossv2.utils.DateUtils
|
||||||
import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded
|
import bou.amine.apps.readerforselfossv2.utils.getHtmlDecoded
|
||||||
import bou.amine.apps.readerforselfossv2.utils.isEmptyOrNullOrNullString
|
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||||
@ -11,12 +10,7 @@ import kotlinx.serialization.descriptors.SerialDescriptor
|
|||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
import kotlinx.serialization.encoding.encodeCollection
|
import kotlinx.serialization.encoding.encodeCollection
|
||||||
import kotlinx.serialization.json.JsonArray
|
import kotlinx.serialization.json.*
|
||||||
import kotlinx.serialization.json.JsonDecoder
|
|
||||||
import kotlinx.serialization.json.boolean
|
|
||||||
import kotlinx.serialization.json.booleanOrNull
|
|
||||||
import kotlinx.serialization.json.int
|
|
||||||
import kotlinx.serialization.json.jsonPrimitive
|
|
||||||
|
|
||||||
class SelfossModel {
|
class SelfossModel {
|
||||||
@Serializable
|
@Serializable
|
||||||
@ -140,10 +134,6 @@ class SelfossModel {
|
|||||||
stringUrl = "http:$stringUrl"
|
stringUrl = "http:$stringUrl"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stringUrl.isEmptyOrNullOrNullString()) {
|
|
||||||
throw Exception("Link ${link} was translated to ${stringUrl}, but was empty. Handle this.")
|
|
||||||
}
|
|
||||||
|
|
||||||
return stringUrl
|
return stringUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,10 +176,7 @@ class SelfossModel {
|
|||||||
encoder: Encoder,
|
encoder: Encoder,
|
||||||
value: List<String>,
|
value: List<String>,
|
||||||
) {
|
) {
|
||||||
encoder.encodeCollection(
|
encoder.encodeCollection(PrimitiveSerialDescriptor("tags", PrimitiveKind.STRING), value.size) { this.toString() }
|
||||||
PrimitiveSerialDescriptor("tags", PrimitiveKind.STRING),
|
|
||||||
value.size
|
|
||||||
) { this.toString() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,10 +191,7 @@ class SelfossModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override val descriptor: SerialDescriptor
|
override val descriptor: SerialDescriptor
|
||||||
get() = PrimitiveSerialDescriptor(
|
get() = PrimitiveSerialDescriptor("BooleanOrIntForSomeSelfossVersions", PrimitiveKind.BOOLEAN)
|
||||||
"BooleanOrIntForSomeSelfossVersions",
|
|
||||||
PrimitiveKind.BOOLEAN
|
|
||||||
)
|
|
||||||
|
|
||||||
override fun serialize(
|
override fun serialize(
|
||||||
encoder: Encoder,
|
encoder: Encoder,
|
||||||
@ -216,4 +200,4 @@ class SelfossModel {
|
|||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user