add udp dns option
This commit is contained in:
@@ -50,7 +50,7 @@ object DBHelper {
|
||||
val PROFILE = "profile.db"
|
||||
}
|
||||
|
||||
class DBHelper(val context: Context) extends OrmLiteSqliteOpenHelper(context, DBHelper.PROFILE, null, 7) {
|
||||
class DBHelper(val context: Context) extends OrmLiteSqliteOpenHelper(context, DBHelper.PROFILE, null, 8) {
|
||||
|
||||
lazy val profileDao:Dao[Profile,Int] = getDao(classOf[Profile])
|
||||
|
||||
@@ -59,7 +59,11 @@ class DBHelper(val context: Context) extends OrmLiteSqliteOpenHelper(context, DB
|
||||
}
|
||||
|
||||
def onUpgrade(database: SQLiteDatabase, connectionSource: ConnectionSource, oldVersion: Int, newVersion: Int) {
|
||||
TableUtils.dropTable(connectionSource, classOf[Profile], true)
|
||||
if (oldVersion < 8) {
|
||||
profileDao.executeRaw("ALTER TABLE `profile` ADD COLUMN udpdns INTEGER;")
|
||||
} else {
|
||||
TableUtils.dropTable(connectionSource, classOf[Profile], true)
|
||||
}
|
||||
onCreate(database, connectionSource)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +84,9 @@ class Profile {
|
||||
@DatabaseField
|
||||
var traffic: Boolean = false
|
||||
|
||||
@DatabaseField
|
||||
var udpdns: Boolean = false
|
||||
|
||||
@DatabaseField(dataType = DataType.LONG_STRING)
|
||||
var individual: String = ""
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
|
||||
edit.putBoolean(Key.isGFWList, profile.chnroute)
|
||||
edit.putBoolean(Key.isBypassApps, profile.bypass)
|
||||
edit.putBoolean(Key.isTrafficStat, profile.traffic)
|
||||
edit.putBoolean(Key.isUdpDns, profile.udpdns)
|
||||
edit.putString(Key.profileName, profile.name)
|
||||
edit.putString(Key.proxy, profile.host)
|
||||
edit.putString(Key.sitekey, profile.password)
|
||||
@@ -143,6 +144,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) {
|
||||
profile.chnroute = settings.getBoolean(Key.isGFWList, false)
|
||||
profile.bypass = settings.getBoolean(Key.isBypassApps, false)
|
||||
profile.traffic = settings.getBoolean(Key.isTrafficStat, false)
|
||||
profile.udpdns = settings.getBoolean(Key.isUdpDns, false)
|
||||
profile.name = settings.getString(Key.profileName, "default")
|
||||
profile.host = settings.getString(Key.proxy, "127.0.0.1")
|
||||
profile.password = settings.getString(Key.sitekey, "default")
|
||||
|
||||
Reference in New Issue
Block a user