Skip to content

Commit

Permalink
Potential fix Incorrect toggling of full-screen mode when using annot…
Browse files Browse the repository at this point in the history
…ation tools #178

Deleting empty text annotations on defocus.

Upping versionCode to 114
  • Loading branch information
Dima-Android committed Nov 5, 2024
1 parent 20e59cd commit 2c87ced
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class AnnotationPreviewManager @Inject constructor(
isDark: Boolean,
annotationMaxSideSize: Int,
) {
if (!annotation.shouldRenderPreview || !annotation.isZoteroAnnotation) {
if (!annotation.shouldRenderPreview || !annotation.isZoteroAnnotation || !annotation.isAttached) {
return
}
enqueue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1920,14 +1920,26 @@ class PdfReaderViewModel @Inject constructor(
}

private fun deselectSelectedAnnotation(annotation: Annotation) {
if (annotation.type == AnnotationType.FREETEXT) {
val contents = annotation.contents
if (contents.isNullOrBlank()) {
this.document.annotationProvider.removeAnnotationFromPage(annotation)
}
}

// if (viewState.selectedAnnotationKey?.key == annotation.key ) {
// _select(key = null, didSelectInDocument = false)
// }
}

val selectedAnnotation: org.zotero.android.pdf.data.PDFAnnotation?
get() {
return viewState.selectedAnnotationKey?.let { annotation(it) }
val selectedAnnotationKey = viewState.selectedAnnotationKey
val let = selectedAnnotationKey?.let {
val annotation = annotation(it)
annotation
}
return let
}

override fun onCleared() {
Expand Down Expand Up @@ -2659,16 +2671,7 @@ class PdfReaderViewModel @Inject constructor(
schemaController = this.schemaController,
boundingBoxConverter = this.annotationBoundingBoxConverter
)
viewModelScope.launch {
perform(
dbWrapper = dbWrapperMain,
request = request
).ifFailure {
Timber.e(it, "PDFReaderViewModel: can't add annotations")
return@launch
}
}

dbWrapperMain.realmDbStorage.perform(request)
}

private fun tool(annotation: Annotation): AnnotationTool? {
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 = 34

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

0 comments on commit 2c87ced

Please sign in to comment.