a7c5ed713a
- Request POST_NOTIFICATIONS permission at runtime in MainActivity (primary fix for notifications never appearing on Android 13+ phones including Android 16) - Register all 4 notification channels eagerly in SyncFlowApp.onCreate() instead of lazily inside workers - Add FOREGROUND_SERVICE_SHORT_SERVICE permission + shortService foreground type for Android 16 foreground service compatibility - Add global activity Log tab (new tab 2 in main nav) showing all sync events across all pairs, grouped by date with pair name, event icon, and file detail - Fix FileWatchService ON_CHANGE detection: ContentObserver on SAF tree URIs only fires for SAF-API writes, not raw filesystem writes. Now resolves primary:/* tree URIs to /storage/emulated/0/* and uses FileObserver for reliable detection - Bump version to 1.0.21 (build 22) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
24 lines
906 B
Kotlin
24 lines
906 B
Kotlin
package com.syncflow.data.db
|
|
|
|
import androidx.room.*
|
|
import com.syncflow.data.db.entities.SyncEventEntity
|
|
import kotlinx.coroutines.flow.Flow
|
|
|
|
@Dao
|
|
interface SyncEventDao {
|
|
@Query("SELECT * FROM sync_events WHERE syncPairId = :pairId ORDER BY timestamp DESC LIMIT :limit")
|
|
fun observeRecent(pairId: Long, limit: Int = 200): Flow<List<SyncEventEntity>>
|
|
|
|
@Query("SELECT * FROM sync_events ORDER BY timestamp DESC LIMIT :limit")
|
|
fun observeAll(limit: Int = 500): Flow<List<SyncEventEntity>>
|
|
|
|
@Insert
|
|
suspend fun insert(entity: SyncEventEntity): Long
|
|
|
|
@Query("DELETE FROM sync_events WHERE syncPairId = :pairId AND timestamp < :olderThan")
|
|
suspend fun pruneOld(pairId: Long, olderThan: Long)
|
|
|
|
@Query("SELECT SUM(bytesTransferred) FROM sync_events WHERE syncPairId = :pairId AND timestamp >= :since")
|
|
suspend fun totalBytesTransferred(pairId: Long, since: Long): Long?
|
|
}
|