mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-19 00:41:30 +00:00
Only upload avatar if there was a change.
This commit is contained in:
parent
280d866df3
commit
f92506b7bb
@ -67,6 +67,7 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
@ -100,6 +101,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
|||||||
private View reveal;
|
private View reveal;
|
||||||
|
|
||||||
private Intent nextIntent;
|
private Intent nextIntent;
|
||||||
|
private byte[] originalAvatarBytes;
|
||||||
private byte[] avatarBytes;
|
private byte[] avatarBytes;
|
||||||
private File captureFile;
|
private File captureFile;
|
||||||
|
|
||||||
@ -305,6 +307,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(byte[] result) {
|
protected void onPostExecute(byte[] result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
originalAvatarBytes = result;
|
||||||
avatarBytes = result;
|
avatarBytes = result;
|
||||||
GlideApp.with(CreateProfileActivity.this)
|
GlideApp.with(CreateProfileActivity.this)
|
||||||
.load(result)
|
.load(result)
|
||||||
@ -318,6 +321,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess(byte[] result) {
|
public void onSuccess(byte[] result) {
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
|
originalAvatarBytes = result;
|
||||||
avatarBytes = result;
|
avatarBytes = result;
|
||||||
GlideApp.with(CreateProfileActivity.this)
|
GlideApp.with(CreateProfileActivity.this)
|
||||||
.load(result)
|
.load(result)
|
||||||
@ -396,6 +400,8 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Loki - Only update avatar if there was a change
|
||||||
|
if (!Arrays.equals(originalAvatarBytes, avatarBytes)) {
|
||||||
try {
|
try {
|
||||||
// Loki - Original profile photo code
|
// Loki - Original profile photo code
|
||||||
// ========
|
// ========
|
||||||
@ -429,6 +435,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
|||||||
Log.d("Loki", "Failed to upload profile photo: " + e);
|
Log.d("Loki", "Failed to upload profile photo: " + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ApplicationContext.getInstance(context).getJobManager().add(new MultiDeviceProfileKeyUpdateJob());
|
// ApplicationContext.getInstance(context).getJobManager().add(new MultiDeviceProfileKeyUpdateJob());
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user