fix: device label reads Settings.Global.DEVICE_NAME (user-set name), falls back to Build.MODEL
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package me.hgsky.synq.data
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.provider.Settings
|
||||||
import androidx.datastore.preferences.core.edit
|
import androidx.datastore.preferences.core.edit
|
||||||
import androidx.datastore.preferences.core.intPreferencesKey
|
import androidx.datastore.preferences.core.intPreferencesKey
|
||||||
import androidx.datastore.preferences.core.stringPreferencesKey
|
import androidx.datastore.preferences.core.stringPreferencesKey
|
||||||
@@ -29,7 +30,10 @@ class SettingsRepository(private val context: Context) {
|
|||||||
SynqSettings(
|
SynqSettings(
|
||||||
serverUrl = prefs[KEY_URL] ?: "http://jeeves.mother:8765",
|
serverUrl = prefs[KEY_URL] ?: "http://jeeves.mother:8765",
|
||||||
token = prefs[KEY_TOKEN] ?: "",
|
token = prefs[KEY_TOKEN] ?: "",
|
||||||
deviceLabel = prefs[KEY_DEVICE] ?: Build.MODEL,
|
deviceLabel = prefs[KEY_DEVICE] ?: (
|
||||||
|
Settings.Global.getString(context.contentResolver, Settings.Global.DEVICE_NAME)
|
||||||
|
?.takeIf { it.isNotBlank() } ?: Build.MODEL
|
||||||
|
),
|
||||||
syncIntervalMinutes = prefs[KEY_INTERVAL] ?: 15,
|
syncIntervalMinutes = prefs[KEY_INTERVAL] ?: 15,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user