feat: UI 일괄 수정 (5,6,7,8번)
5. Onboarding 간소화: 4단계→1단계 (Max Volume만) Step 1(자세)/2(위치)/4(최적화) 제거, Continue 바로 완료 6. 자동 reconnect: 앱 시작 시 마지막 기기에 자동 연결 SharedPreferences에 address+name 저장, HomeView에서 autoConnectLastDevice() 7. Demo 모드: DeviceScanView에서 Demo 버튼 제거 8. Android 뒤로가기: BackHandler로 화면별 네비게이션 매핑 Placement→Home, Monitoring→Placement, History/Diary→Monitoring 등 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -221,6 +221,17 @@ class BleManager private constructor(private val context: Context) {
|
||||
handler.postDelayed(timeout, 10000)
|
||||
}
|
||||
|
||||
/** 저장된 마지막 기기에 자동 연결 시도 */
|
||||
fun autoConnectLastDevice() {
|
||||
if (isConnected.value) return
|
||||
val prefs = context.getSharedPreferences("medilight_prefs", Context.MODE_PRIVATE)
|
||||
val address = prefs.getString("last_device_address", null) ?: return
|
||||
val name = prefs.getString("last_device_name", null) ?: return
|
||||
debugLogger.info("AUTO_CONNECT attempting $name ($address)")
|
||||
lastConnectedAddress = address
|
||||
scheduleAutoReconnect()
|
||||
}
|
||||
|
||||
fun disconnect() {
|
||||
isUserDisconnect = true
|
||||
cancelAutoReconnect()
|
||||
@@ -614,7 +625,10 @@ class BleManager private constructor(private val context: Context) {
|
||||
|
||||
try {
|
||||
val prefs = context.getSharedPreferences("medilight_prefs", Context.MODE_PRIVATE)
|
||||
prefs.edit().putString("last_device_address", gatt.device.address).apply()
|
||||
prefs.edit()
|
||||
.putString("last_device_address", gatt.device.address)
|
||||
.putString("last_device_name", connectedDeviceName.value)
|
||||
.apply()
|
||||
} catch (_: Exception) {}
|
||||
|
||||
gatt.discoverServices()
|
||||
|
||||
Reference in New Issue
Block a user