Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
557c2b018a | ||
|
|
3add01d57e | ||
|
|
2ad1ea98f1 |
@@ -14,8 +14,8 @@ android {
|
|||||||
applicationId 'org.koitharu.kotatsu'
|
applicationId 'org.koitharu.kotatsu'
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 32
|
targetSdkVersion 32
|
||||||
versionCode 413
|
versionCode 414
|
||||||
versionName '3.4.1'
|
versionName '3.4.2'
|
||||||
generatedDensities = []
|
generatedDensities = []
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
@@ -76,8 +76,7 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
implementation('com.github.nv95:kotatsu-parsers:26d951bc20') {
|
||||||
implementation('com.github.nv95:kotatsu-parsers:8c26f3c790') {
|
|
||||||
exclude group: 'org.json', module: 'json'
|
exclude group: 'org.json', module: 'json'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.google.android.material.snackbar.Snackbar
|
|||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.google.android.material.tabs.TabLayoutMediator
|
import com.google.android.material.tabs.TabLayoutMediator
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.acra.ktx.sendWithAcra
|
|
||||||
import org.koin.android.ext.android.get
|
import org.koin.android.ext.android.get
|
||||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
import org.koin.core.parameter.parametersOf
|
import org.koin.core.parameter.parametersOf
|
||||||
@@ -39,7 +38,6 @@ import org.koitharu.kotatsu.core.os.ShortcutsRepository
|
|||||||
import org.koitharu.kotatsu.databinding.ActivityDetailsBinding
|
import org.koitharu.kotatsu.databinding.ActivityDetailsBinding
|
||||||
import org.koitharu.kotatsu.details.ui.adapter.BranchesAdapter
|
import org.koitharu.kotatsu.details.ui.adapter.BranchesAdapter
|
||||||
import org.koitharu.kotatsu.download.ui.service.DownloadService
|
import org.koitharu.kotatsu.download.ui.service.DownloadService
|
||||||
import org.koitharu.kotatsu.parsers.exception.ParseException
|
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import org.koitharu.kotatsu.parsers.model.MangaSource
|
import org.koitharu.kotatsu.parsers.model.MangaSource
|
||||||
import org.koitharu.kotatsu.parsers.util.mapNotNullToSet
|
import org.koitharu.kotatsu.parsers.util.mapNotNullToSet
|
||||||
@@ -48,6 +46,8 @@ import org.koitharu.kotatsu.reader.ui.ReaderState
|
|||||||
import org.koitharu.kotatsu.scrobbling.ui.selector.ScrobblingSelectorBottomSheet
|
import org.koitharu.kotatsu.scrobbling.ui.selector.ScrobblingSelectorBottomSheet
|
||||||
import org.koitharu.kotatsu.search.ui.multi.MultiSearchActivity
|
import org.koitharu.kotatsu.search.ui.multi.MultiSearchActivity
|
||||||
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
import org.koitharu.kotatsu.utils.ext.getDisplayMessage
|
||||||
|
import org.koitharu.kotatsu.utils.ext.isReportable
|
||||||
|
import org.koitharu.kotatsu.utils.ext.report
|
||||||
|
|
||||||
class DetailsActivity :
|
class DetailsActivity :
|
||||||
BaseActivity<ActivityDetailsBinding>(),
|
BaseActivity<ActivityDetailsBinding>(),
|
||||||
@@ -118,7 +118,7 @@ class DetailsActivity :
|
|||||||
Toast.makeText(this, e.getDisplayMessage(resources), Toast.LENGTH_LONG).show()
|
Toast.makeText(this, e.getDisplayMessage(resources), Toast.LENGTH_LONG).show()
|
||||||
finishAfterTransition()
|
finishAfterTransition()
|
||||||
}
|
}
|
||||||
e is ParseException || e is IllegalArgumentException || e is IllegalStateException -> {
|
e.isReportable() -> {
|
||||||
binding.snackbar.show(
|
binding.snackbar.show(
|
||||||
messageText = e.getDisplayMessage(resources),
|
messageText = e.getDisplayMessage(resources),
|
||||||
actionId = R.string.report,
|
actionId = R.string.report,
|
||||||
@@ -128,7 +128,7 @@ class DetailsActivity :
|
|||||||
Snackbar.LENGTH_LONG
|
Snackbar.LENGTH_LONG
|
||||||
},
|
},
|
||||||
onActionClick = {
|
onActionClick = {
|
||||||
e.sendWithAcra()
|
e.report("DetailsActivity::onError")
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.view.View
|
|||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.ensureActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
@@ -74,11 +75,15 @@ class SourceSettingsFragment : BasePreferenceFragment(0) {
|
|||||||
when {
|
when {
|
||||||
error is AuthRequiredException -> Unit
|
error is AuthRequiredException -> Unit
|
||||||
ExceptionResolver.canResolve(error) -> {
|
ExceptionResolver.canResolve(error) -> {
|
||||||
Snackbar.make(listView, error.getDisplayMessage(resources), Snackbar.LENGTH_INDEFINITE)
|
ensureActive()
|
||||||
.setAction(ExceptionResolver.getResolveStringId(error)) { resolveError(error) }
|
Snackbar.make(
|
||||||
|
listView ?: return@onFailure,
|
||||||
|
error.getDisplayMessage(preference.context.resources),
|
||||||
|
Snackbar.LENGTH_INDEFINITE,
|
||||||
|
).setAction(ExceptionResolver.getResolveStringId(error)) { resolveError(error) }
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
else -> preference.summary = error.getDisplayMessage(resources)
|
else -> preference.summary = error.getDisplayMessage(preference.context.resources)
|
||||||
}
|
}
|
||||||
error.printStackTraceDebug()
|
error.printStackTraceDebug()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import android.content.ActivityNotFoundException
|
|||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import okio.FileNotFoundException
|
import okio.FileNotFoundException
|
||||||
import org.acra.ACRA
|
import org.acra.ACRA
|
||||||
|
import org.acra.ktx.sendWithAcra
|
||||||
import org.koitharu.kotatsu.R
|
import org.koitharu.kotatsu.R
|
||||||
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
|
import org.koitharu.kotatsu.core.exceptions.CloudFlareProtectedException
|
||||||
import org.koitharu.kotatsu.core.exceptions.EmptyHistoryException
|
import org.koitharu.kotatsu.core.exceptions.EmptyHistoryException
|
||||||
import org.koitharu.kotatsu.core.exceptions.UnsupportedFileException
|
import org.koitharu.kotatsu.core.exceptions.UnsupportedFileException
|
||||||
import org.koitharu.kotatsu.core.exceptions.WrongPasswordException
|
import org.koitharu.kotatsu.core.exceptions.WrongPasswordException
|
||||||
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
import org.koitharu.kotatsu.parsers.exception.AuthRequiredException
|
||||||
|
import org.koitharu.kotatsu.parsers.exception.ParseException
|
||||||
import org.koitharu.kotatsu.parsers.model.Manga
|
import org.koitharu.kotatsu.parsers.model.Manga
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
|
|
||||||
@@ -26,4 +28,17 @@ fun Throwable.getDisplayMessage(resources: Resources) = when (this) {
|
|||||||
else -> localizedMessage ?: resources.getString(R.string.error_occurred)
|
else -> localizedMessage ?: resources.getString(R.string.error_occurred)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ACRA.setCurrentManga(manga: Manga?) = errorReporter.putCustomData("manga", manga?.publicUrl.toString())
|
fun Throwable.isReportable(): Boolean {
|
||||||
|
if (this !is Exception) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return this is ParseException || this is IllegalArgumentException || this is IllegalStateException
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Throwable.report(message: String?) {
|
||||||
|
CaughtException(this, message).sendWithAcra()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ACRA.setCurrentManga(manga: Manga?) = errorReporter.putCustomData("manga", manga?.publicUrl.toString())
|
||||||
|
|
||||||
|
private class CaughtException(cause: Throwable, override val message: String?) : RuntimeException(cause)
|
||||||
Reference in New Issue
Block a user