Share actual public key

This commit is contained in:
Niels Andriesse 2019-06-06 10:04:43 +10:00
parent 32e02d1f0d
commit 858b34306b
2 changed files with 9 additions and 5 deletions

View File

@ -48,7 +48,9 @@ import org.thoughtcrime.securesms.preferences.widgets.ProfilePreference;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.DynamicLanguage;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.IdentityUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
/**
* The Activity for application preference display and management.
@ -271,10 +273,12 @@ public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarA
fragment = new AdvancedPreferenceFragment();
break;
case PREFERENCE_CATEGORY_PUBLIC_KEY:
ClipboardManager clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("public key", "public key"); // TODO: Use actual public key
clipboard.setPrimaryClip(clip);
Toast.makeText(getContext(), R.string.activity_settings_public_key_copied_message, Toast.LENGTH_SHORT).show();
String hexEncodedPublicKey = TextSecurePreferences.getLocalNumber(getContext());
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, hexEncodedPublicKey);
shareIntent.setType("text/plain");
startActivity(shareIntent);
break;
default:
throw new AssertionError();

View File

@ -165,7 +165,7 @@ public class PushTextSendJob extends PushSendJob implements InjectableType {
log(TAG, "Have access key to use: " + unidentifiedAccess.isPresent());
// Loki - Generate a PreKeyBundle for a friend request.
// Loki - Generate a pre key bundle for a friend request
PreKeyBundle preKeyBundle = message.isFriendRequest() ? DatabaseFactory.getLokiPreKeyBundleDatabase(context).generatePreKeyBundle(address.getNumber()) : null;
SignalServiceDataMessage textSecureMessage = SignalServiceDataMessage.newBuilder()