diff --git a/res/drawable-hdpi/ic_share_white_24dp.png b/res/drawable-hdpi/ic_share_white_24dp.png
new file mode 100644
index 0000000000..b09a6926de
Binary files /dev/null and b/res/drawable-hdpi/ic_share_white_24dp.png differ
diff --git a/res/drawable-mdpi/ic_share_white_24dp.png b/res/drawable-mdpi/ic_share_white_24dp.png
new file mode 100644
index 0000000000..e944fd70c4
Binary files /dev/null and b/res/drawable-mdpi/ic_share_white_24dp.png differ
diff --git a/res/drawable-xhdpi/ic_share_white_24dp.png b/res/drawable-xhdpi/ic_share_white_24dp.png
new file mode 100644
index 0000000000..22a8783e70
Binary files /dev/null and b/res/drawable-xhdpi/ic_share_white_24dp.png differ
diff --git a/res/drawable-xxhdpi/ic_share_white_24dp.png b/res/drawable-xxhdpi/ic_share_white_24dp.png
new file mode 100644
index 0000000000..a35b3cd14a
Binary files /dev/null and b/res/drawable-xxhdpi/ic_share_white_24dp.png differ
diff --git a/res/drawable-xxxhdpi/ic_share_white_24dp.png b/res/drawable-xxxhdpi/ic_share_white_24dp.png
new file mode 100644
index 0000000000..e351c7beb0
Binary files /dev/null and b/res/drawable-xxxhdpi/ic_share_white_24dp.png differ
diff --git a/res/menu/verify_identity.xml b/res/menu/verify_identity.xml
new file mode 100644
index 0000000000..a09af25053
--- /dev/null
+++ b/res/menu/verify_identity.xml
@@ -0,0 +1,8 @@
+
+
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5e8b5230b3..66ebac6b09 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -565,6 +565,9 @@
Your contact is running an old version of Signal, please ask them to update before verifying safety numbers.
You\'re attempting to verify safety numbers with %1$s, but scanned %2$s instead.
The scanned QR code is not a correctly formatted safety number verification code. Please try scanning again.
+ Share safety numbers via...
+ Our Signal safety numbers:
+ It looks like you don\'t have any apps to share to.
Initiate despite existing request?
@@ -936,6 +939,9 @@
If you wish to verify the security of your end-to-end encryption with %s, compare the numbers above with the numbers on their device. Alternately, you can scan the code on their phone, or ask them to scan your code.
Tap to scan
+
+
+ Share safety numbers
Some issues need your attention.
diff --git a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java
index ed7c4ce2ae..960d24343d 100644
--- a/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java
+++ b/src/org/thoughtcrime/securesms/VerifyIdentityActivity.java
@@ -16,7 +16,9 @@
*/
package org.thoughtcrime.securesms;
+import android.content.ActivityNotFoundException;
import android.content.Context;
+import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -33,6 +35,8 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@@ -122,10 +126,22 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
}
}
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ super.onPrepareOptionsMenu(menu);
+
+ menu.clear();
+ MenuInflater inflater = this.getMenuInflater();
+ inflater.inflate(R.menu.verify_identity, menu);
+
+ return true;
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case android.R.id.home: finish(); return true;
+ case R.id.verify_identity__share: handleShare(); return true;
+ case android.R.id.home: finish(); return true;
}
return false;
@@ -173,6 +189,25 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
}
}
+ private void handleShare() {
+ String shareString =
+ getString(R.string.VerifyIdentityActivity_our_signal_safety_numbers) + "\n" +
+ displayFragment.getFormattedSafetyNumbers() + "\n";
+
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_SEND);
+ intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.VerifyIdentityActivity_our_signal_safety_numbers));
+ intent.putExtra(Intent.EXTRA_TEXT, shareString);
+ intent.setType("text/plain");
+
+ try {
+ startActivity(Intent.createChooser(intent, getString(R.string.VerifyIdentityActivity_share_safety_numbers_via)));
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(VerifyIdentityActivity.this, R.string.VerifyIdentityActivity_no_app_to_share_to, Toast.LENGTH_LONG).show();
+ }
+ }
+
+
public static class VerifyDisplayFragment extends Fragment implements Recipients.RecipientsModifiedListener {
public static final String REMOTE_NUMBER = "remote_number";
@@ -294,6 +329,21 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
this.clickListener = listener;
}
+ public String getFormattedSafetyNumbers() {
+ StringBuilder result = new StringBuilder();
+
+ for (int i = 0; i < codes.length; i++) {
+ result.append(codes[i].getText());
+
+ if (i != codes.length - 1) {
+ if (((i+1) % 4) == 0) result.append('\n');
+ else result.append(' ');
+ }
+ }
+
+ return result.toString();
+ }
+
private void setFingerprintViews(Fingerprint fingerprint) {
String digits = fingerprint.getDisplayableFingerprint().getDisplayText();
int partSize = digits.length() / codes.length;