Skip to content

Commit

Permalink
Fix for infinite spinner for collections on some devices on ShareScreen
Browse files Browse the repository at this point in the history
Upping versionCode to 72.
  • Loading branch information
Dima-Android committed Jun 4, 2024
1 parent 57d8fad commit 2729ce0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ import org.zotero.android.sync.Collection
import org.zotero.android.sync.CollectionIdentifier
import org.zotero.android.sync.DateParser
import org.zotero.android.sync.KeyGenerator
import org.zotero.android.sync.Libraries
import org.zotero.android.sync.Library
import org.zotero.android.sync.LibraryIdentifier
import org.zotero.android.sync.SchemaController
import org.zotero.android.sync.SyncKind
import org.zotero.android.sync.SyncObject
import org.zotero.android.sync.SyncObservableEventStream
import org.zotero.android.sync.SyncScheduler
Expand Down Expand Up @@ -129,13 +127,17 @@ internal class ShareViewModel @Inject constructor(
selectedLibraryId = fileStore.getSelectedLibrary()
attachmentKey = KeyGenerator.newKey()
setupObservers()
finishSync(true)
ioCoroutineScope.launch {
try {
syncScheduler.startSyncController(
type = SyncKind.collectionsOnly,
libraries = Libraries.all,
retryAttempt = 0
)
// There should not be a need to do a dedicated collections sync here
// and wait for it's completion as for large number of collections it could take a lot of time,
// let's use already synced collections for selection.
// syncScheduler.startSyncController(
// type = SyncKind.collectionsOnly,
// libraries = Libraries.all,
// retryAttempt = 0
// )
val attachment = shareRawAttachmentLoader.getLoadedAttachmentResult()
process(attachment)
} catch (e: Exception) {
Expand All @@ -153,11 +155,11 @@ internal class ShareViewModel @Inject constructor(
}

private fun setupObservers() {
syncObservableEventStream.flow()
.onEach { data ->
finishSync(successful = (data == null))
}
.launchIn(viewModelScope)
// syncObservableEventStream.flow()
// .onEach { data ->
// finishSync(successful = (data == null))
// }
// .launchIn(viewModelScope)

translatorActionEventStream.flow()
.onEach { event ->
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 = 71 // Must be updated on every build
val versionCode = 72 // Must be updated on every build
val version = Version(
major = 1,
minor = 0,
Expand Down

0 comments on commit 2729ce0

Please sign in to comment.