Commit a6728e60 authored by Mygod's avatar Mygod

Fix default ports not initialized in UI

parent be688205
...@@ -33,6 +33,9 @@ class GlobalConfigFragment extends PreferenceFragmentCompatDividers { ...@@ -33,6 +33,9 @@ class GlobalConfigFragment extends PreferenceFragmentCompatDividers {
override def onCreatePreferencesFix(bundle: Bundle, key: String) { override def onCreatePreferencesFix(bundle: Bundle, key: String) {
getPreferenceManager.setPreferenceDataStore(app.dataStore) getPreferenceManager.setPreferenceDataStore(app.dataStore)
app.dataStore.putString(Key.serviceMode, app.dataStore.serviceMode) // temporary workaround for support lib bug app.dataStore.putString(Key.serviceMode, app.dataStore.serviceMode) // temporary workaround for support lib bug
app.dataStore.putString(Key.portProxy, app.dataStore.portProxy.toString)
app.dataStore.putString(Key.portLocalDns, app.dataStore.portLocalDns.toString)
app.dataStore.putString(Key.portTransproxy, app.dataStore.portTransproxy.toString)
addPreferencesFromResource(R.xml.pref_global) addPreferencesFromResource(R.xml.pref_global)
val switch = findPreference(Key.isAutoConnect).asInstanceOf[SwitchPreference] val switch = findPreference(Key.isAutoConnect).asInstanceOf[SwitchPreference]
switch.setOnPreferenceChangeListener((_, value) => { switch.setOnPreferenceChangeListener((_, value) => {
......
...@@ -163,7 +163,6 @@ class ShadowsocksApplication extends Application { ...@@ -163,7 +163,6 @@ class ShadowsocksApplication extends Application {
TcpFastOpen.enabled(dataStore.getBoolean(Key.tfo, TcpFastOpen.sendEnabled)) TcpFastOpen.enabled(dataStore.getBoolean(Key.tfo, TcpFastOpen.sendEnabled))
if (dataStore.getLong(Key.assetUpdateTime, -1) != info.lastUpdateTime) copyAssets() if (dataStore.getLong(Key.assetUpdateTime, -1) != info.lastUpdateTime) copyAssets()
(dataStore.portProxy, dataStore.portLocalDns, dataStore.portTransproxy) // initialize ports for UI
if (Build.VERSION.SDK_INT >= 26) { if (Build.VERSION.SDK_INT >= 26) {
val nm = getSystemService(classOf[NotificationManager]) val nm = getSystemService(classOf[NotificationManager])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment