mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-25 15:16:23 +00:00
group and contact list fixes
1) Updating a group without changing the avatar will keep that avatar 2) Prohibit adding non-push users to an existing push group 3) Add Android contacts to the same database. Takes a small amount more time and memory, but allows queries to not be a hack, and enables us to dedupe numbers in JB and higher devices. // FREEBIE
This commit is contained in:
committed by
Moxie Marlinspike
parent
b715debefc
commit
e2f7c1529a
@@ -162,9 +162,17 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
}
|
||||
|
||||
private void addSelectedContact(Recipient contact) {
|
||||
final boolean isPushUser = isActiveInDirectory(this, contact);
|
||||
if (existingContacts != null && !isPushUser) {
|
||||
Toast.makeText(getApplicationContext(),
|
||||
R.string.GroupCreateActivity_cannot_add_non_push_to_existing_group,
|
||||
Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!selectedContacts.contains(contact) && (existingContacts == null || !existingContacts.contains(contact)))
|
||||
selectedContacts.add(contact);
|
||||
if (!isActiveInDirectory(this, contact)) {
|
||||
if (!isPushUser) {
|
||||
disableWhisperGroupUi(R.string.GroupCreateActivity_contacts_dont_support_push);
|
||||
getSupportActionBar().setTitle(R.string.GroupCreateActivity_actionbar_mms_title);
|
||||
}
|
||||
@@ -375,6 +383,7 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(GroupCreateActivity.this, PushContactSelectionActivity.class);
|
||||
if (existingContacts != null) intent.putExtra(PushContactSelectionActivity.PUSH_ONLY_EXTRA, true);
|
||||
startActivityForResult(intent, PICK_CONTACT);
|
||||
}
|
||||
}
|
||||
@@ -533,9 +542,13 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
|
||||
@Override
|
||||
protected Pair<Long, Recipients> doInBackground(Void... params) {
|
||||
byte[] avatarBytes = null;
|
||||
if (avatarBmp != null) {
|
||||
final Bitmap bitmap;
|
||||
if (avatarBmp == null) bitmap = existingAvatarBmp;
|
||||
else bitmap = avatarBmp;
|
||||
|
||||
if (bitmap != null) {
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
avatarBmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
avatarBytes = stream.toByteArray();
|
||||
}
|
||||
final String name = (groupName.getText() != null) ? groupName.getText().toString() : null;
|
||||
|
||||
Reference in New Issue
Block a user