Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ internal class StoreUserLocationIntoCurrentSessionWorker @AssistedInject constru
override val tag: String = "StoreUserLocationWorker"

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
createLocationFlow()
.filterNotNull()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.work.WorkerParameters
import com.simprints.core.DispatcherIO
import com.simprints.core.workers.SimCoroutineWorker
import com.simprints.infra.config.store.ConfigRepository
import com.simprints.infra.config.store.models.Project
import com.simprints.infra.enrolment.records.repository.domain.models.SubjectAction
import com.simprints.infra.enrolment.records.repository.domain.models.SubjectQuery
import com.simprints.infra.enrolment.records.repository.local.RealmEnrolmentRecordLocalDataSource
Expand Down Expand Up @@ -38,13 +37,10 @@ internal class RealmToRoomMigrationWorker @AssistedInject constructor(
override val tag: String
get() = REALM_DB_MIGRATION.name

lateinit var project: Project

override suspend fun doWork(): Result = withContext(dispatcher) {
project = configRepo.getProject()
showProgressNotification()
crashlyticsLog("[RealmToRoomMigrationWorker] MigrationWorker started.")
try {
showProgressNotification()
// 1. Check if down sync is in progress to retry latter (no need to increase the retry count)
if (realmToRoomMigrationFlagsStore.isDownSyncInProgress()) {
realmToRoomMigrationFlagsStore.updateStatus(MigrationStatus.NOT_STARTED)
Expand Down Expand Up @@ -87,6 +83,7 @@ internal class RealmToRoomMigrationWorker @AssistedInject constructor(
private suspend fun processRecords() {
// log realm db info
crashlyticsLog("[RealmToRoomMigrationWorker] ${realmDataSource.getLocalDBInfo()}")
val project = configRepo.getProject()
var index = 0
realmDataSource
.loadAllSubjectsInBatches(BATCH_SIZE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ internal abstract class BaseEventDownSyncDownloaderWorker(
}

protected open suspend fun performDownSync(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
val workerId = id.toString()
var count = syncCache.readProgress(workerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ internal class EventEndSyncReporterWorker @AssistedInject constructor(
override val tag: String = "EventEndSyncReporter"

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
val syncId = inputData.getString(SYNC_ID_TO_MARK_AS_COMPLETED)
Simber.d("Params: $syncId", tag = tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ internal class EventStartSyncReporterWorker @AssistedInject constructor(
override val tag: String = "EventStartSyncReporter"

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
val syncId = inputData.getString(SYNC_ID_STARTED)
Simber.d("Params: $syncId", tag = tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class EventSyncMasterWorker @AssistedInject internal constructor(
}

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
// check if device is rooted before starting the sync
securityManager.checkIfDeviceIsRooted()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ internal class EventUpSyncUploaderWorker @AssistedInject constructor(
?: throw IllegalArgumentException("input required")

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
val workerId = this@EventUpSyncUploaderWorker.id.toString()
var count = eventSyncCache.readProgress(workerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ internal class DeviceConfigDownSyncWorker @AssistedInject constructor(
override val tag: String = "DeviceConfigDownSync"

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
val state = configManager.getDeviceState()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ internal class ProjectConfigDownSyncWorker @AssistedInject constructor(
override val tag = "ProjectConfigDownSync"

override suspend fun doWork(): Result = withContext(dispatcher) {
crashlyticsLog("Started")
showProgressNotification()
crashlyticsLog("Started")
try {
val projectId = authStore.signedInProjectId
val oldConfig = configManager.getProjectConfiguration()
Expand Down