Rename ServerProfile's address to host

This commit is contained in:
Gaurav Ujjwal 2021-04-28 10:38:23 +05:30
parent 86ac24b124
commit f216c38aa9
13 changed files with 16 additions and 16 deletions

View file

@ -36,7 +36,7 @@ data class ServerProfile(
* Internet address of the server. This can be hostname or IP address.
* It does not contain the port number.
*/
var address: String = "",
var host: String = "",
/**
* Port number of the remote server.
@ -98,7 +98,7 @@ data class ServerProfile(
/**
* Whether UltraVNC Repeater is used for connections.
* When repeater is used, [address] & [port] identifies the repeater.
* When repeater is used, [host] & [port] identifies the repeater.
*/
var useRepeater: Boolean = false,

View file

@ -57,7 +57,7 @@ open class ProfileViewHolder(
R.id.edit -> homeViewModel.onEditProfile(profile)
R.id.duplicate -> homeViewModel.onDuplicateProfile(profile)
R.id.delete -> homeViewModel.deleteProfile(profile)
R.id.copy_address -> homeViewModel.setClipboardText(profile.address)
R.id.copy_host -> homeViewModel.setClipboardText(profile.host)
R.id.copy_name -> homeViewModel.setClipboardText(profile.name)
}

View file

@ -124,7 +124,7 @@ class Experimental {
}
private fun isServerDiscovered(p: ServerProfile): Boolean {
return discoveredServers?.find { p.address == it.address && p.port == it.port } != null
return discoveredServers?.find { p.host == it.host && p.port == it.port } != null
}
private fun updateAnimator() {

View file

@ -106,7 +106,7 @@ class SshTunnel(private val viewModel: VncViewModel) {
val ss = ServerSocket(0)
ss.close()
try {
connection.createLocalPortForwarder(ss.localPort, profile.address, profile.port)
connection.createLocalPortForwarder(ss.localPort, profile.host, profile.port)
localPort = ss.localPort
} catch (e: IOException) {
//Retry

View file

@ -187,7 +187,7 @@ class VncViewModel(app: Application) : BaseViewModel(app), VncClient.Observer {
if (channel != ServerProfile.CHANNEL_TCP && channel != ServerProfile.CHANNEL_SSH_TUNNEL)
throw IOException("Unsupported Channel: $channel")
var host = profile.address
var host = profile.host
var port = profile.port
if (channel == ServerProfile.CHANNEL_SSH_TUNNEL) {

View file

@ -104,7 +104,7 @@ class Discovery(private val context: Context) {
private fun addProfile(name: String, host: String, port: Int) {
val profile = ServerProfile().apply {
this.name = name
this.address = host
this.host = host
this.port = port
}

View file

@ -60,7 +60,7 @@ class VncUri(private val uri: Uri) {
*/
fun toServerProfile() = ServerProfile(
name = connectionName,
address = host,
host = host,
port = port,
username = username,
password = password,

View file

@ -51,7 +51,7 @@
android:hint="@{profile.useRepeater ? @string/hint_repeater_host : @string/hint_host}"
android:importantForAutofill="no"
android:inputType="textUri"
android:text="@={profile.address}" />
android:text="@={profile.host}" />
<!--Port-->
<EditText

View file

@ -91,7 +91,7 @@
android:hint="@{useRepeater.checked ? @string/hint_repeater_host : @string/hint_host}"
android:importantForAutofill="no"
android:inputType="textUri"
android:text="@={profile.address}"
android:text="@={profile.host}"
app:layout_constraintEnd_toStartOf="@id/port"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/name" />

View file

@ -38,7 +38,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_small"
android:text='@{profile.address + (profile.port == 5900 ? "" : " | " + profile.port) }'
android:text='@{profile.host + (profile.port == 5900 ? "" : " | " + profile.port) }'
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/profile_name"
tools:text="192.168.1.1 | 5901" />

View file

@ -11,6 +11,6 @@
android:id="@+id/copy_name"
android:title="@string/title_copy_name" />
<item
android:id="@+id/copy_address"
android:title="@string/title_copy_address" />
android:id="@+id/copy_host"
android:title="@string/title_copy_host" />
</menu>

View file

@ -14,8 +14,8 @@
android:id="@+id/duplicate"
android:title="@string/title_duplicate" />
<item
android:id="@+id/copy_address"
android:title="@string/title_copy_address" />
android:id="@+id/copy_host"
android:title="@string/title_copy_host" />
<item
android:id="@+id/delete"
android:title="@string/title_delete" />

View file

@ -14,7 +14,7 @@
<string name="title_edit">Edit</string>
<string name="title_delete">Delete</string>
<string name="title_copy">Copy</string>
<string name="title_copy_address">Copy Address</string>
<string name="title_copy_host">Copy Host</string>
<string name="title_copy_name">Copy Name</string>
<string name="title_advanced">Advanced</string>
<string name="title_save">Save</string>