Fix keyword alarm and add visual indicators

- Fix: Only keyword-matched deals send notifications
- Add: Visual indicator for keyword-matched deals (badge + border)
- Add: Polling interval setting with persistence
- Add: Version check in settings
- Add: Update dialog on app start
This commit is contained in:
sanjeok77
2026-03-04 01:57:25 +09:00
parent c22cfafe88
commit f9b4a4a90f
6 changed files with 214 additions and 145 deletions
@@ -0,0 +1,40 @@
package com.hotdeal.alarm.data.local.preferences
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
/**
* 앱 설정 저장 (DataStore)
*/
class AppSettings(private val context: Context) {
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "app_settings")
companion object {
private val POLLING_INTERVAL_KEY = intPreferencesKey("polling_interval_minutes")
private const val DEFAULT_INTERVAL = 2
}
/**
* 폴 주기 (분)
*/
val pollingInterval: Flow<Int> = context.dataStore.data
.map { preferences ->
preferences[POLLING_INTERVAL_KEY] ?: DEFAULT_INTERVAL
}
/**
* 폴 주기 설정 저장
*/
suspend fun setPollingInterval(minutes: Int) {
context.dataStore.edit { preferences ->
preferences[POLLING_INTERVAL_KEY] = minutes
}
}
}