Clean up RetrieveProfileAvatarJob

This commit is contained in:
Niels Andriesse 2021-05-14 10:56:47 +10:00
parent 133bcac17c
commit 88b4388e06

View File

@ -1,6 +1,5 @@
package org.thoughtcrime.securesms.jobs;
import android.app.Application;
import android.text.TextUtils;
@ -39,7 +38,7 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
private static final String TAG = RetrieveProfileAvatarJob.class.getSimpleName();
private static final int MAX_PROFILE_SIZE_BYTES = 20 * 1024 * 1024;
private static final int MAX_PROFILE_SIZE_BYTES = 10 * 1024 * 1024;
private static final String KEY_PROFILE_AVATAR = "profile_avatar";
private static final String KEY_ADDRESS = "address";
@ -54,7 +53,7 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
.setQueue("RetrieveProfileAvatarJob" + recipient.getAddress().serialize())
.addConstraint(NetworkConstraint.KEY)
.setLifespan(TimeUnit.HOURS.toMillis(1))
.setMaxAttempts(3)
.setMaxAttempts(10)
.build(),
recipient,
profileAvatar);
@ -62,7 +61,6 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
private RetrieveProfileAvatarJob(@NonNull Job.Parameters parameters, @NonNull Recipient recipient, String profileAvatar) {
super(parameters);
this.recipient = recipient;
this.profileAvatar = profileAvatar;
}
@ -70,7 +68,8 @@ public class RetrieveProfileAvatarJob extends BaseJob implements InjectableType
@Override
public @NonNull
Data serialize() {
return new Data.Builder().putString(KEY_PROFILE_AVATAR, profileAvatar)
return new Data.Builder()
.putString(KEY_PROFILE_AVATAR, profileAvatar)
.putString(KEY_ADDRESS, recipient.getAddress().serialize())
.build();
}