Refine Firebase remote config
This commit is contained in:
@@ -126,6 +126,7 @@ trait BaseService extends Service {
|
||||
|
||||
def connect() {
|
||||
profile.name = profile.getName // save original name before it's (possibly) overwritten by IP addresses
|
||||
|
||||
if (profile.host == "198.199.101.152") {
|
||||
val client = new OkHttpClient.Builder()
|
||||
.dns(hostname => Utils.resolve(hostname, enableIPv6 = false) match {
|
||||
@@ -353,7 +354,7 @@ trait BaseService extends Service {
|
||||
.put("PrimaryDNS", new JSONArray().put(makeDns("Primary", "119.29.29.29")))
|
||||
.put("AlternativeDNS", remoteDns)
|
||||
case _ => config
|
||||
.put("PrimaryDNS", new JSONArray(remoteDns))
|
||||
.put("PrimaryDNS", remoteDns)
|
||||
// no need to setup AlternativeDNS in Acl.ALL/BYPASS_LAN mode
|
||||
.put("OnlyPrimaryDNS", true)
|
||||
}
|
||||
|
||||
@@ -384,12 +384,14 @@ class MainActivity extends Activity with ServiceBoundContext with Drawer.OnDrawe
|
||||
displayFragment(new AboutFragment)
|
||||
case DRAWER_FAQ => launchUrl(getString(R.string.faq_url))
|
||||
case DRAWER_CUSTOM_RULES => displayFragment(new CustomRulesFragment)
|
||||
case _ => // ignore
|
||||
}
|
||||
true // unexpected cases will throw exception
|
||||
}
|
||||
|
||||
protected override def onResume() {
|
||||
super.onResume()
|
||||
app.remoteConfig.fetch()
|
||||
state match {
|
||||
case State.STOPPING | State.CONNECTING =>
|
||||
case _ => hideCircle()
|
||||
|
||||
@@ -148,6 +148,7 @@ class ShadowsocksApplication extends Application {
|
||||
checkChineseLocale(getResources.getConfiguration)
|
||||
|
||||
FirebaseApp.initializeApp(this)
|
||||
remoteConfig.setDefaults(R.xml.default_configs);
|
||||
remoteConfig.fetch().addOnCompleteListener(task => if (task.isSuccessful) remoteConfig.activateFetched())
|
||||
|
||||
JobManager.create(this).addJobCreator(DonaldTrump)
|
||||
|
||||
Reference in New Issue
Block a user