diff --git a/res/layout/device_list_item_view.xml b/res/layout/device_list_item_view.xml index 52bb83aad7..11406f5f32 100644 --- a/res/layout/device_list_item_view.xml +++ b/res/layout/device_list_item_view.xml @@ -2,40 +2,30 @@ - - + + android:layout_marginTop="8dp" + android:ellipsize="marquee" + android:singleLine="true" + android:text="Name" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="?attr/conversation_list_item_contact_color" + android:textSize="18sp" /> - - - - + \ No newline at end of file diff --git a/res/layout/view_device_linking.xml b/res/layout/view_device_linking.xml index e9ecbc4229..1a793dd83f 100644 --- a/res/layout/view_device_linking.xml +++ b/res/layout/view_device_linking.xml @@ -45,18 +45,6 @@ android:textAlignment="center" android:text="word word word" /> - - Your device has been linked successfully Authorize Cancel - Device Name (Optional) Scan QR Code 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\". diff --git a/src/org/thoughtcrime/securesms/loki/DeviceLinkingDelegate.kt b/src/org/thoughtcrime/securesms/loki/DeviceLinkingDelegate.kt index d7509a5c42..3a86bdf245 100644 --- a/src/org/thoughtcrime/securesms/loki/DeviceLinkingDelegate.kt +++ b/src/org/thoughtcrime/securesms/loki/DeviceLinkingDelegate.kt @@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.loki 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 { companion object { fun combine(vararg delegates: DeviceLinkingDelegate?): DeviceLinkingDelegate { @@ -18,10 +19,6 @@ interface DeviceLinkingDelegate { override fun sendPairingAuthorizedMessage(pairingAuthorisation: 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 handleDeviceLinkingDialogDismissed() {} fun sendPairingAuthorizedMessage(pairingAuthorisation: PairingAuthorisation) {} - fun setDeviceDisplayName(hexEncodedPublicKey: String, displayName: String) {} } \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/loki/DeviceLinkingView.kt b/src/org/thoughtcrime/securesms/loki/DeviceLinkingView.kt index e797a99e06..393ad58398 100644 --- a/src/org/thoughtcrime/securesms/loki/DeviceLinkingView.kt +++ b/src/org/thoughtcrime/securesms/loki/DeviceLinkingView.kt @@ -56,30 +56,6 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe authorizeButton.visibility = View.GONE authorizeButton.setOnClickListener { authorizePairing() } 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 @@ -96,8 +72,6 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe mnemonicTextView.visibility = View.VISIBLE mnemonicTextView.text = MnemonicUtilities.getFirst3Words(MnemonicCodec(languageFileDirectory), pairingAuthorisation.secondaryDevicePublicKey) authorizeButton.visibility = View.VISIBLE - deviceNameText.visibility = View.VISIBLE - enableAuthorizeButton(true) } fun onDeviceLinkAuthorized(pairingAuthorisation: PairingAuthorisation) { @@ -129,7 +103,6 @@ class DeviceLinkingView private constructor(context: Context, attrs: AttributeSe if (mode != Mode.Master || pairingAuthorisation == null) { return; } delegate.sendPairingAuthorizedMessage(pairingAuthorisation) delegate.handleDeviceLinkAuthorized(pairingAuthorisation) - delegate.setDeviceDisplayName(pairingAuthorisation.secondaryDevicePublicKey, deviceNameText.text.toString().trim()) dismiss?.invoke() } diff --git a/src/org/thoughtcrime/securesms/loki/LinkedDevicesActivity.kt b/src/org/thoughtcrime/securesms/loki/LinkedDevicesActivity.kt index 4414101900..fd1568733d 100644 --- a/src/org/thoughtcrime/securesms/loki/LinkedDevicesActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/LinkedDevicesActivity.kt @@ -75,8 +75,4 @@ class LinkedDevicesActivity : PassphraseRequiredActionBarActivity(), DeviceLinki Util.runOnMain { this.deviceListFragment.refresh() } } } - - override fun setDeviceDisplayName(hexEncodedPublicKey: String, displayName: String) { - DatabaseFactory.getLokiUserDatabase(this).setDisplayName(hexEncodedPublicKey, displayName) - } }