mirror of
https://github.com/yggdrasil-network/yggdrasil-android.git
synced 2025-04-28 22:25:09 +03:00
Preparation for release 0.5.7 (#62)
* Updated DNS. * Removed tree info from main screen. * Added a link to public peers site. * Updated version and changelogs.
This commit is contained in:
parent
6a66960666
commit
060c096cdf
12 changed files with 90 additions and 52 deletions
|
@ -13,6 +13,7 @@ import androidx.preference.PreferenceManager
|
|||
import com.google.android.material.textfield.TextInputEditText
|
||||
|
||||
const val KEY_DNS_SERVERS = "dns_servers"
|
||||
const val KEY_DNS_VERSION = "dns_version"
|
||||
const val KEY_ENABLE_CHROME_FIX = "enable_chrome_fix"
|
||||
|
||||
class DnsActivity : AppCompatActivity() {
|
||||
|
@ -41,10 +42,10 @@ class DnsActivity : AppCompatActivity() {
|
|||
val descriptionRevertron = getString(R.string.dns_server_info_revertron)
|
||||
// Here we can add some other DNS servers in a future
|
||||
defaultDnsServers = hashMapOf(
|
||||
"302:7991::53" to Pair(getString(R.string.location_amsterdam), descriptionRevertron),
|
||||
"302:db60::53" to Pair(getString(R.string.location_prague), descriptionRevertron),
|
||||
"300:6223::53" to Pair(getString(R.string.location_bratislava), descriptionRevertron),
|
||||
"301:1088::53" to Pair(getString(R.string.location_buffalo), descriptionRevertron),
|
||||
"308:62:45:62::" to Pair(getString(R.string.location_amsterdam), descriptionRevertron),
|
||||
"308:84:68:55::" to Pair(getString(R.string.location_frankfurt), descriptionRevertron),
|
||||
"308:25:40:bd::" to Pair(getString(R.string.location_bratislava), descriptionRevertron),
|
||||
"308:c8:48:45::" to Pair(getString(R.string.location_buffalo), descriptionRevertron),
|
||||
)
|
||||
|
||||
serversTableLayout = findViewById(R.id.configuredDnsTableLayout)
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.os.Build
|
|||
import android.service.quicksettings.TileService
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.preference.PreferenceManager
|
||||
|
||||
const val PREF_KEY_ENABLED = "enabled"
|
||||
const val MAIN_CHANNEL_ID = "Yggdrasil Service"
|
||||
|
@ -15,7 +16,7 @@ const val MAIN_CHANNEL_ID = "Yggdrasil Service"
|
|||
class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
||||
private lateinit var config: ConfigurationProxy
|
||||
private var currentState: State = State.Disabled
|
||||
var updaterConnections: Int = 0
|
||||
private var updaterConnections: Int = 0
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
@ -24,6 +25,7 @@ class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
|||
callback.register()
|
||||
val receiver = YggStateReceiver(this)
|
||||
receiver.register(this)
|
||||
migrateDnsServers(this)
|
||||
}
|
||||
|
||||
fun subscribe() {
|
||||
|
@ -64,6 +66,28 @@ class GlobalApplication: Application(), YggStateReceiver.StateReceiver {
|
|||
}
|
||||
}
|
||||
|
||||
fun migrateDnsServers(context: Context) {
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
if (preferences.getInt(KEY_DNS_VERSION, 0) >= 1) {
|
||||
return
|
||||
}
|
||||
val serverString = preferences.getString(KEY_DNS_SERVERS, "")
|
||||
if (serverString!!.isNotEmpty()) {
|
||||
// Replacing old Revertron's servers by new ones
|
||||
val newServers = serverString
|
||||
.replace("300:6223::53", "308:25:40:bd::")
|
||||
.replace("302:7991::53", "308:62:45:62::")
|
||||
.replace("302:db60::53", "308:84:68:55::")
|
||||
.replace("301:1088::53", "308:c8:48:45::")
|
||||
val editor = preferences.edit()
|
||||
editor.putInt(KEY_DNS_VERSION, 1)
|
||||
if (newServers != serverString) {
|
||||
editor.putString(KEY_DNS_SERVERS, newServers)
|
||||
}
|
||||
editor.apply()
|
||||
}
|
||||
}
|
||||
|
||||
fun createServiceNotification(context: Context, state: State): Notification {
|
||||
createNotificationChannels(context)
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ class MainActivity : AppCompatActivity() {
|
|||
private lateinit var enabledLabel: TextView
|
||||
private lateinit var ipAddressLabel: TextView
|
||||
private lateinit var subnetLabel: TextView
|
||||
private lateinit var treeLengthLabel: TextView
|
||||
private lateinit var peersLabel: TextView
|
||||
private lateinit var peersRow: LinearLayoutCompat
|
||||
private lateinit var dnsLabel: TextView
|
||||
|
@ -53,7 +52,6 @@ class MainActivity : AppCompatActivity() {
|
|||
enabledLabel = findViewById(R.id.yggdrasilStatusLabel)
|
||||
ipAddressLabel = findViewById(R.id.ipAddressValue)
|
||||
subnetLabel = findViewById(R.id.subnetValue)
|
||||
treeLengthLabel = findViewById(R.id.treeLengthValue)
|
||||
peersLabel = findViewById(R.id.peersValue)
|
||||
peersRow = findViewById(R.id.peersTableRow)
|
||||
dnsLabel = findViewById(R.id.dnsValue)
|
||||
|
@ -175,7 +173,6 @@ class MainActivity : AppCompatActivity() {
|
|||
}
|
||||
ipAddressLabel.text = intent.getStringExtra("ip") ?: "N/A"
|
||||
subnetLabel.text = intent.getStringExtra("subnet") ?: "N/A"
|
||||
treeLengthLabel.text = intent.getStringExtra("coords") ?: "0"
|
||||
if (intent.hasExtra("peers")) {
|
||||
val peerState = JSONArray(intent.getStringExtra("peers") ?: "[]")
|
||||
peersLabel.text = when (val count = peerState.length()) {
|
||||
|
|
|
@ -236,11 +236,6 @@ open class PacketTunnelProvider: VpnService() {
|
|||
var lastStateUpdate = System.currentTimeMillis()
|
||||
updates@ while (started.get()) {
|
||||
val treeJSON = yggdrasil.treeJSON
|
||||
var treeLength = 0
|
||||
if (treeJSON != null && treeJSON != "null") {
|
||||
val treeState = JSONArray(treeJSON)
|
||||
treeLength = treeState.length()
|
||||
}
|
||||
if ((application as GlobalApplication).needUiUpdates()) {
|
||||
val intent = Intent(STATE_INTENT)
|
||||
intent.putExtra("type", "state")
|
||||
|
@ -248,9 +243,7 @@ open class PacketTunnelProvider: VpnService() {
|
|||
intent.putExtra("ip", yggdrasil.addressString)
|
||||
intent.putExtra("subnet", yggdrasil.subnetString)
|
||||
intent.putExtra("pubkey", yggdrasil.publicKeyString)
|
||||
intent.putExtra("coords", "$treeLength")
|
||||
intent.putExtra("peers", yggdrasil.peersJSON)
|
||||
intent.putExtra("tree", treeJSON)
|
||||
LocalBroadcastManager.getInstance(this).sendBroadcast(intent)
|
||||
}
|
||||
val curTime = System.currentTimeMillis()
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.content.Intent
|
|||
import android.content.IntentFilter
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.util.Log
|
||||
import android.view.ContextThemeWrapper
|
||||
import android.view.KeyEvent
|
||||
|
@ -47,6 +48,9 @@ class PeersActivity : AppCompatActivity() {
|
|||
configuredTableLayout = findViewById(R.id.configuredPeersTableLayout)
|
||||
configuredTableLabel = findViewById(R.id.configuredPeersLabel)
|
||||
|
||||
val discoveryLink = findViewById<TextView>(R.id.peers_discovery_link)
|
||||
discoveryLink.movementMethod = LinkMovementMethod.getInstance()
|
||||
|
||||
multicastListenSwitch = findViewById(R.id.enableMulticastListen)
|
||||
multicastListenSwitch.setOnCheckedChangeListener { button, _ ->
|
||||
config.multicastListen = button.isChecked
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue