mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Show our device words in preferences if we're a secondary device.
This commit is contained in:
parent
28a04f13af
commit
e72d5502ce
@ -1573,7 +1573,7 @@
|
||||
<!-- Conversation list activity -->
|
||||
<string name="activity_conversation_list_empty_state_message">Looks like you don\'t have any conversations yet. Get started by messaging a friend.</string>
|
||||
<!-- Settings activity -->
|
||||
<string name="activity_settings_secondary_device_tag">Secondary device</string>
|
||||
<string name="activity_settings_linked_device_tag">Linked device (%s)</string>
|
||||
<string name="activity_settings_public_key_copied_message">Copied to clipboard</string>
|
||||
<string name="activity_settings_share_public_key_button_title">Share Public Key</string>
|
||||
<string name="activity_settings_show_qr_code_button_title">Show QR Code</string>
|
||||
|
@ -20,7 +20,9 @@ import android.widget.Toast;
|
||||
|
||||
import org.thoughtcrime.securesms.database.Address;
|
||||
import org.thoughtcrime.securesms.loki.JazzIdenticonDrawable;
|
||||
import org.thoughtcrime.securesms.loki.MnemonicUtilities;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.signalservice.loki.crypto.MnemonicCodec;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
@ -31,6 +33,7 @@ public class ProfilePreference extends Preference {
|
||||
private TextView profileNameView;
|
||||
private TextView profileNumberView;
|
||||
private TextView profileTagView;
|
||||
private String ourDeviceWords;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
public ProfilePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
@ -127,6 +130,12 @@ public class ProfilePreference extends Preference {
|
||||
profileNumberView.setText(localAddress.toPhoneString());
|
||||
|
||||
profileTagView.setVisibility(primaryDevicePublicKey == null ? View.GONE : View.VISIBLE);
|
||||
profileTagView.setText(R.string.activity_settings_secondary_device_tag);
|
||||
if (primaryDevicePublicKey != null && ourDeviceWords == null) {
|
||||
MnemonicCodec codec = new MnemonicCodec(MnemonicUtilities.getLanguageFileDirectory(context));
|
||||
ourDeviceWords = MnemonicUtilities.getFirst3Words(codec, userHexEncodedPublicKey);
|
||||
}
|
||||
|
||||
String tag = context.getResources().getString(R.string.activity_settings_linked_device_tag);
|
||||
profileTagView.setText(String.format(tag, ourDeviceWords != null ? ourDeviceWords : "-"));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user