refactor: 데모 브랜치 패키지 통일 com.example.medilightv2android → com.medithings.vesiscan
사용자앱 (feature/tab-navigation) 과 패키지 이름 일치. namespace + applicationId 둘 다 com.medithings.vesiscan 로 변경 (기존 데모 앱은 재설치 필요). ## 변경 범위 - Kotlin 148 파일: package + import 문 (714 occurrences) - 디렉토리 이동: com/example/medilightv2android → com/medithings/vesiscan (main, test, androidTest 각각) - app/build.gradle.kts: namespace, applicationId - docs/FLAVOR_DEMO_STABLE.md: 참조 갱신 - V41DetectorCH4Test: BvDispatchResult.methodChosen → method (dto field name fix) ## 주의 - applicationId 가 바뀌므로 기존 데모 앱 (com.example.medilightv2android.demo) 은 Android 관점에서 다른 앱으로 취급 — 재설치 시 PIN/설정 초기화됨. - Fresh install 권장. 기존 앱 (com.example...) 은 별도로 uninstall 필요. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* WakeupAlarmPrefs — 기상 알람 설정 persistence (SharedPreferences).
|
||||
*
|
||||
* 사용자가 "설정 탭" 에서 toggle on/off → 일어남 감지 시 빨간 팝업.
|
||||
* LYING 유지 시간 임계 (default 3 min) 도 함께.
|
||||
*/
|
||||
package com.medithings.vesiscan.services
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
|
||||
object WakeupAlarmPrefs {
|
||||
|
||||
private const val PREF_NAME = "wakeup_alarm_prefs"
|
||||
private const val KEY_ENABLED = "enabled"
|
||||
private const val KEY_LYING_DURATION_SEC = "lying_duration_sec"
|
||||
|
||||
private var prefs: SharedPreferences? = null
|
||||
|
||||
private fun ensure(context: Context): SharedPreferences {
|
||||
val p = prefs
|
||||
if (p != null) return p
|
||||
val newP = context.applicationContext.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE)
|
||||
prefs = newP
|
||||
return newP
|
||||
}
|
||||
|
||||
fun isEnabled(context: Context): Boolean =
|
||||
ensure(context).getBoolean(KEY_ENABLED, false)
|
||||
|
||||
fun setEnabled(context: Context, enabled: Boolean) {
|
||||
ensure(context).edit().putBoolean(KEY_ENABLED, enabled).apply()
|
||||
}
|
||||
|
||||
/** 일어남으로 인정하기 위한 직전 LYING 유지 시간 (초). default 180 = 3분. */
|
||||
fun lyingDurationSec(context: Context): Int =
|
||||
ensure(context).getInt(KEY_LYING_DURATION_SEC, 180)
|
||||
|
||||
fun setLyingDurationSec(context: Context, sec: Int) {
|
||||
ensure(context).edit().putInt(KEY_LYING_DURATION_SEC, sec).apply()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user