Skip to content

Commit cd76a34

Browse files
authored
Merge pull request #30 from hawkff/fix/speed-interval-default
fix: default speedInterval to 1000ms so fresh installs show speeds
2 parents bfac4af + 0ea43e5 commit cd76a34

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • app/src/main/java/io/nekohasekai/sagernet/database

app/src/main/java/io/nekohasekai/sagernet/database/DataStore.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ object DataStore : OnPreferenceDataStoreChangeListener {
116116
var concurrentDial by configurationStore.boolean(Key.CONCURRENT_DIAL)
117117

118118
var allowAccess by configurationStore.boolean(Key.ALLOW_ACCESS)
119-
var speedInterval by configurationStore.stringToInt(Key.SPEED_INTERVAL)
119+
// Default must match global_preferences.xml (1000ms). Without a non-zero code
120+
// default, a fresh install that never opens Settings reads 0, which disables the
121+
// TrafficLooper stats loop entirely (TrafficLooper.loop() returns on delayMs == 0),
122+
// so the dashboard up/down speeds stay blank. "0" remains a valid user choice (Off).
123+
var speedInterval by configurationStore.stringToInt(Key.SPEED_INTERVAL) { 1000 }
120124
var showGroupInNotification by configurationStore.boolean("showGroupInNotification")
121125

122126
var globalCustomConfig by configurationStore.string(Key.GLOBAL_CUSTOM_CONFIG) { "" }

0 commit comments

Comments
 (0)