Skip to content

Commit

Permalink
Improve RemoteAttachmentDownloader handling of network errors,
Browse files Browse the repository at this point in the history
Fix text colors on AddByIdentifierScreen
Adding arxiv.org to list of cleartextTrafficPermitted websites.
Upping versionCode to 60
  • Loading branch information
Dima-Android committed May 9, 2024
1 parent fb08915 commit 400ad1a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ class RemoteAttachmentDownloader @Inject constructor(
)
}
}
is CustomResult.GeneralError.NetworkError -> {
this.errors[download] = Exception(result.stringResponse)
Timber.e(
result.stringResponse,
"RemoteAttachmentDownloader: failed to download attachment ${download.key}, ${download.libraryId}"
)
attachmentDownloaderEventStream.emitAsync(
Update(
download = download,
kind = Update.Kind.failed
)
)
}

is CustomResult.GeneralSuccess -> {
Timber.i("RemoteAttachmentDownloader: finished downloading ${download.key}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,12 +634,14 @@ class IdentifierLookupController @Inject constructor(
remoteFileDownloader.stop()
val lookupData = this.lookupData
cleanupLookupIfNeeded(force = true) {
this.observable.emitAsync(
Update(
kind = Update.Kind.finishedAllLookups,
lookupData = emptyList()
if (this::observable.isInitialized) {
this.observable.emitAsync(
Update(
kind = Update.Kind.finishedAllLookups,
lookupData = emptyList()
)
)
)
}
}
val storedItemResponses = lookupData.values.mapNotNull {
when (it.state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ internal fun LookupItemRow(
title,
HtmlCompat.FROM_HTML_MODE_LEGACY
).toString(),
color = CustomTheme.colors.primaryContent,
style = CustomTheme.typography.newBody,
)
NewDivider(modifier = Modifier.padding(top = 8.dp))
Expand Down Expand Up @@ -163,6 +164,7 @@ internal fun LookupAttachmentRow(
title,
HtmlCompat.FROM_HTML_MODE_LEGACY
).toString(),
color = CustomTheme.colors.primaryContent,
style = CustomTheme.typography.newBody,
)
NewDivider(modifier = Modifier.padding(top = 8.dp))
Expand All @@ -187,6 +189,7 @@ internal fun LookupIdentifierRow(
modifier = Modifier.weight(1f),
text = title,
maxLines = 1,
color = CustomTheme.colors.primaryContent,
overflow = TextOverflow.Ellipsis,
style = CustomTheme.typography.newBody,
)
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">arxiv.org</domain>
</domain-config>
<base-config>
<trust-anchors>
<certificates src="system" />
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/BuildConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object BuildConfig {
const val compileSdkVersion = 34
const val targetSdk = 33

val versionCode = 59 // Must be updated on every build
val versionCode = 60 // Must be updated on every build
val version = Version(
major = 1,
minor = 0,
Expand Down

0 comments on commit 400ad1a

Please sign in to comment.