Auto reset when downgrading
While it's theoretically impossible to downgrade without reinstalling the app, there are ways to bypass this mechanism. And don't forget users can restore their app data as well.
This commit is contained in:
@@ -186,8 +186,8 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
|
||||
snackbar.show
|
||||
}
|
||||
|
||||
if (!app.settings.getBoolean(BuildConfig.VERSION_NAME, false)) {
|
||||
app.editor.putBoolean(BuildConfig.VERSION_NAME, true).apply()
|
||||
if (app.settings.getInt(Key.currentVersionCode, -1) != BuildConfig.VERSION_CODE) {
|
||||
app.editor.putInt(Key.currentVersionCode, BuildConfig.VERSION_CODE).apply()
|
||||
|
||||
recovery()
|
||||
|
||||
|
||||
@@ -208,20 +208,17 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
|
||||
|
||||
def refreshProfile() {
|
||||
profile = app.currentProfile match {
|
||||
case Some(profile) => profile
|
||||
case None => {
|
||||
case Some(p) => p
|
||||
case None =>
|
||||
app.profileManager.getFirstProfile match {
|
||||
case Some(profile) => {
|
||||
app.profileId(profile.id)
|
||||
profile
|
||||
}
|
||||
case None => {
|
||||
case Some(p) =>
|
||||
app.profileId(p.id)
|
||||
p
|
||||
case None =>
|
||||
val default = app.profileManager.createDefault()
|
||||
app.profileId(default.id)
|
||||
default
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
isProxyApps.setChecked(profile.proxyApps)
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ object Key {
|
||||
val kcpcli = "kcpcli"
|
||||
|
||||
val tfo = "tcp_fastopen"
|
||||
val currentVersionCode = "currentVersionCode"
|
||||
}
|
||||
|
||||
object State {
|
||||
|
||||
Reference in New Issue
Block a user