Fix a bug in the individual proxy
This commit is contained in:
+2
-2
@@ -5,8 +5,8 @@ import org.scalasbt.androidplugin._
|
||||
import org.scalasbt.androidplugin.AndroidKeys._
|
||||
|
||||
object App {
|
||||
val version = "1.6.3"
|
||||
val versionCode = 33
|
||||
val version = "1.6.4"
|
||||
val versionCode = 34
|
||||
}
|
||||
|
||||
object General {
|
||||
|
||||
@@ -81,14 +81,10 @@ case class ListEntry(box: CheckBox, text: TextView, icon: ImageView)
|
||||
|
||||
object AppManager {
|
||||
|
||||
val PREFS_KEY_PROXYED = "Proxyed"
|
||||
|
||||
implicit def anyrefarray_tools[T <: AnyRef](a: Array[T]) = new ObjectArrayTools(a)
|
||||
|
||||
def getProxiedApps(context: Context): Array[ProxiedApp] = {
|
||||
def getProxiedApps(context: Context, proxiedAppString: String): Array[ProxiedApp] = {
|
||||
|
||||
val prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val proxiedAppString = prefs.getString(PREFS_KEY_PROXYED, "")
|
||||
val proxiedApps = proxiedAppString.split('|').sortWith(_ < _)
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
@@ -125,7 +121,7 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl
|
||||
|
||||
def loadApps(context: Context): Array[ProxiedApp] = {
|
||||
val prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val proxiedAppString = prefs.getString(AppManager.PREFS_KEY_PROXYED, "")
|
||||
val proxiedAppString = prefs.getString(Key.proxied, "")
|
||||
val proxiedApps = proxiedAppString.split('|').sortWith(_ < _)
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
@@ -267,7 +263,7 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl
|
||||
proxiedApps += '|'
|
||||
})
|
||||
val edit: SharedPreferences.Editor = prefs.edit
|
||||
edit.putString(AppManager.PREFS_KEY_PROXYED, proxiedApps.toString())
|
||||
edit.putString(Key.proxied, proxiedApps.toString())
|
||||
edit.commit
|
||||
}
|
||||
|
||||
|
||||
@@ -518,7 +518,9 @@ class ShadowsocksService extends Service {
|
||||
})
|
||||
}
|
||||
if (!config.isGlobalProxy) {
|
||||
if (apps == null || apps.length <= 0) apps = AppManager.getProxiedApps(this)
|
||||
if (apps == null || apps.length <= 0) {
|
||||
apps = AppManager.getProxiedApps(this, config.proxiedAppString)
|
||||
}
|
||||
val uidSet: mutable.HashSet[Int] = new mutable.HashSet[Int]
|
||||
for (app <- apps) {
|
||||
if (app.proxied) {
|
||||
|
||||
@@ -53,6 +53,8 @@ import android.graphics.{Canvas, Bitmap}
|
||||
import android.app.ActivityManager
|
||||
|
||||
object Key {
|
||||
val proxied = "Proxyed"
|
||||
|
||||
val isRoot = "isRoot"
|
||||
val status = "status"
|
||||
val proxyedApps = "proxyedApps"
|
||||
@@ -72,7 +74,8 @@ object Key {
|
||||
}
|
||||
|
||||
case class Config(isGlobalProxy: Boolean, isGFWList: Boolean, isBypassApps: Boolean,
|
||||
var proxy: String, sitekey: String, encMethod: String, remotePort: Int, localPort: Int)
|
||||
var proxy: String, sitekey: String, encMethod: String, remotePort: Int,
|
||||
localPort: Int, proxiedAppString: String)
|
||||
|
||||
object State {
|
||||
val INIT = 0
|
||||
@@ -116,9 +119,10 @@ object Extra {
|
||||
val encMethod = intent.getStringExtra(Key.encMethod)
|
||||
val remotePort = intent.getIntExtra(Key.remotePort, 1984)
|
||||
val localPort = intent.getIntExtra(Key.localPort, 1984)
|
||||
val proxiedString = intent.getStringExtra(Key.proxied)
|
||||
|
||||
new Config(isGlobalProxy, isGFWList, isBypassApps, proxy, sitekey, encMethod, remotePort,
|
||||
localPort)
|
||||
localPort, proxiedString)
|
||||
}
|
||||
|
||||
def put(settings: SharedPreferences, intent: Intent) {
|
||||
@@ -146,6 +150,7 @@ object Extra {
|
||||
1984
|
||||
}
|
||||
}
|
||||
val proxiedAppString = settings.getString(Key.proxied, "")
|
||||
|
||||
intent.putExtra(Key.isGlobalProxy, isGlobalProxy)
|
||||
intent.putExtra(Key.isGFWList, isGFWList)
|
||||
@@ -156,6 +161,8 @@ object Extra {
|
||||
intent.putExtra(Key.encMethod, encMethod)
|
||||
intent.putExtra(Key.remotePort, remotePort)
|
||||
intent.putExtra(Key.localPort, localProt)
|
||||
|
||||
intent.putExtra(Key.proxied, proxiedAppString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user