Skip to content

Commit

Permalink
Remove repeater support
Browse files Browse the repository at this point in the history
This never actually worked because, due to a bug, idOnRepeater was not saved to database
when editing profiles.
  • Loading branch information
gujjwal00 committed Feb 1, 2024
1 parent b3a36b9 commit a941fc2
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 45 deletions.
10 changes: 1 addition & 9 deletions app/src/main/java/com/gaurav/avnc/model/ServerProfile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,8 @@ data class ServerProfile(
*/
var useCount: Int = 0,

/**
* Whether UltraVNC Repeater is used for connections.
* When repeater is used, [host] & [port] identifies the repeater.
*/
// These fields are not used, as repeater support has been removed
var useRepeater: Boolean = false,

/**
* When using a repeater, this value identifies the VNC server.
* Valid IDs: [0, 999999999].
*/
var idOnRepeater: Int = 0,

/**
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/java/com/gaurav/avnc/ui/home/ProfileEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ class AdvancedProfileEditor : Fragment() {
}

private fun validate(): Boolean {
var result = validateNotEmpty(binding.host) and
validateNotEmpty(binding.port) and
validateNotEmpty(binding.idOnRepeater, binding.useRepeater.isChecked)
var result = validateNotEmpty(binding.host) and validateNotEmpty(binding.port)

if (binding.useSshTunnel.isChecked) {
result = result and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class EditorViewModel(app: Application, state: SavedStateHandle, initialProfile:
* more complex handling, and live feedback in UI.
* For these, we have to use dedicated LiveData fields.
*/
val useRepeater = state.getLiveData("useRepeater", profile.useRepeater)
val useRawEncoding = state.getLiveData("useRawEncoding", profile.useRawEncoding)
val useSshTunnel = state.getLiveData("useSshTunnel", profile.channelType == ServerProfile.CHANNEL_SSH_TUNNEL)
val sshUsePassword = state.getLiveData("sshUsePassword", profile.sshAuthType == ServerProfile.SSH_AUTH_PASSWORD)
Expand All @@ -40,7 +39,6 @@ class EditorViewModel(app: Application, state: SavedStateHandle, initialProfile:


fun prepareProfileForSave(): ServerProfile {
profile.useRepeater = useRepeater.value ?: false
profile.useRawEncoding = useRawEncoding.value ?: false
profile.channelType = if (useSshTunnel.value == true) ServerProfile.CHANNEL_SSH_TUNNEL else ServerProfile.CHANNEL_TCP
profile.sshAuthType = if (sshUsePassword.value == true) ServerProfile.SSH_AUTH_PASSWORD else ServerProfile.SSH_AUTH_KEY
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/com/gaurav/avnc/viewmodel/VncViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ class VncViewModel(val profile: ServerProfile, app: Application) : BaseViewModel

client.configure(profile.viewOnly, profile.securityType, true /* Hardcoded to true */,
profile.imageQuality, profile.useRawEncoding)

if (profile.useRepeater)
client.setupRepeater(profile.idOnRepeater)
}

private fun connect() {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_profile_editor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
android:id="@+id/host"
style="@style/FormField.EditText"
android:layout_weight=".8"
android:drawableStart="@{profile.useRepeater ? @drawable/ic_swap : @drawable/ic_computer}"
android:hint="@{profile.useRepeater ? @string/hint_repeater_host : @string/hint_host}"
android:drawableStart="@drawable/ic_computer"
android:hint="@string/hint_host"
android:importantForAutofill="no"
android:inputType="textUri"
android:text="@={profile.host}" />
Expand Down
29 changes: 3 additions & 26 deletions app/src/main/res/layout/fragment_profile_editor_advanced.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
<EditText
android:id="@+id/host"
style="@style/FormField.EditText"
android:drawableStart="@{viewModel.useRepeater ? @drawable/ic_swap : @drawable/ic_computer}"
android:hint="@{viewModel.useRepeater ? @string/hint_repeater_host : @string/hint_host}"
android:drawableStart="@drawable/ic_computer"
android:hint="@string/hint_host"
android:importantForAutofill="no"
android:inputType="textUri"
android:text="@={viewModel.profile.host}"
Expand All @@ -109,29 +109,6 @@
app:layout_constraintTop_toTopOf="@id/host"
app:layout_constraintWidth_percent=".2" />

<!--Repeater-->
<CheckBox
android:id="@+id/use_repeater"
style="@style/FormField.CheckBox"
android:checked="@={viewModel.useRepeater}"
android:text="@string/title_use_repeater"
app:layout_constraintEnd_toStartOf="@id/id_on_repeater"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/host" />

<EditText
android:id="@+id/id_on_repeater"
style="@style/FormField.EditText"
android:hint="@string/hint_server_id"
android:importantForAutofill="no"
android:inputType="number"
android:minWidth="100dp"
android:text='@={"" + viewModel.profile.idOnRepeater}'
app:isVisible="@{viewModel.useRepeater}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/use_repeater"
app:layout_constraintTop_toBottomOf="@id/host" />


<!--View-only mode-->
<CheckBox
Expand All @@ -141,7 +118,7 @@
android:text="@string/title_view_only_mode"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/use_repeater" />
app:layout_constraintTop_toBottomOf="@id/host" />

<!--Key Compatibility mode-->
<CheckBox
Expand Down

0 comments on commit a941fc2

Please sign in to comment.