v1.0.16: spinning sync icon, colorful icon, ON_CHANGE fix, notification fix
- Sync icon now rotates (CSS-style spin) in StatusPill, StatusBanner, and card sync button whenever status is SYNCING - Launcher icon redesigned: indigo→violet→cyan gradient background, upload arrow fades white→sky-blue, download arrow fades white→violet, soft glow ring behind arrows - Fix ON_CHANGE not triggering: FileWatchService.start() now called from AddPairViewModel.save() so pairs created with ON_CHANGE immediately begin watching without needing a toggle or reboot - Fix FileWatch notification hidden: IMPORTANCE_MIN → IMPORTANCE_LOW so the "Watching N folders" notification shows in the shade Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.syncflow.ui.addpair
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
@@ -7,9 +8,10 @@ import com.syncflow.data.db.CloudAccountDao
|
||||
import com.syncflow.data.db.SyncPairDao
|
||||
import com.syncflow.data.db.entities.CloudAccountEntity
|
||||
import com.syncflow.data.db.entities.SyncPairEntity
|
||||
import com.syncflow.data.db.entities.toDomain
|
||||
import com.syncflow.domain.model.*
|
||||
import com.syncflow.worker.FileWatchService
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import kotlinx.coroutines.flow.*
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
@@ -31,7 +33,7 @@ data class AddPairUiState(
|
||||
val scheduleType: ScheduleType = ScheduleType.INTERVAL,
|
||||
val intervalMinutes: Int = 30,
|
||||
val dailyTime: String = "02:00",
|
||||
val weekdays: Int = 0b1111111, // all 7 days by default
|
||||
val weekdays: Int = 0b1111111,
|
||||
// ── Constraints ──────────────────────────────────────────────────────────
|
||||
val wifiOnly: Boolean = true,
|
||||
val wifiSsid: String = "",
|
||||
@@ -57,6 +59,7 @@ data class AddPairUiState(
|
||||
class AddPairViewModel @Inject constructor(
|
||||
private val syncPairDao: SyncPairDao,
|
||||
private val accountDao: CloudAccountDao,
|
||||
@ApplicationContext private val context: Context,
|
||||
savedState: SavedStateHandle,
|
||||
) : ViewModel() {
|
||||
|
||||
@@ -147,7 +150,10 @@ class AddPairViewModel @Inject constructor(
|
||||
)
|
||||
if (editPairId == null) syncPairDao.insert(entity) else syncPairDao.update(entity)
|
||||
}
|
||||
.onSuccess { _state.update { it.copy(done = true) } }
|
||||
.onSuccess {
|
||||
if (s.scheduleType == ScheduleType.ON_CHANGE) FileWatchService.start(context)
|
||||
_state.update { it.copy(done = true) }
|
||||
}
|
||||
.onFailure { e -> _state.update { it.copy(isSaving = false, error = e.message) } }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user