20 Commits
Author SHA1 Message Date
sanjeok77 a4a6492945 v0.3.3: fix dead code in initializeApp - split coroutines 2026-08-24 23:02:06 +00:00
sanjeok77 984cc0bd85 v0.3.3: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 23:01:46 +00:00
sanjeok77 3bec5eeca3 v0.3.3: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 23:01:44 +00:00
sanjeok77 d6c04312e0 v0.3.3: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 23:01:42 +00:00
sanjeok77 c52c93694e v0.3.3: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 23:01:41 +00:00
sanjeok77 5390a1db3f v0.3.3: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 23:01:39 +00:00
sanjeok77 ad4cdef4cb v0.3.2: new BootReceiver.kt 2026-08-24 22:34:34 +00:00
sanjeok77 ea79599c08 v0.3.2: AndroidManifest.xml 2026-08-24 22:34:33 +00:00
sanjeok77 e82725887b v0.3.2: MainViewModel.kt 2026-08-24 22:34:31 +00:00
sanjeok77 bd4d6a35ff v0.3.2: DealListScreen.kt 2026-08-24 22:34:29 +00:00
sanjeok77 e332738eff v0.3.2: HotDealDao.kt 2026-08-24 22:34:27 +00:00
sanjeok77 aae7836e89 v0.3.2: PpomppuScraper.kt 2026-08-24 22:34:26 +00:00
sanjeok77 945f5146ed v0.3.2: HotDealPollingWorker.kt 2026-08-24 22:34:24 +00:00
sanjeok77 bf4037d933 v0.3.2: WorkerScheduler.kt 2026-08-24 22:34:22 +00:00
sanjeok77 47de6bad98 v0.3.2: HotDealApplication.kt 2026-08-24 22:34:20 +00:00
sanjeok77 cd866600e6 v0.3.2: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 22:32:25 +00:00
sanjeok77 2b51518d0e v0.3.2: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 22:32:24 +00:00
sanjeok77 2e5f6d1ba5 v0.3.2: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 22:32:22 +00:00
sanjeok77 204faf0186 v0.3.2: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 22:32:20 +00:00
sanjeok77 0cf08466b6 v0.3.2: True Touch Drag & Drop Reordering & Fix OTA Auto-Install Bug 2026-08-24 22:32:18 +00:00
7 changed files with 110 additions and 12 deletions

No files matched your search

+2 -2
View File
@@ -24,8 +24,8 @@ android {
applicationId = "com.hotdeal.alarm"
minSdk = 31
targetSdk = 35
versionCode = 31
versionName = "0.3.1"
versionCode = 33
versionName = "0.3.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
+10 -3
View File
@@ -65,9 +65,16 @@
android:exported="false"
android:foregroundServiceType="dataSync" />
<!-- Boot Receiver -->
<!-- Widget -->
<!-- Boot Receiver: 부팅/앱 업데이트 후 백그라운드 폴링 자동 재등록 -->
<receiver
android:name=".receiver.BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver
android:name=".widget.HotDealWidget"
android:exported="true">
@@ -1,9 +1,17 @@
package com.hotdeal.alarm
import android.app.Application
import android.util.Log
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import com.hotdeal.alarm.data.local.preferences.AppSettings
import com.hotdeal.alarm.worker.WorkerScheduler
import dagger.hilt.android.HiltAndroidApp
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltAndroidApp
@@ -12,13 +20,41 @@ class HotDealApplication : Application(), Configuration.Provider {
@Inject
lateinit var workerFactory: HiltWorkerFactory
@Inject
lateinit var workerScheduler: WorkerScheduler
@Inject
lateinit var appSettings: AppSettings
private val applicationScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
override val workManagerConfiguration: Configuration
get() = Configuration.Builder()
.setWorkerFactory(workerFactory)
.setMinimumLoggingLevel(Log.DEBUG)
.build()
override fun onCreate() {
super.onCreate()
// Application initialization
// 앱 시작 시 백그라운드 폴링 즉시 등록/갱신
ensurePollingScheduled()
}
/**
* 앱이 시작될 때마다 백그라운드 폴링이 등록되어 있는지 확인하고,
* 없으면 즉시 등록합니다. UPDATE 정책으로 항상 최신 Worker가 동작합니다.
*/
private fun ensurePollingScheduled() {
applicationScope.launch {
try {
val interval = appSettings.pollingInterval.first()
Log.d("HotDealApp", "백그라운드 폴링 등록/갱신: ${interval}분 간격")
workerScheduler.schedulePeriodicPolling(interval.toLong())
} catch (e: Exception) {
Log.e("HotDealApp", "폴링 스케줄 등록 실패: ${e.message}", e)
// 기본값으로 폴백
workerScheduler.schedulePeriodicPolling(WorkerScheduler.DEFAULT_INTERVAL_MINUTES)
}
}
}
}
@@ -44,11 +44,18 @@ class MainViewModel @Inject constructor(
}
private fun initializeApp() {
// 1. 사이트 설정 초기화 후 DB Flow 구독 (별도 코루틴 — collect는 영원히 suspend)
viewModelScope.launch {
initializeDefaultSiteConfigs()
loadState()
loadState() // combine().collect — 이 코루틴은 영원히 살아있음
}
// 2. 백그라운드 폴링 등록 + 즉시 1회 스크래핑 (별도 코루틴)
viewModelScope.launch {
val savedInterval = appSettings.pollingInterval.first()
startPolling(savedInterval.toLong())
workerScheduler.schedulePeriodicPolling(savedInterval.toLong())
// 앱 시작 시 즉시 1회 실행하여 최신 데이터 갱신
workerScheduler.executeOnce()
}
}
@@ -0,0 +1,48 @@
package com.hotdeal.alarm.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
import com.hotdeal.alarm.data.local.preferences.AppSettings
import com.hotdeal.alarm.worker.WorkerScheduler
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.launch
import javax.inject.Inject
/**
* 부팅 완료 시 백그라운드 폴링을 자동으로 재등록하는 리시버
*/
@AndroidEntryPoint
class BootReceiver : BroadcastReceiver() {
@Inject
lateinit var workerScheduler: WorkerScheduler
@Inject
lateinit var appSettings: AppSettings
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
override fun onReceive(context: Context, intent: Intent) {
if (intent.action == Intent.ACTION_BOOT_COMPLETED ||
intent.action == Intent.ACTION_MY_PACKAGE_REPLACED
) {
Log.d("BootReceiver", "부팅/업데이트 감지 → 백그라운드 폴링 재등록")
scope.launch {
try {
val interval = appSettings.pollingInterval.first()
workerScheduler.schedulePeriodicPolling(interval.toLong())
Log.d("BootReceiver", "폴링 재등록 완료: ${interval}분 간격")
} catch (e: Exception) {
Log.e("BootReceiver", "폴링 재등록 실패: ${e.message}")
workerScheduler.schedulePeriodicPolling(WorkerScheduler.DEFAULT_INTERVAL_MINUTES)
}
}
}
}
}
@@ -54,7 +54,7 @@ class WorkerScheduler @Inject constructor(
WorkManager.getInstance(context).enqueueUniquePeriodicWork(
HotDealPollingWorker.WORK_NAME,
ExistingPeriodicWorkPolicy.KEEP,
ExistingPeriodicWorkPolicy.UPDATE,
workRequest
)
}
+3 -3
View File
@@ -1,7 +1,7 @@
{
"version": "0.3.1",
"versionCode": 31,
"updateUrl": "https://git.webpluss.net/sanjeok77/hotdeal_alarm/releases/download/v0.3.1/app-release.apk",
"version": "0.3.3",
"versionCode": 33,
"updateUrl": "https://git.webpluss.net/sanjeok77/hotdeal_alarm/releases/download/v0.3.3/app-release.apk",
"changelog": [
"사이트 및 키워드 순서 조절을 터치 드래그 앤 드롭(Drag & Drop) 방식으로 전면 업그레이드",
"앱 내 업데이트 시 다운로드 완료 후 설치 화면으로 안 넘어가는 버그 수정",