|
|
|
@ -10,6 +10,9 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
|
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
|
|
|
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
|
|
|
|
import org.thoughtcrime.securesms.util.GroupUtil;
|
|
|
|
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|
|
|
|
import org.thoughtcrime.securesms.util.Util;
|
|
|
|
|
import org.whispersystems.textsecure.api.util.InvalidNumberException;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
@ -17,6 +20,8 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class GroupMembersDialog extends AsyncTask<Void, Void, Recipients> {
|
|
|
|
|
|
|
|
|
|
private static final String TAG = GroupMembersDialog.class.getSimpleName();
|
|
|
|
|
|
|
|
|
|
private final Recipients recipients;
|
|
|
|
|
private final Context context;
|
|
|
|
|
|
|
|
|
@ -50,10 +55,13 @@ public class GroupMembersDialog extends AsyncTask<Void, Void, Recipients> {
|
|
|
|
|
progress.dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<String> recipientStrings = new LinkedList<String>();
|
|
|
|
|
List<String> recipientStrings = new LinkedList<>();
|
|
|
|
|
recipientStrings.add(context.getString(R.string.GroupMembersDialog_me));
|
|
|
|
|
|
|
|
|
|
for (Recipient recipient : members.getRecipientsList()) {
|
|
|
|
|
recipientStrings.add(recipient.toShortString());
|
|
|
|
|
if (!isLocalNumber(recipient)) {
|
|
|
|
|
recipientStrings.add(recipient.toShortString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
|
|
|
@ -69,4 +77,16 @@ public class GroupMembersDialog extends AsyncTask<Void, Void, Recipients> {
|
|
|
|
|
if (recipients.isGroupRecipient()) execute();
|
|
|
|
|
else onPostExecute(recipients);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean isLocalNumber(Recipient recipient) {
|
|
|
|
|
try {
|
|
|
|
|
String localNumber = TextSecurePreferences.getLocalNumber(context);
|
|
|
|
|
String e164Number = Util.canonicalizeNumber(context, recipient.getNumber());
|
|
|
|
|
|
|
|
|
|
return e164Number != null && e164Number.equals(localNumber);
|
|
|
|
|
} catch (InvalidNumberException e) {
|
|
|
|
|
Log.w(TAG, e);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|