mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Remove textbox in linking dialog.
This commit is contained in:
parent
c3bda57ac1
commit
d96664cb6a
@ -1,18 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<org.thoughtcrime.securesms.DeviceListItem xmlns:android="http://schemas.android.com/apk/res/android"
|
<org.thoughtcrime.securesms.DeviceListItem xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginStart="16dp"
|
|
||||||
android:layout_marginEnd="16dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:paddingBottom="8dp">
|
||||||
android:paddingBottom="8dp"
|
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -36,6 +27,5 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textColor="#A2A2A2"
|
android:textColor="#A2A2A2"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.DeviceListItem>
|
</org.thoughtcrime.securesms.DeviceListItem>
|
@ -45,18 +45,6 @@
|
|||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="word word word" />
|
android:text="word word word" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.LabeledEditText
|
|
||||||
android:id="@+id/deviceNameText"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:ems="10"
|
|
||||||
android:inputType="text"
|
|
||||||
android:singleLine="true"
|
|
||||||
app:labeledEditText_label="@string/view_device_linking_device_name_edit_text_description"
|
|
||||||
app:labeledEditText_background="?attr/colorBackgroundFloating"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/buttonContainer"
|
android:id="@+id/buttonContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -1635,7 +1635,6 @@
|
|||||||
<string name="view_device_linking_explanation_3">Your device has been linked successfully</string>
|
<string name="view_device_linking_explanation_3">Your device has been linked successfully</string>
|
||||||
<string name="view_device_linking_authorize_button_title">Authorize</string>
|
<string name="view_device_linking_authorize_button_title">Authorize</string>
|
||||||
<string name="view_device_linking_cancel_button_title">Cancel</string>
|
<string name="view_device_linking_cancel_button_title">Cancel</string>
|
||||||
<string name="view_device_linking_device_name_edit_text_description">Device Name (Optional)</string>
|
|
||||||
<!-- Scan QR code fragment -->
|
<!-- Scan QR code fragment -->
|
||||||
<string name="fragment_scan_qr_code_title">Scan QR Code</string>
|
<string name="fragment_scan_qr_code_title">Scan QR Code</string>
|
||||||
<string name="fragment_scan_qr_code_explanation">Scan the QR code of the person you\'d like to securely message. They can find their QR code by going into Loki Messenger\'s in-app settings and clicking \"Show QR Code\".</string>
|
<string name="fragment_scan_qr_code_explanation">Scan the QR code of the person you\'d like to securely message. They can find their QR code by going into Loki Messenger\'s in-app settings and clicking \"Show QR Code\".</string>
|
||||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.loki
|
|||||||
|
|
||||||
import org.whispersystems.signalservice.loki.api.PairingAuthorisation
|
import org.whispersystems.signalservice.loki.api.PairingAuthorisation
|
||||||
|
|
||||||
|
// Loki - TODO: Remove this yucky delegate pattern for device linking dialog once we have the redesign
|
||||||
interface DeviceLinkingDelegate {
|
interface DeviceLinkingDelegate {
|
||||||
companion object {
|
companion object {
|
||||||
fun combine(vararg delegates: DeviceLinkingDelegate?): DeviceLinkingDelegate {
|
fun combine(vararg delegates: DeviceLinkingDelegate?): DeviceLinkingDelegate {
|
||||||
@ -18,10 +19,6 @@ interface DeviceLinkingDelegate {
|
|||||||
override fun sendPairingAuthorizedMessage(pairingAuthorisation: PairingAuthorisation) {
|
override fun sendPairingAuthorizedMessage(pairingAuthorisation: PairingAuthorisation) {
|
||||||
for (delegate in validDelegates) { delegate.sendPairingAuthorizedMessage(pairingAuthorisation) }
|
for (delegate in validDelegates) { delegate.sendPairingAuthorizedMessage(pairingAuthorisation) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDeviceDisplayName(hexEncodedPublicKey: String, displayName: String) {
|
|
||||||
for (delegate in validDelegates) { delegate.setDeviceDisplayName(hexEncodedPublicKey, displayName) }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -29,5 +26,4 @@ interface DeviceLinkingDelegate {
|
|||||||
fun handleDeviceLinkAuthorized(pairingAuthorisation: PairingAuthorisation) {}
|
fun handleDeviceLinkAuthorized(pairingAuthorisation: PairingAuthorisation) {}
|
||||||
fun handleDeviceLinkingDialogDismissed() {}
|
fun handleDeviceLinkingDialogDismissed() {}
|
||||||
fun sendPairingAuthorizedMessage(pairingAuthorisation: PairingAuthorisation) {}
|
fun sendPairingAuthorizedMessage(pairingAuthorisation: PairingAuthorisation) {}
|
||||||
fun setDeviceDisplayName(hexEncodedPublicKey: String, displayName: String) {}
|
|
||||||
}
|
}
|
@ -56,30 +56,6 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe
|
|||||||
authorizeButton.visibility = View.GONE
|
authorizeButton.visibility = View.GONE
|
||||||
authorizeButton.setOnClickListener { authorizePairing() }
|
authorizeButton.setOnClickListener { authorizePairing() }
|
||||||
cancelButton.setOnClickListener { cancel() }
|
cancelButton.setOnClickListener { cancel() }
|
||||||
|
|
||||||
deviceNameText.visibility = View.GONE
|
|
||||||
deviceNameText.input.addTextChangedListener(object : TextWatcher {
|
|
||||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
|
||||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
val string = s?.toString() ?: ""
|
|
||||||
when {
|
|
||||||
string.trim().length > 30 -> {
|
|
||||||
deviceNameText.input.error = "Too Long"
|
|
||||||
enableAuthorizeButton(false)
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
deviceNameText.input.error = null
|
|
||||||
enableAuthorizeButton(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun enableAuthorizeButton(enabled: Boolean) {
|
|
||||||
authorizeButton.isEnabled = enabled
|
|
||||||
authorizeButton.alpha = if (enabled) 1f else 0.5f
|
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
@ -96,8 +72,6 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe
|
|||||||
mnemonicTextView.visibility = View.VISIBLE
|
mnemonicTextView.visibility = View.VISIBLE
|
||||||
mnemonicTextView.text = MnemonicUtilities.getFirst3Words(MnemonicCodec(languageFileDirectory), pairingAuthorisation.secondaryDevicePublicKey)
|
mnemonicTextView.text = MnemonicUtilities.getFirst3Words(MnemonicCodec(languageFileDirectory), pairingAuthorisation.secondaryDevicePublicKey)
|
||||||
authorizeButton.visibility = View.VISIBLE
|
authorizeButton.visibility = View.VISIBLE
|
||||||
deviceNameText.visibility = View.VISIBLE
|
|
||||||
enableAuthorizeButton(true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun onDeviceLinkAuthorized(pairingAuthorisation: PairingAuthorisation) {
|
fun onDeviceLinkAuthorized(pairingAuthorisation: PairingAuthorisation) {
|
||||||
@ -129,7 +103,6 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe
|
|||||||
if (mode != Mode.Master || pairingAuthorisation == null) { return; }
|
if (mode != Mode.Master || pairingAuthorisation == null) { return; }
|
||||||
delegate.sendPairingAuthorizedMessage(pairingAuthorisation)
|
delegate.sendPairingAuthorizedMessage(pairingAuthorisation)
|
||||||
delegate.handleDeviceLinkAuthorized(pairingAuthorisation)
|
delegate.handleDeviceLinkAuthorized(pairingAuthorisation)
|
||||||
delegate.setDeviceDisplayName(pairingAuthorisation.secondaryDevicePublicKey, deviceNameText.text.toString().trim())
|
|
||||||
dismiss?.invoke()
|
dismiss?.invoke()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,4 @@ class LinkedDevicesActivity : PassphraseRequiredActionBarActivity(), DeviceLinki
|
|||||||
Util.runOnMain { this.deviceListFragment.refresh() }
|
Util.runOnMain { this.deviceListFragment.refresh() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setDeviceDisplayName(hexEncodedPublicKey: String, displayName: String) {
|
|
||||||
DatabaseFactory.getLokiUserDatabase(this).setDisplayName(hexEncodedPublicKey, displayName)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user