diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala index fe136fb5..ca31b992 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala @@ -15,10 +15,11 @@ import com.github.shadowsocks.utils.{Key, Utils} object ShadowsocksSettings { // Constants - val PREFS_NAME = "Shadowsocks" - val PROXY_PREFS = Array(Key.profileName, Key.proxy, Key.remotePort, Key.localPort, Key.sitekey, Key.encMethod, + private final val TAG = "ShadowsocksSettings" + private final val PREFS_NAME = "Shadowsocks" + private val PROXY_PREFS = Array(Key.profileName, Key.proxy, Key.remotePort, Key.localPort, Key.sitekey, Key.encMethod, Key.isAuth) - val FEATURE_PREFS = Array(Key.route, Key.isProxyApps, Key.isUdpDns, Key.isIpv6) + private val FEATURE_PREFS = Array(Key.route, Key.isProxyApps, Key.isUdpDns, Key.isIpv6) // Helper functions def updateDropDownPreference(pref: Preference, value: String) { @@ -81,7 +82,7 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan }) findPreference("recovery").setOnPreferenceClickListener((preference: Preference) => { - ShadowsocksApplication.track(Shadowsocks.TAG, "reset") + ShadowsocksApplication.track(TAG, "reset") activity.recovery() true }) @@ -89,13 +90,13 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan val flush = findPreference("flush_dnscache") if (Build.VERSION.SDK_INT < 17) flush.setSummary(R.string.flush_dnscache_summary) flush.setOnPreferenceClickListener(_ => { - ShadowsocksApplication.track(Shadowsocks.TAG, "flush_dnscache") + ShadowsocksApplication.track(TAG, "flush_dnscache") activity.flushDnsCache() true }) findPreference("about").setOnPreferenceClickListener((preference: Preference) => { - ShadowsocksApplication.track(Shadowsocks.TAG, "about") + ShadowsocksApplication.track(TAG, "about") val web = new WebView(activity) web.loadUrl("file:///android_asset/pages/about.html") web.setWebViewClient(new WebViewClient() { diff --git a/src/main/scala/com/github/shadowsocks/database/ProfileManager.scala b/src/main/scala/com/github/shadowsocks/database/ProfileManager.scala index d11818b0..bcb39878 100644 --- a/src/main/scala/com/github/shadowsocks/database/ProfileManager.scala +++ b/src/main/scala/com/github/shadowsocks/database/ProfileManager.scala @@ -44,7 +44,12 @@ import android.util.Log import com.github.shadowsocks._ import com.github.shadowsocks.utils.Key +object ProfileManager { + private final val TAG = "ProfileManager" +} + class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { + import ProfileManager._ var profileAddedListener: Profile => Any = _ def setProfileAddedListener(listener: Profile => Any) = this.profileAddedListener = listener @@ -72,7 +77,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { profile } catch { case ex: Exception => - Log.e(Shadowsocks.TAG, "addProfile", ex) + Log.e(TAG, "addProfile", ex) p } } @@ -83,7 +88,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { true } catch { case ex: Exception => - Log.e(Shadowsocks.TAG, "updateProfile", ex) + Log.e(TAG, "updateProfile", ex) false } } @@ -96,7 +101,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { } } catch { case ex: Exception => - Log.e(Shadowsocks.TAG, "getProfile", ex) + Log.e(TAG, "getProfile", ex) None } } @@ -107,7 +112,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { true } catch { case ex: Exception => - Log.e(Shadowsocks.TAG, "delProfile", ex) + Log.e(TAG, "delProfile", ex) false } } @@ -118,7 +123,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { if (result.size == 1) Option(result.get(0)) else None } catch { case ex: Exception => - Log.e(Shadowsocks.TAG, "getAllProfiles", ex) + Log.e(TAG, "getAllProfiles", ex) None } } @@ -129,7 +134,7 @@ class ProfileManager(settings: SharedPreferences, dbHelper: DBHelper) { Option(dbHelper.profileDao.query(dbHelper.profileDao.queryBuilder.orderBy("userOrder", true).prepare).toList) } catch { case ex: Exception => - Log.e(Shadowsocks.TAG, "getAllProfiles", ex) + Log.e(TAG, "getAllProfiles", ex) None } }