Add app.isNatEnabled for performance and readability

Warning: This is a boring commit.
This commit is contained in:
Mygod
2016-05-24 11:52:06 +08:00
parent 461a0bda3f
commit 86f32ea67c
6 changed files with 23 additions and 34 deletions
@@ -58,15 +58,13 @@ class ShadowsocksRunnerService extends Service with ServiceBoundContext {
}
def startBackgroundService() {
if (app.isVpnEnabled) {
if (app.isNatEnabled) bgService.use(ConfigUtils.loadFromSharedPreferences) else {
val intent = VpnService.prepare(ShadowsocksRunnerService.this)
if (intent == null) {
if (bgService != null) {
bgService.use(ConfigUtils.loadFromSharedPreferences)
}
}
} else {
bgService.use(ConfigUtils.loadFromSharedPreferences)
}
stopSelf()
}