Make DHCP workaround global

This commit is contained in:
Mygod
2019-02-01 16:55:38 +08:00
parent 6a7a16a0c7
commit a71a3b3bb0
6 changed files with 45 additions and 25 deletions

View File

@@ -14,6 +14,7 @@ import androidx.core.content.getSystemService
import androidx.core.provider.FontRequest
import androidx.emoji.text.EmojiCompat
import androidx.emoji.text.FontRequestEmojiCompatConfig
import be.mygod.vpnhotspot.net.DhcpWorkaround
import be.mygod.vpnhotspot.room.AppDatabase
import be.mygod.vpnhotspot.util.DeviceStorageApp
import be.mygod.vpnhotspot.util.Event0
@@ -48,6 +49,7 @@ class App : Application() {
override fun onFailed(throwable: Throwable?) = Timber.d(throwable)
})
})
if (DhcpWorkaround.shouldEnable) DhcpWorkaround.enable(true)
}
override fun onConfigurationChanged(newConfig: Configuration?) {
@@ -79,7 +81,6 @@ class App : Application() {
}
val masquerade get() = pref.getBoolean("service.masquerade", true)
val dhcpWorkaround get() = pref.getBoolean("service.dhcpWorkaround", false)
val onPreCleanRoutings = Event0()
val onRoutingsCleaned = Event0()