mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Added profile downloading.
This commit is contained in:
parent
06f75859fa
commit
7b842d2c1c
@ -409,7 +409,7 @@ public class CreateProfileActivity extends BaseActionBarActivity implements Inje
|
||||
if (avatar != null) {
|
||||
Log.d("Loki", "Start uploading profile photo");
|
||||
LokiStorageAPI storageAPI = LokiStorageAPI.shared;
|
||||
LokiDotNetAPI.UploadResult result = storageAPI.uploadProfilePhoto(storageAPI.getServer(), avatarBytes);
|
||||
LokiDotNetAPI.UploadResult result = storageAPI.uploadProfilePhoto(storageAPI.getServer(), profileKey, avatar);
|
||||
Log.d("Loki", "Profile photo uploaded, the url is " + result.getUrl());
|
||||
TextSecurePreferences.setProfileAvatarUrl(CreateProfileActivity.this, result.getUrl());
|
||||
} else {
|
||||
|
@ -317,7 +317,11 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Deleting the display name
|
||||
// Loki - Store profile avatar
|
||||
if (content.senderProfileAvatarUrl.isPresent()) {
|
||||
handleProfileAvatar(content, content.senderProfileAvatarUrl.get());
|
||||
}
|
||||
|
||||
if (content.getPairingAuthorisation().isPresent()) {
|
||||
handlePairingMessage(content.getPairingAuthorisation().get(), envelope, content);
|
||||
} else if (content.getDataMessage().isPresent()) {
|
||||
@ -1082,6 +1086,11 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
return authorisation.verify();
|
||||
}
|
||||
|
||||
private void handleProfileAvatar(SignalServiceContent content, String url) {
|
||||
Recipient primaryDevice = getPrimaryDeviceRecipient(content.getSender());
|
||||
ApplicationContext.getInstance(context).getJobManager().add(new RetrieveProfileAvatarJob(primaryDevice, url));
|
||||
}
|
||||
|
||||
private void handlePairingMessage(@NonNull PairingAuthorisation authorisation, @NonNull SignalServiceEnvelope envelope, @NonNull SignalServiceContent content) {
|
||||
String userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context);
|
||||
if (authorisation.getType() == PairingAuthorisation.Type.REQUEST) {
|
||||
|
@ -50,6 +50,7 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
|
||||
.addConstraint(NetworkConstraint.KEY)
|
||||
.setLifespan(TimeUnit.HOURS.toMillis(1))
|
||||
.setMaxInstances(1)
|
||||
.setMaxAttempts(2)
|
||||
.build(),
|
||||
recipient,
|
||||
profileAvatar);
|
||||
|
Loading…
Reference in New Issue
Block a user