mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-03 23:15:44 +01:00
Convert all the toList calls to collect(Collectors.toList)
Resolves #14718
This commit is contained in:
committed by
jeffrey-signal
parent
e9cdf0368e
commit
086883e565
@@ -19,6 +19,7 @@ package org.thoughtcrime.securesms;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -58,7 +59,7 @@ public class PushContactSelectionActivity extends ContactSelectionActivity {
|
||||
protected final void onFinishedSelection() {
|
||||
Intent resultIntent = getIntent();
|
||||
List<SelectedContact> selectedContacts = contactsFragment.getSelectedContacts();
|
||||
List<RecipientId> recipients = Stream.of(selectedContacts).map(sc -> sc.getOrCreateRecipientId()).toList();
|
||||
List<RecipientId> recipients = Stream.of(selectedContacts).map(sc -> sc.getOrCreateRecipientId()).collect(Collectors.toList());
|
||||
|
||||
resultIntent.putParcelableArrayListExtra(KEY_SELECTED_RECIPIENTS, new ArrayList<>(recipients));
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.annotation.MainThread;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.fasterxml.jackson.databind.type.CollectionType;
|
||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||
@@ -72,7 +73,7 @@ public class RecentEmojiPageModel implements EmojiPageModel {
|
||||
}
|
||||
|
||||
@Override public List<Emoji> getDisplayEmoji() {
|
||||
return Stream.of(getEmoji()).map(Emoji::new).toList();
|
||||
return Stream.of(getEmoji()).map(Emoji::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override public @Nullable Uri getSpriteUri() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.text.Spanned;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.database.model.Mention;
|
||||
@@ -56,8 +57,7 @@ public final class MentionAnnotation {
|
||||
int spanStart = spanned.getSpanStart(annotation);
|
||||
int spanLength = spanned.getSpanEnd(annotation) - spanStart;
|
||||
return new Mention(RecipientId.from(annotation.getValue()), spanStart, spanLength);
|
||||
})
|
||||
.toList();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -68,7 +68,6 @@ public final class MentionAnnotation {
|
||||
|
||||
public static @NonNull List<Annotation> getMentionAnnotations(@NonNull Spanned spanned, int start, int end) {
|
||||
return Stream.of(spanned.getSpans(start, end, Annotation.class))
|
||||
.filter(MentionAnnotation::isMentionAnnotation)
|
||||
.toList();
|
||||
.filter(MentionAnnotation::isMentionAnnotation).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,8 +73,7 @@ public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {
|
||||
List<Recipient> recipients = Stream.of(unknownSystemE164s)
|
||||
.filter(s -> s.startsWith("+"))
|
||||
.map(s -> Recipient.external(s))
|
||||
.filter(it -> it != null)
|
||||
.toList();
|
||||
.filter(it -> it != null).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
Log.i(TAG, "There are " + unknownSystemE164s.size() + " unknown E164s, which are now " + recipients.size() + " recipients. Only syncing these specific contacts.");
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
@@ -75,9 +76,9 @@ class ContactFieldAdapter extends RecyclerView.Adapter<ContactFieldAdapter.Conta
|
||||
fields.add(new Field(avatar));
|
||||
}
|
||||
|
||||
fields.addAll(Stream.of(phoneNumbers).map(phone -> new Field(context, phone, locale)).toList());
|
||||
fields.addAll(Stream.of(emails).map(email -> new Field(context, email)).toList());
|
||||
fields.addAll(Stream.of(postalAddresses).map(address -> new Field(context, address)).toList());
|
||||
fields.addAll(Stream.of(phoneNumbers).map(phone -> new Field(context, phone, locale)).collect(Collectors.toList()));
|
||||
fields.addAll(Stream.of(emails).map(email -> new Field(context, email)).collect(Collectors.toList()));
|
||||
fields.addAll(Stream.of(postalAddresses).map(address -> new Field(context, address)).collect(Collectors.toList()));
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.contactshare.Contact.Name;
|
||||
@@ -82,7 +83,7 @@ class ContactShareEditViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
private <E extends Selectable> List<E> trimSelectables(List<E> selectables) {
|
||||
return Stream.of(selectables).filter(Selectable::isSelected).toList();
|
||||
return Stream.of(selectables).filter(Selectable::isSelected).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -98,7 +98,7 @@ public final class ContactUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Phone> mobileNumbers = Stream.of(contact.getPhoneNumbers()).filter(number -> number.getType() == Phone.Type.MOBILE).toList();
|
||||
List<Phone> mobileNumbers = Stream.of(contact.getPhoneNumbers()).filter(number -> number.getType() == Phone.Type.MOBILE).collect(com.annimon.stream.Collectors.toList());
|
||||
if (mobileNumbers.size() > 0) {
|
||||
return mobileNumbers.get(0);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import androidx.core.view.ViewKt;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.vectordrawable.graphics.drawable.AnimatorInflaterCompat;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.ui.compose.SignalIcons;
|
||||
@@ -827,7 +828,7 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
||||
anim.setTarget(v);
|
||||
return anim;
|
||||
})
|
||||
.toList());
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
Animator backgroundHideAnim = AnimatorInflaterCompat.loadAnimator(getContext(), android.R.animator.fade_out);
|
||||
backgroundHideAnim.setTarget(backgroundView);
|
||||
|
||||
@@ -22,6 +22,7 @@ import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
|
||||
@@ -74,8 +75,7 @@ public final class SafetyNumberChangeDialog extends DialogFragment implements Sa
|
||||
List<String> ids = Stream.of(identityRecords)
|
||||
.filter(identityRecord -> !identityRecord.isFirstUse())
|
||||
.map(record -> record.getRecipientId().serialize())
|
||||
.distinct()
|
||||
.toList();
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putStringArray(RECIPIENT_IDS_EXTRA, ids.toArray(new String[0]));
|
||||
@@ -94,8 +94,7 @@ public final class SafetyNumberChangeDialog extends DialogFragment implements Sa
|
||||
|
||||
List<String> ids = Stream.of(recipientIds)
|
||||
.map(RecipientId::serialize)
|
||||
.distinct()
|
||||
.toList();
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
Bundle arguments = new Bundle();
|
||||
arguments.putStringArray(RECIPIENT_IDS_EXTRA, ids.toArray(new String[0]));
|
||||
@@ -118,7 +117,7 @@ public final class SafetyNumberChangeDialog extends DialogFragment implements Sa
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
||||
//noinspection ConstantConditions
|
||||
List<RecipientId> recipientIds = Stream.of(getArguments().getStringArray(RECIPIENT_IDS_EXTRA)).map(RecipientId::from).toList();
|
||||
List<RecipientId> recipientIds = Stream.of(getArguments().getStringArray(RECIPIENT_IDS_EXTRA)).map(RecipientId::from).collect(Collectors.toList());
|
||||
long messageId = getArguments().getLong(MESSAGE_ID_EXTRA, -1);
|
||||
String messageType = getArguments().getString(MESSAGE_TYPE_EXTRA, null);
|
||||
|
||||
|
||||
@@ -89,11 +89,10 @@ public final class SafetyNumberChangeRepository {
|
||||
messageRecord = getMessageRecord(messageId, messageType);
|
||||
}
|
||||
|
||||
List<Recipient> recipients = Stream.of(recipientIds).map(Recipient::resolved).toList();
|
||||
List<Recipient> recipients = Stream.of(recipientIds).map(Recipient::resolved).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
List<ChangedRecipient> changedRecipients = Stream.of(AppDependencies.getProtocolStore().aci().identities().getIdentityRecords(recipients).getIdentityRecords())
|
||||
.map(record -> new ChangedRecipient(Recipient.resolved(record.getRecipientId()), record))
|
||||
.toList();
|
||||
.map(record -> new ChangedRecipient(Recipient.resolved(record.getRecipientId()), record)).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
Log.d(TAG, "Safety number change state, message: " + (messageRecord != null ? messageRecord.getId() : "null") + " records: " + Util.join(changedRecipients, ","));
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.conversation.ui.error;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||
@@ -28,7 +29,7 @@ public class TrustAndVerifyResult {
|
||||
}
|
||||
|
||||
TrustAndVerifyResult(@NonNull List<ChangedRecipient> changedRecipients, @Nullable MessageRecord messageRecord, @NonNull Result result) {
|
||||
this.changedRecipients = Stream.of(changedRecipients).map(changedRecipient -> changedRecipient.getRecipient().getId()).toList();
|
||||
this.changedRecipients = Stream.of(changedRecipients).map(changedRecipient -> changedRecipient.getRecipient().getId()).collect(Collectors.toList());
|
||||
this.messageRecord = messageRecord;
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.lifecycle.Transformations;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.conversation.ui.mentions.MentionsPickerRepository.MentionQuery;
|
||||
@@ -40,7 +41,7 @@ public class MentionsPickerViewModel extends ViewModel {
|
||||
|
||||
LiveData<MentionQuery> mentionQuery = LiveDataUtil.combineLatest(liveQuery, fullMembers, (q, m) -> new MentionQuery(q.query, m));
|
||||
|
||||
this.mentionList = LiveDataUtil.mapAsync(mentionQuery, q -> Stream.of(mentionsPickerRepository.search(q)).<MappingModel<?>>map(MentionViewState::new).toList());
|
||||
this.mentionList = LiveDataUtil.mapAsync(mentionQuery, q -> Stream.of(mentionsPickerRepository.search(q)).<MappingModel<?>>map(MentionViewState::new).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@NonNull LiveData<List<MappingModel<?>>> getMentionList() {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SealedSenderAccessUtil {
|
||||
return Optional.ofNullable(unidentifiedAccess);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
int unidentifiedCount = Stream.of(access).filter(Optional::isPresent).toList().size();
|
||||
int unidentifiedCount = Stream.of(access).filter(Optional::isPresent).collect(com.annimon.stream.Collectors.toList()).size();
|
||||
int otherCount = access.size() - unidentifiedCount;
|
||||
|
||||
if (log) {
|
||||
|
||||
@@ -122,8 +122,7 @@ public final class MentionUtil {
|
||||
.map(mention -> {
|
||||
RecipientId id = Recipient.externalPush(ServiceId.parseOrThrow(mention.mentionUuid)).getId();
|
||||
return new Mention(id, mention.start, mention.length);
|
||||
})
|
||||
.toList();
|
||||
}).collect(com.annimon.stream.Collectors.toList());
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import android.os.SystemClock
|
||||
import android.preference.PreferenceManager
|
||||
import android.text.TextUtils
|
||||
import androidx.core.content.contentValuesOf
|
||||
import com.annimon.stream.Collectors
|
||||
import com.annimon.stream.Stream
|
||||
import org.signal.core.models.ServiceId.ACI
|
||||
import org.signal.core.util.Base64
|
||||
@@ -650,7 +651,7 @@ object V149_LegacyMigrations : SignalDatabaseMigration {
|
||||
val notificationManager = ServiceUtil.getNotificationManager(context)
|
||||
val channels = Stream.of(notificationManager.notificationChannels)
|
||||
.filter { c: NotificationChannel -> c.id.startsWith("contact_") }
|
||||
.toList()
|
||||
.collect(Collectors.toList())
|
||||
|
||||
Log.i(TAG, "Migrating " + channels.size + " channels to use RecipientId's.")
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.Transformations;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.fonts.SignalSymbols;
|
||||
@@ -42,8 +43,7 @@ public final class LiveUpdateMessage {
|
||||
}
|
||||
|
||||
List<LiveData<Recipient>> allMentionedRecipients = Stream.of(updateDescription.getMentioned())
|
||||
.map(uuid -> Recipient.resolved(RecipientId.from(uuid)).live().getLiveData())
|
||||
.toList();
|
||||
.map(uuid -> Recipient.resolved(RecipientId.from(uuid)).live().getLiveData()).collect(Collectors.toList());
|
||||
|
||||
LiveData<?> mentionedRecipientChangeStream = allMentionedRecipients.isEmpty() ? LiveDataUtil.just(new Object())
|
||||
: LiveDataUtil.merge(allMentionedRecipients);
|
||||
|
||||
@@ -30,6 +30,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.Base64;
|
||||
@@ -595,8 +596,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
|
||||
List<ServiceId> joinedMembers = Stream.of(groupCallUpdateDetails.inCallUuids)
|
||||
.map(UuidUtil::parseOrNull).filter(Objects::nonNull)
|
||||
.<ServiceId>map(ACI::from)
|
||||
.toList();
|
||||
.<ServiceId>map(ACI::from).collect(Collectors.toList());
|
||||
|
||||
UpdateDescription.SpannableFactory stringFactory = new GroupCallUpdateMessageFactory(context, joinedMembers, withTime, groupCallUpdateDetails);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.Transformations;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.models.ServiceId;
|
||||
@@ -92,8 +93,7 @@ public final class LiveGroup {
|
||||
Recipient recipient = Recipient.resolved(m);
|
||||
return new GroupMemberEntry.FullMember(recipient, g.isAdmin(recipient));
|
||||
})
|
||||
.sorted(MEMBER_ORDER)
|
||||
.toList());
|
||||
.sorted(MEMBER_ORDER).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
protected static LiveData<List<GroupMemberEntry.RequestingMember>> mapToRequestingMembers(@NonNull LiveData<GroupRecord> groupRecord) {
|
||||
@@ -110,8 +110,7 @@ public final class LiveGroup {
|
||||
.map(requestingMember -> {
|
||||
Recipient recipient = Recipient.externalPush(ServiceId.parseOrThrow(requestingMember.aciBytes));
|
||||
return new GroupMemberEntry.RequestingMember(recipient, selfAdmin);
|
||||
})
|
||||
.toList();
|
||||
}).collect(Collectors.toList());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -196,8 +195,7 @@ public final class LiveGroup {
|
||||
public LiveData<List<GroupMemberEntry.FullMember>> getNonAdminFullMembers() {
|
||||
return Transformations.map(fullMembers,
|
||||
members -> Stream.of(members)
|
||||
.filter(fullMember -> !fullMember.isAdmin())
|
||||
.toList());
|
||||
.filter(fullMember -> !fullMember.isAdmin()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public LiveData<List<GroupMemberEntry.FullMember>> getFullMembers() {
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@@ -81,7 +82,7 @@ public final class GroupMemberListView extends RecyclerView {
|
||||
}
|
||||
|
||||
public void setDisplayOnlyMembers(@NonNull List<Recipient> recipients) {
|
||||
membersAdapter.updateData(Stream.of(recipients).map(r -> new GroupMemberEntry.FullMember(r, false)).toList());
|
||||
membersAdapter.updateData(Stream.of(recipients).map(r -> new GroupMemberEntry.FullMember(r, false)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies;
|
||||
@@ -50,7 +51,7 @@ final class ChooseNewAdminViewModel extends ViewModel {
|
||||
|
||||
void updateAdminsAndLeave(@NonNull Consumer<GroupChangeResult> consumer) {
|
||||
//noinspection ConstantConditions
|
||||
List<RecipientId> recipientIds = Stream.of(selection.getValue()).map(entry -> entry.getMember().getId()).toList();
|
||||
List<RecipientId> recipientIds = Stream.of(selection.getValue()).map(entry -> entry.getMember().getId()).collect(Collectors.toList());
|
||||
SimpleTask.run(() -> repository.updateAdminsAndLeave(groupId, recipientIds), consumer::accept);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class JobController {
|
||||
@WorkerThread
|
||||
void submitNewJobChain(@NonNull List<List<Job>> chain) {
|
||||
synchronized (this) {
|
||||
chain = Stream.of(chain).filter(jobs -> !jobs.isEmpty()).toList();
|
||||
chain = Stream.of(chain).filter(jobs -> !jobs.isEmpty()).collect(Collectors.toList());
|
||||
|
||||
if (chain.isEmpty()) {
|
||||
Log.w(TAG, "Tried to submit an empty job chain. Skipping.");
|
||||
@@ -169,8 +169,7 @@ class JobController {
|
||||
|
||||
if (dependsOnQueue != null) {
|
||||
List<String> inQueue = Stream.of(jobStorage.getJobsInQueue(dependsOnQueue))
|
||||
.map(JobSpec::getId)
|
||||
.toList();
|
||||
.map(JobSpec::getId).collect(Collectors.toList());
|
||||
|
||||
allDependsOn.addAll(inQueue);
|
||||
aliveDependsOn.addAll(inQueue);
|
||||
@@ -310,8 +309,7 @@ class JobController {
|
||||
|
||||
List<Constraint> constraints = Stream.of(jobStorage.getConstraintSpecs(job.getId()))
|
||||
.map(ConstraintSpec::getFactoryKey)
|
||||
.map(constraintInstantiator::instantiate)
|
||||
.toList();
|
||||
.map(constraintInstantiator::instantiate).collect(Collectors.toList());
|
||||
|
||||
|
||||
Log.i(TAG, JobLogger.format(job, "Scheduling a retry in " + backoffInterval + " ms."));
|
||||
@@ -330,8 +328,7 @@ class JobController {
|
||||
List<JobSpec> updates = Stream.of(jobStorage.getDependencySpecsThatDependOnJob(job.getId()))
|
||||
.map(DependencySpec::getJobId)
|
||||
.map(jobStorage::getJobSpec)
|
||||
.map(jobSpec -> mapToJobWithInputData(jobSpec, outputData))
|
||||
.toList();
|
||||
.map(jobSpec -> mapToJobWithInputData(jobSpec, outputData)).collect(Collectors.toList());
|
||||
|
||||
jobStorage.updateJobs(updates);
|
||||
}
|
||||
@@ -352,14 +349,13 @@ class JobController {
|
||||
.map(jobSpec -> {
|
||||
List<ConstraintSpec> constraintSpecs = jobStorage.getConstraintSpecs(jobSpec.getId());
|
||||
return createJob(jobSpec, constraintSpecs);
|
||||
})
|
||||
.toList();
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
List<Job> all = new ArrayList<>(dependents.size() + 1);
|
||||
all.add(job);
|
||||
all.addAll(dependents);
|
||||
|
||||
jobStorage.deleteJobs(Stream.of(all).map(Job::getId).toList());
|
||||
jobStorage.deleteJobs(Stream.of(all).map(Job::getId).collect(Collectors.toList()));
|
||||
Stream.of(all).forEach(j -> jobTracker.onStateChange(j, JobTracker.JobState.FAILURE));
|
||||
|
||||
return dependents;
|
||||
@@ -594,7 +590,7 @@ class JobController {
|
||||
for (Job job : jobList) {
|
||||
fullSpecs.add(buildFullSpec(job, dependsOn));
|
||||
}
|
||||
dependsOn = Stream.of(jobList).map(Job::getId).toList();
|
||||
dependsOn = Stream.of(jobList).map(Job::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
jobStorage.insertJobs(fullSpecs);
|
||||
@@ -622,8 +618,7 @@ class JobController {
|
||||
job.getParameters().getInitialDelay());
|
||||
|
||||
List<ConstraintSpec> constraintSpecs = Stream.of(job.getParameters().getConstraintKeys())
|
||||
.map(key -> new ConstraintSpec(jobSpec.getId(), key, jobSpec.isMemoryOnly()))
|
||||
.toList();
|
||||
.map(key -> new ConstraintSpec(jobSpec.getId(), key, jobSpec.isMemoryOnly())).collect(Collectors.toList());
|
||||
|
||||
List<DependencySpec> dependencySpecs = Stream.of(dependsOn)
|
||||
.map(depends -> {
|
||||
@@ -631,8 +626,7 @@ class JobController {
|
||||
boolean memoryOnly = job.getParameters().isMemoryOnly() || (dependsOnJobSpec != null && dependsOnJobSpec.isMemoryOnly());
|
||||
|
||||
return new DependencySpec(job.getId(), depends, memoryOnly);
|
||||
})
|
||||
.toList();
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return new FullSpec(jobSpec, constraintSpecs, dependencySpecs);
|
||||
}
|
||||
@@ -660,8 +654,7 @@ class JobController {
|
||||
List<ConstraintSpec> constraintSpecs = jobStorage.getConstraintSpecs(minimalJobSpec.getId());
|
||||
List<Constraint> constraints = Stream.of(constraintSpecs)
|
||||
.map(ConstraintSpec::getFactoryKey)
|
||||
.map(constraintInstantiator::instantiate)
|
||||
.toList();
|
||||
.map(constraintInstantiator::instantiate).collect(Collectors.toList());
|
||||
|
||||
return Stream.of(constraints).allMatch(Constraint::isMet);
|
||||
});
|
||||
@@ -690,8 +683,7 @@ class JobController {
|
||||
Log.e(TAG, "Failed to instantiate job! Failing it and its dependencies without calling Job#onFailure. Crash imminent.");
|
||||
|
||||
List<String> failIds = Stream.of(jobStorage.getDependencySpecsThatDependOnJob(jobSpec.getId()))
|
||||
.map(DependencySpec::getJobId)
|
||||
.toList();
|
||||
.map(DependencySpec::getJobId).collect(Collectors.toList());
|
||||
|
||||
jobStorage.deleteJob(jobSpec.getId());
|
||||
jobStorage.deleteJobs(failIds);
|
||||
@@ -708,7 +700,7 @@ class JobController {
|
||||
.setLifespan(jobSpec.getLifespan())
|
||||
.setMaxAttempts(jobSpec.getMaxAttempts())
|
||||
.setQueue(jobSpec.getQueueKey())
|
||||
.setConstraints(Stream.of(constraintSpecs).map(ConstraintSpec::getFactoryKey).toList())
|
||||
.setConstraints(Stream.of(constraintSpecs).map(ConstraintSpec::getFactoryKey).collect(Collectors.toList()))
|
||||
.setInputData(jobSpec.getSerializedInputData())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.net.Uri;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -128,8 +129,7 @@ public class DownloadLatestEmojiDataJob extends BaseJob {
|
||||
String format = emojiData.getFormat();
|
||||
List<String> imagePaths = Stream.of(emojiData.getDataPages())
|
||||
.map(EmojiPageModel::getSpriteUri)
|
||||
.map(Uri::getLastPathSegment)
|
||||
.toList();
|
||||
.map(Uri::getLastPathSegment).collect(Collectors.toList());
|
||||
|
||||
String density = resolveDensity(supportedDensities, targetVersion.getDensity());
|
||||
targetVersion = new EmojiFiles.Version(targetVersion.getVersion(), targetVersion.getUuid(), density);
|
||||
|
||||
@@ -63,8 +63,7 @@ public class GroupCallUpdateSendJob extends BaseJob {
|
||||
|
||||
List<RecipientId> recipientIds = Stream.of(RecipientUtil.getEligibleForSending(Recipient.resolvedList(conversationRecipient.getParticipantIds())))
|
||||
.filter(recipient -> !recipient.isSelf())
|
||||
.map(Recipient::getId)
|
||||
.toList();
|
||||
.map(Recipient::getId).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
return new GroupCallUpdateSendJob(recipientId,
|
||||
eraId,
|
||||
@@ -127,7 +126,7 @@ public class GroupCallUpdateSendJob extends BaseJob {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Recipient> destinations = Stream.of(recipients).map(Recipient::resolved).toList();
|
||||
List<Recipient> destinations = Stream.of(recipients).map(Recipient::resolved).collect(com.annimon.stream.Collectors.toList());
|
||||
List<Recipient> completions = deliver(conversationRecipient, destinations);
|
||||
|
||||
for (Recipient completion : completions) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.Util;
|
||||
@@ -277,7 +278,7 @@ public class IndividualSendJob extends PushSendJob {
|
||||
|
||||
SignalServiceMessageSender messageSender = AppDependencies.getSignalServiceMessageSender();
|
||||
SignalServiceAddress address = RecipientUtil.toSignalServiceAddress(context, messageRecipient);
|
||||
List<Attachment> attachments = Stream.of(message.getAttachments()).filter(attachment -> !attachment.isSticker()).toList();
|
||||
List<Attachment> attachments = Stream.of(message.getAttachments()).filter(attachment -> !attachment.isSticker()).collect(Collectors.toList());
|
||||
List<SignalServiceAttachment> serviceAttachments = getAttachmentPointersFor(attachments);
|
||||
Optional<byte[]> profileKey = getProfileKey(messageRecipient);
|
||||
Optional<SignalServiceDataMessage.Sticker> sticker = getStickerFor(message);
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.jobs;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@@ -171,8 +172,7 @@ public class MultiDeviceReadUpdateJob extends BaseJob {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
})
|
||||
.map(id -> new SyncMessageId(RecipientId.from(id.recipientId), id.timestamp))
|
||||
.toList();
|
||||
.map(id -> new SyncMessageId(RecipientId.from(id.recipientId), id.timestamp)).collect(Collectors.toList());
|
||||
|
||||
return new MultiDeviceReadUpdateJob(parameters, ids);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.jobs;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@@ -166,8 +167,7 @@ public class MultiDeviceViewedUpdateJob extends BaseJob {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
})
|
||||
.map(id -> new SyncMessageId(RecipientId.from(id.recipientId), id.timestamp))
|
||||
.toList();
|
||||
.map(id -> new SyncMessageId(RecipientId.from(id.recipientId), id.timestamp)).collect(Collectors.toList());
|
||||
|
||||
return new MultiDeviceViewedUpdateJob(parameters, ids);
|
||||
}
|
||||
|
||||
@@ -95,10 +95,8 @@ public class ProfileKeySendJob extends BaseJob {
|
||||
List<RecipientId> recipients = conversationRecipient.isGroup()
|
||||
? RecipientUtil.getEligibleForSending(Recipient.resolvedList(conversationRecipient.getParticipantIds()))
|
||||
.stream()
|
||||
.map(Recipient::getId)
|
||||
.collect(Collectors.toList())
|
||||
: Stream.of(conversationRecipient.getId())
|
||||
.collect(Collectors.toList());
|
||||
.map(Recipient::getId).collect(Collectors.toList())
|
||||
: Stream.of(conversationRecipient.getId()).collect(Collectors.toList());
|
||||
|
||||
recipients.remove(Recipient.self().getId());
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ public final class PushDistributionListSendJob extends PushSendJob {
|
||||
targets.addAll(filterRecipientIds.stream().map(Recipient::resolved).collect(Collectors.toList()));
|
||||
targets.addAll(existingNetworkFailures.stream().map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).collect(Collectors.toList()));
|
||||
} else if (!existingNetworkFailures.isEmpty()) {
|
||||
targets = Stream.of(existingNetworkFailures).map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).toList();
|
||||
targets = Stream.of(existingNetworkFailures).map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).collect(com.annimon.stream.Collectors.toList());
|
||||
} else {
|
||||
Stories.SendData data = Stories.getRecipientsToSendTo(messageId, message.getSentTimeMillis(), message.getStoryType().isStoryWithReplies());
|
||||
targets = data.getTargets();
|
||||
@@ -206,7 +206,7 @@ public final class PushDistributionListSendJob extends PushSendJob {
|
||||
throws IOException, UntrustedIdentityException, UndeliverableMessageException
|
||||
{
|
||||
try {
|
||||
List<Attachment> attachments = Stream.of(message.getAttachments()).filter(attachment -> !attachment.isSticker()).toList();
|
||||
List<Attachment> attachments = Stream.of(message.getAttachments()).filter(attachment -> !attachment.isSticker()).collect(com.annimon.stream.Collectors.toList());
|
||||
List<SignalServiceAttachment> attachmentPointers = getAttachmentPointersFor(attachments);
|
||||
List<BodyRange> bodyRanges = getBodyRanges(message);
|
||||
boolean isRecipientUpdate = Stream.of(SignalDatabase.groupReceipts().getGroupReceiptInfo(messageId))
|
||||
|
||||
@@ -234,10 +234,10 @@ public final class PushGroupSendJob extends PushSendJob {
|
||||
|
||||
if (Util.hasItems(filterRecipients)) {
|
||||
target = new ArrayList<>(filterRecipients.size() + existingNetworkFailures.size());
|
||||
target.addAll(Stream.of(filterRecipients).map(Recipient::resolved).toList());
|
||||
target.addAll(Stream.of(existingNetworkFailures).map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).toList());
|
||||
target.addAll(Stream.of(filterRecipients).map(Recipient::resolved).collect(Collectors.toList()));
|
||||
target.addAll(Stream.of(existingNetworkFailures).map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).collect(Collectors.toList()));
|
||||
} else if (!existingNetworkFailures.isEmpty()) {
|
||||
target = Stream.of(existingNetworkFailures).map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).toList();
|
||||
target = Stream.of(existingNetworkFailures).map(NetworkFailure::getRecipientId).distinct().map(Recipient::resolved).collect(Collectors.toList());
|
||||
} else {
|
||||
GroupRecipientResult result = getGroupMessageRecipients(groupRecipient.requireGroupId(), messageId);
|
||||
|
||||
@@ -288,7 +288,7 @@ public final class PushGroupSendJob extends PushSendJob {
|
||||
SignalServiceDataMessage.PollCreate pollCreate = getPollCreate(message);
|
||||
SignalServiceDataMessage.PollTerminate pollTerminate = getPollTerminate(message);
|
||||
SignalServiceDataMessage.PinnedMessage pinnedMessage = getPinnedMessage(message);
|
||||
List<Attachment> attachments = Stream.of(message.getAttachments()).filter(attachment -> !attachment.isSticker()).toList();
|
||||
List<Attachment> attachments = Stream.of(message.getAttachments()).filter(attachment -> !attachment.isSticker()).collect(Collectors.toList());
|
||||
List<SignalServiceAttachment> attachmentPointers = getAttachmentPointersFor(attachments);
|
||||
boolean isRecipientUpdate = Stream.of(SignalDatabase.groupReceipts().getGroupReceiptInfo(messageId))
|
||||
.anyMatch(info -> info.getStatus() > GroupReceiptTable.STATUS_UNDELIVERED);
|
||||
@@ -444,17 +444,17 @@ public final class PushGroupSendJob extends PushSendJob {
|
||||
MessageTable database = SignalDatabase.messages();
|
||||
RecipientAccessList accessList = new RecipientAccessList(target);
|
||||
|
||||
List<NetworkFailure> networkFailures = Stream.of(results).filter(SendMessageResult::isNetworkFailure).map(result -> new NetworkFailure(accessList.requireIdByAddress(result.getAddress()))).toList();
|
||||
List<NetworkFailure> networkFailures = Stream.of(results).filter(SendMessageResult::isNetworkFailure).map(result -> new NetworkFailure(accessList.requireIdByAddress(result.getAddress()))).collect(Collectors.toList());
|
||||
List<IdentityKeyMismatch> identityMismatches = Stream.of(results).filter(result -> result.getIdentityFailure() != null)
|
||||
.map(result -> new IdentityKeyMismatch(accessList.requireIdByAddress(result.getAddress()), result.getIdentityFailure().getIdentityKey())).toList();
|
||||
.map(result -> new IdentityKeyMismatch(accessList.requireIdByAddress(result.getAddress()), result.getIdentityFailure().getIdentityKey())).collect(Collectors.toList());
|
||||
ProofRequiredException proofRequired = Stream.of(results).filter(r -> r.getProofRequiredFailure() != null).reduce((a,b) -> b).map(SendMessageResult::getProofRequiredFailure).orElse(null);
|
||||
List<SendMessageResult> successes = Stream.of(results).filter(result -> result.getSuccess() != null).toList();
|
||||
List<Pair<RecipientId, Boolean>> successUnidentifiedStatus = Stream.of(successes).map(result -> new Pair<>(accessList.requireIdByAddress(result.getAddress()), result.getSuccess().isUnidentified())).toList();
|
||||
List<SendMessageResult> successes = Stream.of(results).filter(result -> result.getSuccess() != null).collect(Collectors.toList());
|
||||
List<Pair<RecipientId, Boolean>> successUnidentifiedStatus = Stream.of(successes).map(result -> new Pair<>(accessList.requireIdByAddress(result.getAddress()), result.getSuccess().isUnidentified())).collect(Collectors.toList());
|
||||
Set<RecipientId> successIds = Stream.of(successUnidentifiedStatus).map(Pair::getFirst).collect(Collectors.toSet());
|
||||
Set<NetworkFailure> resolvedNetworkFailures = Stream.of(existingNetworkFailures).filter(failure -> successIds.contains(failure.getRecipientId())).collect(Collectors.toSet());
|
||||
Set<IdentityKeyMismatch> resolvedIdentityFailures = Stream.of(existingIdentityMismatches).filter(failure -> successIds.contains(failure.getRecipientId())).collect(Collectors.toSet());
|
||||
List<RecipientId> unregisteredRecipients = Stream.of(results).filter(SendMessageResult::isUnregisteredFailure).map(result -> RecipientId.from(result.getAddress())).toList();
|
||||
List<RecipientId> invalidPreKeyRecipients = Stream.of(results).filter(SendMessageResult::isInvalidPreKeyFailure).map(result -> RecipientId.from(result.getAddress())).toList();
|
||||
List<RecipientId> unregisteredRecipients = Stream.of(results).filter(SendMessageResult::isUnregisteredFailure).map(result -> RecipientId.from(result.getAddress())).collect(Collectors.toList());
|
||||
List<RecipientId> invalidPreKeyRecipients = Stream.of(results).filter(SendMessageResult::isInvalidPreKeyFailure).map(result -> RecipientId.from(result.getAddress())).collect(Collectors.toList());
|
||||
Set<RecipientId> skippedRecipients = new HashSet<>();
|
||||
|
||||
skippedRecipients.addAll(skipped);
|
||||
@@ -551,19 +551,17 @@ public final class PushGroupSendJob extends PushSendJob {
|
||||
possible = Stream.of(destinations)
|
||||
.map(GroupReceiptInfo::getRecipientId)
|
||||
.map(Recipient::resolved)
|
||||
.distinct()
|
||||
.toList();
|
||||
.distinct().collect(Collectors.toList());
|
||||
} else {
|
||||
Log.w(TAG, "No destinations found for group message " + groupId + " using current group membership");
|
||||
possible = Stream.of(SignalDatabase.groups()
|
||||
.getGroupMembers(groupId, GroupTable.MemberSet.FULL_MEMBERS_EXCLUDING_SELF))
|
||||
.map(Recipient::resolve)
|
||||
.distinct()
|
||||
.toList();
|
||||
.distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<Recipient> eligible = RecipientUtil.getEligibleForSending(possible);
|
||||
List<RecipientId> skipped = Stream.of(SetUtil.difference(possible, eligible)).map(Recipient::getId).toList();
|
||||
List<RecipientId> skipped = Stream.of(SetUtil.difference(possible, eligible)).map(Recipient::getId).collect(Collectors.toList());
|
||||
|
||||
return new GroupRecipientResult(eligible, skipped);
|
||||
}
|
||||
|
||||
@@ -217,15 +217,13 @@ public abstract class PushSendJob extends SendJob {
|
||||
attachments.addAll(message.getAttachments());
|
||||
|
||||
attachments.addAll(Stream.of(message.getLinkPreviews())
|
||||
.map(LinkPreview::getThumbnail)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get)
|
||||
.toList());
|
||||
.map(LinkPreview::getThumbnail)
|
||||
.filter(Optional::isPresent)
|
||||
.map(Optional::get).collect(com.annimon.stream.Collectors.toList()));
|
||||
|
||||
attachments.addAll(Stream.of(message.getSharedContacts())
|
||||
.map(Contact::getAvatar).filter(Objects::nonNull)
|
||||
.map(Contact.Avatar::getAttachment).filter(Objects::nonNull)
|
||||
.toList());
|
||||
.map(Contact::getAvatar).filter(Objects::nonNull)
|
||||
.map(Contact.Avatar::getAttachment).filter(Objects::nonNull).collect(com.annimon.stream.Collectors.toList()));
|
||||
|
||||
HashSet<String> jobs = new HashSet<>(Stream.of(attachments).map(a -> {
|
||||
final AttachmentId attachmentId = ((DatabaseAttachment) a).attachmentId;
|
||||
@@ -237,8 +235,7 @@ public abstract class PushSendJob extends SendJob {
|
||||
.enqueue();
|
||||
|
||||
return attachmentUploadJob.getId();
|
||||
})
|
||||
.toList());
|
||||
}).collect(com.annimon.stream.Collectors.toList()));
|
||||
|
||||
if (message.getOutgoingQuote() != null && message.getOutgoingQuote().getAttachment() != null) {
|
||||
AttachmentId attachmentId = ((DatabaseAttachment) message.getOutgoingQuote().getAttachment()).attachmentId;
|
||||
@@ -254,7 +251,7 @@ public abstract class PushSendJob extends SendJob {
|
||||
}
|
||||
|
||||
protected @NonNull List<SignalServiceAttachment> getAttachmentPointersFor(List<Attachment> attachments) {
|
||||
return Stream.of(attachments).map(this::getAttachmentPointerFor).filter(a -> a != null).toList();
|
||||
return Stream.of(attachments).map(this::getAttachmentPointerFor).filter(a -> a != null).collect(com.annimon.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
protected @Nullable SignalServiceAttachment getAttachmentPointerFor(Attachment attachment) {
|
||||
@@ -434,13 +431,12 @@ public abstract class PushSendJob extends SendJob {
|
||||
return Stream.of(mediaMessage.getLinkPreviews()).map(lp -> {
|
||||
SignalServiceAttachment attachment = lp.getThumbnail().isPresent() ? getAttachmentPointerFor(lp.getThumbnail().get()) : null;
|
||||
return new SignalServicePreview(lp.getUrl(), lp.getTitle(), lp.getDescription(), lp.getDate(), Optional.ofNullable(attachment));
|
||||
}).toList();
|
||||
}).collect(com.annimon.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
List<SignalServiceDataMessage.Mention> getMentionsFor(@NonNull List<Mention> mentions) {
|
||||
return Stream.of(mentions)
|
||||
.map(m -> new SignalServiceDataMessage.Mention(Recipient.resolved(m.getRecipientId()).requireAci(), m.getStart(), m.getLength()))
|
||||
.toList();
|
||||
.map(m -> new SignalServiceDataMessage.Mention(Recipient.resolved(m.getRecipientId()).requireAci(), m.getStart(), m.getLength())).collect(com.annimon.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
@Nullable SignalServiceDataMessage.GiftBadge getGiftBadgeFor(@NonNull OutgoingMessage message) throws UndeliverableMessageException {
|
||||
|
||||
@@ -50,8 +50,8 @@ public abstract class SendJob extends BaseJob {
|
||||
List<Attachment> attachments = new LinkedList<>();
|
||||
|
||||
attachments.addAll(message.getAttachments());
|
||||
attachments.addAll(Stream.of(message.getLinkPreviews()).map(lp -> lp.getThumbnail().orElse(null)).filter(Objects::nonNull).toList());
|
||||
attachments.addAll(Stream.of(message.getSharedContacts()).map(Contact::getAvatarAttachment).filter(Objects::nonNull).toList());
|
||||
attachments.addAll(Stream.of(message.getLinkPreviews()).map(lp -> lp.getThumbnail().orElse(null)).filter(Objects::nonNull).collect(com.annimon.stream.Collectors.toList()));
|
||||
attachments.addAll(Stream.of(message.getSharedContacts()).map(Contact::getAvatarAttachment).filter(Objects::nonNull).collect(com.annimon.stream.Collectors.toList()));
|
||||
|
||||
if (message.getOutgoingQuote() != null && message.getOutgoingQuote().getAttachment() != null) {
|
||||
attachments.add(message.getOutgoingQuote().getAttachment());
|
||||
|
||||
@@ -331,7 +331,7 @@ class StorageSyncJob private constructor(parameters: Parameters, private var loc
|
||||
processKnownRecords(context, remoteOnly)
|
||||
|
||||
val unknownInserts: List<SignalStorageRecord> = remoteOnly.unknown
|
||||
val unknownDeletes = Stream.of(idDifference.localOnlyIds).filter { obj: StorageId -> obj.isUnknown }.toList()
|
||||
val unknownDeletes = Stream.of(idDifference.localOnlyIds).filter { obj: StorageId -> obj.isUnknown }.collect(com.annimon.stream.Collectors.toList())
|
||||
|
||||
Log.i(TAG, "[Remote Sync] Unknowns :: " + unknownInserts.size + " inserts, " + unknownDeletes.size + " deletes")
|
||||
|
||||
@@ -377,7 +377,7 @@ class StorageSyncJob private constructor(parameters: Parameters, private var loc
|
||||
val localStorageIds = getAllLocalStorageIds(self)
|
||||
val idDifference = StorageSyncHelper.findIdDifference(remoteManifest.storageIds, localStorageIds)
|
||||
val remoteInserts = buildLocalStorageRecords(context, self, idDifference.localOnlyIds.stream().filter { it: StorageId -> !it.isUnknown }.collect(Collectors.toList()))
|
||||
val remoteDeletes = Stream.of(idDifference.remoteOnlyIds).map { obj: StorageId -> obj.raw }.toList()
|
||||
val remoteDeletes = Stream.of(idDifference.remoteOnlyIds).map { obj: StorageId -> obj.raw }.collect(com.annimon.stream.Collectors.toList())
|
||||
|
||||
Log.i(TAG, "ID Difference :: $idDifference")
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.jobs;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -128,8 +129,7 @@ public class TypingSendJob extends BaseJob {
|
||||
}
|
||||
|
||||
recipients = RecipientUtil.getEligibleForSending(Stream.of(recipients)
|
||||
.map(Recipient::resolve)
|
||||
.toList());
|
||||
.map(Recipient::resolve).collect(Collectors.toList()));
|
||||
|
||||
SignalServiceTypingMessage typingMessage = new SignalServiceTypingMessage(typing ? Action.STARTED : Action.STOPPED, System.currentTimeMillis(), groupId);
|
||||
|
||||
|
||||
@@ -62,8 +62,7 @@ public final class LinkPreviewUtil {
|
||||
|
||||
return new Links(Stream.of(spannable.getSpans(0, spannable.length(), URLSpan.class))
|
||||
.map(span -> new Link(span.getURL(), spannable.getSpanStart(span)))
|
||||
.filter(link -> LinkUtil.isValidPreviewUrl(link.url))
|
||||
.toList());
|
||||
.filter(link -> LinkUtil.isValidPreviewUrl(link.url)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public static @NonNull OpenGraph parseOpenGraphFields(@Nullable String html) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.json.JSONException;
|
||||
@@ -404,8 +405,7 @@ public class SubmitDebugLogRepository {
|
||||
|
||||
List<LogLine> lines = Stream.of(Pattern.compile("\\n").split(content))
|
||||
.map(s -> new SimpleLogLine(s, LogStyleParser.parseStyle(s), LogStyleParser.parsePlaceholderType(s)))
|
||||
.map(line -> (LogLine) line)
|
||||
.toList();
|
||||
.map(line -> (LogLine) line).collect(Collectors.toList());
|
||||
|
||||
out.addAll(lines);
|
||||
}
|
||||
|
||||
@@ -164,8 +164,7 @@ public class MediaRepository {
|
||||
folder.getCount(),
|
||||
folder.getBucketId(),
|
||||
MediaFolder.FolderType.NORMAL))
|
||||
.sorted((o1, o2) -> o1.getTitle().toLowerCase().compareTo(o2.getTitle().toLowerCase()))
|
||||
.toList();
|
||||
.sorted((o1, o2) -> o1.getTitle().toLowerCase().compareTo(o2.getTitle().toLowerCase())).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
Uri allMediaThumbnail = imageFolders.getThumbnailTimestamp() > videoFolders.getThumbnailTimestamp() ? imageFolders.getThumbnail() : videoFolders.getThumbnail();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
@@ -99,8 +100,7 @@ public final class Megaphones {
|
||||
.map(Map.Entry::getKey)
|
||||
.map(records::get)
|
||||
.map(record -> Megaphones.forRecord(context, record))
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
.filter(Objects::nonNull).collect(Collectors.toList());
|
||||
|
||||
if (megaphones.size() > 0) {
|
||||
return megaphones.get(0);
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.migrations;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -75,7 +76,7 @@ public class StickerAdditionMigrationJob extends MigrationJob {
|
||||
public @NonNull StickerAdditionMigrationJob create(@NonNull Parameters parameters, @Nullable byte[] serializedData) {
|
||||
JsonJobData data = JsonJobData.deserialize(serializedData);
|
||||
String[] raw = data.getStringArray(KEY_PACKS);
|
||||
List<BlessedPacks.Pack> packs = Stream.of(raw).map(BlessedPacks.Pack::fromJson).toList();
|
||||
List<BlessedPacks.Pack> packs = Stream.of(raw).map(BlessedPacks.Pack::fromJson).collect(Collectors.toList());
|
||||
|
||||
return new StickerAdditionMigrationJob(parameters, packs);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package org.thoughtcrime.securesms.mms;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.libsignal.zkgroup.InvalidInputException;
|
||||
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
|
||||
import org.signal.storageservice.storage.protos.groups.local.DecryptedGroup;
|
||||
@@ -29,6 +27,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Represents either a GroupV1 or GroupV2 encoded context.
|
||||
@@ -131,13 +130,13 @@ public final class MessageGroupContext {
|
||||
public @NonNull List<RecipientId> getMembersListExcludingSelf() {
|
||||
RecipientId selfId = Recipient.self().getId();
|
||||
|
||||
return Stream.of(groupContext.members)
|
||||
return groupContext.members.stream()
|
||||
.filter(m -> SignalE164Util.isPotentialE164(m.e164))
|
||||
.map(m -> m.e164)
|
||||
.filter(Objects::nonNull)
|
||||
.map(RecipientId::fromE164)
|
||||
.filter(other -> !selfId.equals(other))
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +172,7 @@ public final class MessageGroupContext {
|
||||
DecryptedGroup groupState = decryptedGroupV2Context.groupState;
|
||||
DecryptedGroupChange groupChange = getChange();
|
||||
|
||||
return java.util.stream.Stream.of(DecryptedGroupUtil.toAciList(groupState.members),
|
||||
return Stream.of(DecryptedGroupUtil.toAciList(groupState.members),
|
||||
DecryptedGroupUtil.pendingToServiceIdList(groupState.pendingMembers),
|
||||
DecryptedGroupUtil.removedMembersServiceIdList(groupChange),
|
||||
DecryptedGroupUtil.removedPendingMembersServiceIdList(groupChange),
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.thoughtcrime.securesms.mms;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
@@ -110,7 +111,7 @@ public class SlideDeck {
|
||||
}
|
||||
|
||||
public @NonNull List<Slide> getThumbnailSlides() {
|
||||
return Stream.of(slides).filter(Slide::hasImage).toList();
|
||||
return Stream.of(slides).filter(Slide::hasImage).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public @Nullable AudioSlide getAudioSlide() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
import com.bumptech.glide.util.ContentLengthInputStream;
|
||||
|
||||
@@ -141,8 +142,7 @@ public class ChunkedDataFetcher {
|
||||
requestPattern = Stream.of(getRequestPattern(contentLength - firstChunk.get().getSecond()))
|
||||
.map(b -> new ByteRange(b.start + firstChunk.get().getSecond(),
|
||||
b.end + firstChunk.get().getSecond(),
|
||||
b.ignoreFirst))
|
||||
.toList();
|
||||
b.ignoreFirst)).collect(Collectors.toList());
|
||||
} else {
|
||||
requestPattern = getRequestPattern(contentLength);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class ChunkedDataFetcher {
|
||||
}
|
||||
|
||||
SignalExecutors.UNBOUNDED.execute(() -> {
|
||||
List<CallRequestController> controllers = Stream.of(requestPattern).map(range -> makeChunkRequest(client, url, range)).toList();
|
||||
List<CallRequestController> controllers = Stream.of(requestPattern).map(range -> makeChunkRequest(client, url, range)).collect(Collectors.toList());
|
||||
List<InputStream> streams = new ArrayList<>(controllers.size() + (firstChunk.isPresent() ? 1 : 0));
|
||||
|
||||
if (firstChunk.isPresent()) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.net;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -44,8 +45,7 @@ public class CustomDns implements Dns {
|
||||
List<InetAddress> ipv4Addresses = Stream.of(records)
|
||||
.filter(r -> r.getType() == Type.A)
|
||||
.map(r -> (ARecord) r)
|
||||
.map(ARecord::getAddress)
|
||||
.toList();
|
||||
.map(ARecord::getAddress).collect(Collectors.toList());
|
||||
if (ipv4Addresses.size() > 0) {
|
||||
return ipv4Addresses;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kotlin.Pair;
|
||||
|
||||
public class MarkReadReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = Log.tag(MarkReadReceiver.class);
|
||||
@@ -75,12 +77,10 @@ public class MarkReadReceiver extends BroadcastReceiver {
|
||||
if (markedReadMessages.isEmpty()) return;
|
||||
|
||||
List<SyncMessageId> syncMessageIds = Stream.of(markedReadMessages)
|
||||
.map(MarkedMessageInfo::getSyncMessageId)
|
||||
.toList();
|
||||
.map(MarkedMessageInfo::getSyncMessageId).collect(Collectors.toList());
|
||||
List<ExpirationInfo> expirationInfo = Stream.of(markedReadMessages)
|
||||
.map(MarkedMessageInfo::getExpirationInfo)
|
||||
.filter(info -> info.getExpiresIn() > 0 && info.getExpireStarted() <= 0)
|
||||
.toList();
|
||||
.filter(info -> info.getExpiresIn() > 0 && info.getExpireStarted() <= 0).collect(Collectors.toList());
|
||||
|
||||
scheduleDeletion(expirationInfo);
|
||||
|
||||
@@ -121,10 +121,10 @@ public class MarkReadReceiver extends BroadcastReceiver {
|
||||
private static void scheduleDeletion(@NonNull List<ExpirationInfo> expirationInfo) {
|
||||
if (expirationInfo.size() > 0) {
|
||||
long now = System.currentTimeMillis();
|
||||
SignalDatabase.messages().markExpireStarted(Stream.of(expirationInfo).map(info -> new kotlin.Pair<>(info.getId(), now)).toList());
|
||||
SignalDatabase.messages().markExpireStarted(Stream.of(expirationInfo).map(info -> new Pair<>(info.getId(), now)).collect(Collectors.toList()));
|
||||
|
||||
AppDependencies.getExpiringMessageManager()
|
||||
.scheduleDeletion(Stream.of(expirationInfo).map(info -> info.copy(info.getId(), info.getExpiresIn(), now, info.isMms())).toList());
|
||||
.scheduleDeletion(Stream.of(expirationInfo).map(info -> info.copy(info.getId(), info.getExpiresIn(), now, info.isMms())).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.lifecycle.Transformations;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -197,8 +198,7 @@ public class PaymentsHomeViewModel extends ViewModel {
|
||||
{
|
||||
List<PaymentItem> paymentItems = Stream.of(payments)
|
||||
.limit(MAX_PAYMENT_ITEMS)
|
||||
.map(PaymentItem::fromPayment)
|
||||
.toList();
|
||||
.map(PaymentItem::fromPayment).collect(Collectors.toList());
|
||||
|
||||
return state.updatePayments(paymentItems, payments.size());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -58,8 +59,7 @@ public class PaymentsRepository {
|
||||
private void updateDatabaseWithNewBlockInformation(@NonNull List<Payment> reconcileOutput) {
|
||||
List<LedgerReconcile.BlockOverridePayment> blockOverridePayments = Stream.of(reconcileOutput)
|
||||
.filter(x -> x instanceof LedgerReconcile.BlockOverridePayment)
|
||||
.map(x -> (LedgerReconcile.BlockOverridePayment)x)
|
||||
.toList();
|
||||
.map(x -> (LedgerReconcile.BlockOverridePayment)x).collect(Collectors.toList());
|
||||
|
||||
if (blockOverridePayments.isEmpty()) {
|
||||
return;
|
||||
@@ -103,7 +103,6 @@ public class PaymentsRepository {
|
||||
@NonNull Direction direction)
|
||||
{
|
||||
return Stream.of(payments)
|
||||
.filter(p -> p.getDirection() == direction)
|
||||
.toList();
|
||||
.filter(p -> p.getDirection() == direction).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.util.Currency;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
import kotlin.Pair;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
@@ -131,7 +130,7 @@ public final class SetCurrencyViewModel extends ViewModel {
|
||||
private static final List<Currency> DEFAULT_CURRENCIES = Stream.of(BuildConfig.DEFAULT_CURRENCIES.split(","))
|
||||
.map(CurrencyUtil::getCurrencyByCurrencyCode)
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
.collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
private final Currency currentCurrency;
|
||||
private final CurrencyExchange currencyExchange;
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class LedgerReconcile {
|
||||
private static @NonNull List<Payment> reconcile(@NonNull Collection<? extends Payment> allLocalPaymentTransactions,
|
||||
@NonNull List<MobileCoinLedgerWrapper.OwnedTxo> allTxOuts)
|
||||
{
|
||||
List<? extends Payment> nonFailedLocalPayments = Stream.of(allLocalPaymentTransactions).filter(i -> i.getState() != State.FAILED).toList();
|
||||
List<? extends Payment> nonFailedLocalPayments = Stream.of(allLocalPaymentTransactions).filter(i -> i.getState() != State.FAILED).collect(Collectors.toList());
|
||||
Set<ByteString> allKnownPublicKeys = new HashSet<>(nonFailedLocalPayments.size());
|
||||
Set<ByteString> allKnownKeyImages = new HashSet<>(nonFailedLocalPayments.size());
|
||||
|
||||
@@ -80,7 +80,7 @@ public final class LedgerReconcile {
|
||||
unknownTxOutsSpent.removeAll(knownTxosByKeyImage);
|
||||
|
||||
if (unknownTxOutsReceived.isEmpty() && unknownTxOutsSpent.isEmpty()) {
|
||||
return Stream.of(allLocalPaymentTransactions).map(t -> (Payment) t).toList();
|
||||
return Stream.of(allLocalPaymentTransactions).map(t -> (Payment) t).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<DetailedTransaction> detailedTransactions = reconstructAllTransactions(unknownTxOutsReceived, unknownTxOutsSpent);
|
||||
@@ -224,14 +224,12 @@ public final class LedgerReconcile {
|
||||
return Stream.of(transactionReconstruction.getAllTransactions())
|
||||
.map(t -> new DetailedTransaction(blockDetail, t));
|
||||
})
|
||||
.sorted(DetailedTransaction.DESCENDING)
|
||||
.toList();
|
||||
.sorted(DetailedTransaction.DESCENDING).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static @NonNull List<Money.MobileCoin> toMobileCoinList(@NonNull List<MobileCoinLedgerWrapper.OwnedTxo> spent) {
|
||||
return Stream.of(spent)
|
||||
.map(MobileCoinLedgerWrapper.OwnedTxo::getValue)
|
||||
.toList();
|
||||
.map(MobileCoinLedgerWrapper.OwnedTxo::getValue).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static class BlockOverridePayment extends PaymentDecorator {
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.groups.GroupId;
|
||||
@@ -92,8 +93,7 @@ public class ReviewCardViewModel extends ViewModel {
|
||||
repository.loadGroupsInCommonCount(r) - (isGroupThread ? 1 : 0),
|
||||
getCardType(r),
|
||||
getPrimaryAction(r, isSelfGroupAdmin),
|
||||
getSecondaryAction(r)))
|
||||
.toList();
|
||||
getSecondaryAction(r))).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,7 @@ public class ReactionsViewModel extends ViewModel {
|
||||
.sorted(this::compareReactions)
|
||||
.map(entry -> new EmojiCount(entry.getKey(),
|
||||
getCountDisplayEmoji(entry.getValue()),
|
||||
entry.getValue()))
|
||||
.toList();
|
||||
entry.getValue())).collect(Collectors.toList());
|
||||
|
||||
emojiCounts.add(0, EmojiCount.all(reactionList));
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.ThreadUtil;
|
||||
@@ -39,17 +40,15 @@ final class ReactWithAnyEmojiRepository {
|
||||
this.emojiPages = new LinkedList<>();
|
||||
|
||||
emojiPages.addAll(Stream.of(EmojiSource.getLatest().getDisplayPages())
|
||||
.filter(p -> p.getIconAttr() != EmojiCategory.EMOTICONS.getIcon())
|
||||
.map(page -> new ReactWithAnyEmojiPage(Collections.singletonList(new ReactWithAnyEmojiPageBlock(EmojiCategory.getCategoryLabel(page.getIconAttr()), page))))
|
||||
.toList());
|
||||
.filter(p -> p.getIconAttr() != EmojiCategory.EMOTICONS.getIcon())
|
||||
.map(page -> new ReactWithAnyEmojiPage(Collections.singletonList(new ReactWithAnyEmojiPageBlock(EmojiCategory.getCategoryLabel(page.getIconAttr()), page)))).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<ReactWithAnyEmojiPage> getEmojiPageModels(@NonNull List<ReactionDetails> thisMessagesReactions) {
|
||||
List<ReactWithAnyEmojiPage> pages = new LinkedList<>();
|
||||
List<String> thisMessage = Stream.of(thisMessagesReactions)
|
||||
.map(ReactionDetails::getDisplayEmoji)
|
||||
.distinct()
|
||||
.toList();
|
||||
.distinct().collect(Collectors.toList());
|
||||
|
||||
if (thisMessage.isEmpty()) {
|
||||
pages.add(new ReactWithAnyEmojiPage(Collections.singletonList(new ReactWithAnyEmojiPageBlock(R.string.ReactWithAnyEmojiBottomSheetDialogFragment__recently_used, recentEmojiPageModel))));
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.net.Uri;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
@@ -42,7 +43,7 @@ class ThisMessageEmojiPageModel implements EmojiPageModel {
|
||||
|
||||
@Override
|
||||
public @NonNull List<Emoji> getDisplayEmoji() {
|
||||
return Stream.of(getEmoji()).map(Emoji::new).toList();
|
||||
return Stream.of(getEmoji()).map(Emoji::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -108,8 +108,7 @@ public class RecipientUtil {
|
||||
{
|
||||
List<Recipient> recipientsWithoutUuids = Stream.of(recipients)
|
||||
.map(Recipient::resolve)
|
||||
.filter(recipient -> !recipient.getHasServiceId())
|
||||
.toList();
|
||||
.filter(recipient -> !recipient.getHasServiceId()).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
if (recipientsWithoutUuids.size() > 0) {
|
||||
ContactDiscovery.refresh(context, recipientsWithoutUuids, false);
|
||||
@@ -132,8 +131,7 @@ public class RecipientUtil {
|
||||
public static List<Recipient> getEligibleForSending(@NonNull List<Recipient> recipients) {
|
||||
return Stream.of(recipients)
|
||||
.filter(r -> r.getRegistered() != RegisteredState.NOT_REGISTERED)
|
||||
.filter(r -> !r.isBlocked())
|
||||
.toList();
|
||||
.filter(r -> !r.isBlocked()).collect(com.annimon.stream.Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.util.LongSparseArray;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -193,8 +194,7 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
|
||||
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
|
||||
|
||||
List<GroupCall.GroupMemberInfo> members = Stream.of(GroupManager.getUuidCipherTexts(context, group.requireGroupId().requireV2()))
|
||||
.map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize()))
|
||||
.toList();
|
||||
.map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize())).collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
groupCall.setGroupMembers(new ArrayList<>(members));
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.LongSparseArray;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -255,8 +256,7 @@ public class GroupConnectedActionProcessor extends GroupActionProcessor {
|
||||
|
||||
List<UUID> members = Stream.of(currentState.getCallInfoState().getRemoteCallParticipants())
|
||||
.filter(p -> p.getRecipient().getHasServiceId())
|
||||
.map(p -> p.getRecipient().requireServiceId().getRawUuid())
|
||||
.toList();
|
||||
.map(p -> p.getRecipient().requireServiceId().getRawUuid()).collect(Collectors.toList());
|
||||
webRtcInteractor.updateGroupCallUpdateMessage(currentState.getCallInfoState().getCallRecipient().getId(), eraId, members, false);
|
||||
|
||||
currentState = currentState.builder()
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.os.ResultReceiver;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -144,8 +145,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
}
|
||||
|
||||
List<Recipient> callParticipants = Stream.of(peekInfo.getJoinedMembers())
|
||||
.map(uuid -> Recipient.externalPush(ACI.from(uuid)))
|
||||
.toList();
|
||||
.map(uuid -> Recipient.externalPush(ACI.from(uuid))).collect(Collectors.toList());
|
||||
|
||||
WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder()
|
||||
.changeCallInfoState()
|
||||
|
||||
@@ -482,8 +482,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
ExternalGroupCredential credential = GroupManager.getExternalGroupCredential(context, groupId);
|
||||
|
||||
List<GroupCall.GroupMemberInfo> members = Stream.of(GroupManager.getUuidCipherTexts(context, groupId))
|
||||
.map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize()))
|
||||
.toList();
|
||||
.map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize())).collect(com.annimon.stream.Collectors.toList());
|
||||
callManager.peekGroupCall(SignalStore.internal().getGroupCallingServer(), credential.token.getBytes(Charsets.UTF_8), members, peekInfo -> {
|
||||
Long threadId = SignalDatabase.threads().getThreadIdFor(group.getId());
|
||||
|
||||
@@ -961,8 +960,7 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||
List<Pair<String, String>> headerPairs;
|
||||
if (headers != null) {
|
||||
headerPairs = Stream.of(headers)
|
||||
.map(header -> new Pair<>(header.getName(), header.getValue()))
|
||||
.toList();
|
||||
.map(header -> new Pair<>(header.getName(), header.getValue())).collect(com.annimon.stream.Collectors.toList());
|
||||
} else {
|
||||
headerPairs = Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.os.ResultReceiver;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -534,8 +535,7 @@ public abstract class WebRtcActionProcessor {
|
||||
Log.i(tag, "handleSendIceCandidates(): id: " + callMetadata.getCallId().format(callMetadata.getRemoteDevice()));
|
||||
|
||||
List<IceUpdateMessage> iceUpdateMessages = Stream.of(iceCandidates)
|
||||
.map(c -> new IceUpdateMessage(callMetadata.getCallId().longValue(), c))
|
||||
.toList();
|
||||
.map(c -> new IceUpdateMessage(callMetadata.getCallId().longValue(), c)).collect(Collectors.toList());
|
||||
|
||||
Integer destinationDeviceId = broadcast ? null : callMetadata.getRemoteDevice();
|
||||
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forIceUpdates(iceUpdateMessages, destinationDeviceId);
|
||||
|
||||
@@ -248,7 +248,7 @@ public final class MultiShareArgs implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeTypedList(Stream.of(contactSearchKeys).map(ContactSearchKey::requireRecipientSearchKey).toList());
|
||||
dest.writeTypedList(Stream.of(contactSearchKeys).map(ContactSearchKey::requireRecipientSearchKey).collect(com.annimon.stream.Collectors.toList()));
|
||||
dest.writeTypedList(media);
|
||||
dest.writeString(draftText);
|
||||
dest.writeParcelable(stickerLocator, flags);
|
||||
|
||||
@@ -10,8 +10,6 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.util.Consumer;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.BreakIteratorCompat;
|
||||
import org.signal.core.util.ThreadUtil;
|
||||
import org.signal.core.util.concurrent.SimpleTask;
|
||||
@@ -62,6 +60,7 @@ import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import okio.Utf8;
|
||||
|
||||
@@ -245,11 +244,11 @@ public final class MultiShareSender {
|
||||
if (slide instanceof VideoSlide) {
|
||||
return expandToClips(context, (VideoSlide) slide).stream();
|
||||
} else if (slide instanceof ImageSlide) {
|
||||
return java.util.stream.Stream.of(ensureDefaultQuality(context, (ImageSlide) slide));
|
||||
return Stream.of(ensureDefaultQuality(context, (ImageSlide) slide));
|
||||
} else if (slide instanceof StickerSlide) {
|
||||
return java.util.stream.Stream.empty();
|
||||
return Stream.empty();
|
||||
} else {
|
||||
return java.util.stream.Stream.of(slide);
|
||||
return Stream.of(slide);
|
||||
}
|
||||
})
|
||||
.filter(it -> MediaUtil.isStorySupportedType(it.getContentType()))
|
||||
@@ -489,11 +488,11 @@ public final class MultiShareSender {
|
||||
}
|
||||
|
||||
public boolean containsFailures() {
|
||||
return Stream.of(results).anyMatch(result -> result.type != MultiShareSendResult.Type.SUCCESS);
|
||||
return results.stream().anyMatch(result -> result.type != MultiShareSendResult.Type.SUCCESS);
|
||||
}
|
||||
|
||||
public boolean containsOnlyFailures() {
|
||||
return Stream.of(results).allMatch(result -> result.type != MultiShareSendResult.Type.SUCCESS);
|
||||
return results.stream().allMatch(result -> result.type != MultiShareSendResult.Type.SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.WorkerThread;
|
||||
import androidx.core.util.Consumer;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
@@ -23,7 +24,6 @@ class ShareInterstitialRepository {
|
||||
private List<Recipient> resolveRecipients(@NonNull Set<ContactSearchKey.RecipientSearchKey> recipientSearchKeys) {
|
||||
return Stream.of(recipientSearchKeys)
|
||||
.map(ContactSearchKey.RecipientSearchKey::getRecipientId)
|
||||
.map(Recipient::resolved)
|
||||
.toList();
|
||||
.map(Recipient::resolved).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,8 +297,8 @@ public class MessageSender {
|
||||
Recipient recipient = message.getThreadRecipient();
|
||||
long allocatedThreadId = threadTable.getOrCreateValidThreadId(message.getThreadRecipient(), threadId);
|
||||
|
||||
List<AttachmentId> attachmentIds = Stream.of(preUploadResults).map(PreUploadResult::getAttachmentId).toList();
|
||||
List<String> jobIds = Stream.of(preUploadResults).map(PreUploadResult::getJobIds).flatMap(Stream::of).toList();
|
||||
List<AttachmentId> attachmentIds = Stream.of(preUploadResults).map(PreUploadResult::getAttachmentId).collect(com.annimon.stream.Collectors.toList());
|
||||
List<String> jobIds = Stream.of(preUploadResults).map(PreUploadResult::getJobIds).flatMap(Stream::of).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
if (!attachmentDatabase.hasAttachments(attachmentIds)) {
|
||||
Log.w(TAG, "Attachments not found in database for " + message.getThreadRecipient().getId() + ", thread: " + threadId + ", pre-uploads: " + preUploadResults);
|
||||
@@ -337,7 +337,7 @@ public class MessageSender {
|
||||
@NonNull Collection<PreUploadResult> preUploadResults,
|
||||
boolean overwritePreUploadMessageIds)
|
||||
{
|
||||
Log.i(TAG, "Sending media broadcast (overwrite: " + overwritePreUploadMessageIds + ") to " + Stream.of(messages).map(m -> m.getThreadRecipient().getId()).toList());
|
||||
Log.i(TAG, "Sending media broadcast (overwrite: " + overwritePreUploadMessageIds + ") to " + Stream.of(messages).map(m -> m.getThreadRecipient().getId()).collect(com.annimon.stream.Collectors.toList()));
|
||||
Preconditions.checkArgument(messages.size() > 0, "No messages!");
|
||||
Preconditions.checkArgument(Stream.of(messages).allMatch(m -> m.getAttachments().isEmpty()), "Messages can't have attachments! They should be pre-uploaded.");
|
||||
|
||||
@@ -345,8 +345,8 @@ public class MessageSender {
|
||||
AttachmentTable attachmentDatabase = SignalDatabase.attachments();
|
||||
MessageTable mmsDatabase = SignalDatabase.messages();
|
||||
ThreadTable threadTable = SignalDatabase.threads();
|
||||
List<AttachmentId> preUploadAttachmentIds = Stream.of(preUploadResults).map(PreUploadResult::getAttachmentId).toList();
|
||||
List<String> preUploadJobIds = Stream.of(preUploadResults).map(PreUploadResult::getJobIds).flatMap(Stream::of).toList();
|
||||
List<AttachmentId> preUploadAttachmentIds = Stream.of(preUploadResults).map(PreUploadResult::getAttachmentId).collect(com.annimon.stream.Collectors.toList());
|
||||
List<String> preUploadJobIds = Stream.of(preUploadResults).map(PreUploadResult::getJobIds).flatMap(Stream::of).collect(com.annimon.stream.Collectors.toList());
|
||||
List<Long> messageIds = new ArrayList<>(messages.size());
|
||||
List<String> messageDependsOnIds = new ArrayList<>(preUploadJobIds);
|
||||
OutgoingMessage primaryMessage = messages.get(0);
|
||||
@@ -371,8 +371,7 @@ public class MessageSender {
|
||||
}
|
||||
|
||||
List<DatabaseAttachment> preUploadAttachments = Stream.of(preUploadAttachmentIds)
|
||||
.map(attachmentDatabase::getAttachment)
|
||||
.toList();
|
||||
.map(attachmentDatabase::getAttachment).collect(com.annimon.stream.Collectors.toList());
|
||||
|
||||
if (messages.size() > 0) {
|
||||
List<OutgoingMessage> secondaryMessages = overwritePreUploadMessageIds ? messages.subList(1, messages.size()) : messages;
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.database.Cursor;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
@@ -88,8 +89,7 @@ public final class StickerPackPreviewRepository {
|
||||
remoteManifest.getAuthor(),
|
||||
toOptionalSticker(packId, packKey, remoteManifest.getCover()),
|
||||
Stream.of(remoteManifest.getStickers())
|
||||
.map(s -> toSticker(packId, packKey, s))
|
||||
.toList());
|
||||
.map(s -> toSticker(packId, packKey, s)).collect(Collectors.toList()));
|
||||
|
||||
return Optional.of(new StickerManifestResult(localManifest, false));
|
||||
} catch (IOException | InvalidMessageException e) {
|
||||
|
||||
@@ -117,7 +117,7 @@ public final class StorageSyncValidations {
|
||||
}
|
||||
|
||||
Set<StorageId> allSet = new HashSet<>(manifest.storageIds);
|
||||
Set<StorageId> insertSet = new HashSet<>(Stream.of(inserts).map(SignalStorageRecord::getId).toList());
|
||||
Set<StorageId> insertSet = new HashSet<>(Stream.of(inserts).map(SignalStorageRecord::getId).collect(Collectors.toList()));
|
||||
Set<ByteBuffer> rawIdSet = Stream.of(allSet).map(id -> ByteBuffer.wrap(id.getRaw())).collect(Collectors.toSet());
|
||||
|
||||
if (allSet.size() != manifest.storageIds.size()) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public final class ConversationUtil {
|
||||
public static void clearAllShortcuts(@NonNull Context context) {
|
||||
List<ShortcutInfoCompat> shortcutInfos = ShortcutManagerCompat.getDynamicShortcuts(context);
|
||||
|
||||
ShortcutManagerCompat.removeLongLivedShortcuts(context, Stream.of(shortcutInfos).map(ShortcutInfoCompat::getId).toList());
|
||||
ShortcutManagerCompat.removeLongLivedShortcuts(context, Stream.of(shortcutInfos).map(ShortcutInfoCompat::getId).collect(com.annimon.stream.Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ public final class ConversationUtil {
|
||||
*/
|
||||
public static void clearShortcuts(@NonNull Context context, @NonNull Collection<RecipientId> recipientIds) {
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
ShortcutManagerCompat.removeLongLivedShortcuts(context, Stream.of(recipientIds).filter(Objects::nonNull).map(ConversationUtil::getShortcutId).toList());
|
||||
ShortcutManagerCompat.removeLongLivedShortcuts(context, Stream.of(recipientIds).filter(Objects::nonNull).map(ConversationUtil::getShortcutId).collect(com.annimon.stream.Collectors.toList()));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.text.style.CharacterStyle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.StringUtil;
|
||||
@@ -90,8 +91,7 @@ public class SearchUtil {
|
||||
String normalizedText = text.toLowerCase(locale);
|
||||
String normalizedHighlight = highlight.toLowerCase(locale);
|
||||
List<String> highlightTokens = Stream.of(normalizedHighlight.split("\\s"))
|
||||
.filter(s -> !s.trim().isEmpty())
|
||||
.toList();
|
||||
.filter(s -> !s.trim().isEmpty()).collect(Collectors.toList());
|
||||
|
||||
int[] indexMap = buildIndexMap(text, normalizedText, locale);
|
||||
List<Pair<Integer, Integer>> ranges = new LinkedList<>();
|
||||
@@ -152,8 +152,7 @@ public class SearchUtil {
|
||||
String normalizedText = text.toLowerCase(locale);
|
||||
String normalizedHighlight = highlight.toLowerCase(locale);
|
||||
List<String> highlightTokens = Stream.of(normalizedHighlight.split("\\s"))
|
||||
.filter(s -> !s.trim().isEmpty())
|
||||
.toList();
|
||||
.filter(s -> !s.trim().isEmpty()).collect(Collectors.toList());
|
||||
|
||||
int[] indexMap = buildIndexMap(text, normalizedText, locale);
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@ public class MappingModelList extends ArrayList<MappingModel<?>> {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static @NonNull java.util.stream.Collector<MappingModel<?>, MappingModelList, MappingModelList> collect() {
|
||||
return new java.util.stream.Collector<MappingModel<?>, MappingModelList, MappingModelList>() {
|
||||
public static @NonNull Collector<MappingModel<?>, MappingModelList, MappingModelList> collect() {
|
||||
return new Collector<MappingModel<?>, MappingModelList, MappingModelList>() {
|
||||
@Override
|
||||
public java.util.function.Supplier<MappingModelList> supplier() {
|
||||
public Supplier<MappingModelList> supplier() {
|
||||
return MappingModelList::new;
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.function.BiConsumer<MappingModelList, MappingModel<?>> accumulator() {
|
||||
public BiConsumer<MappingModelList, MappingModel<?>> accumulator() {
|
||||
return MappingModelList::add;
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ public class MappingModelList extends ArrayList<MappingModel<?>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.util.function.Function<MappingModelList, MappingModelList> finisher() {
|
||||
return java.util.function.Function.identity();
|
||||
public Function<MappingModelList, MappingModelList> finisher() {
|
||||
return Function.identity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActivity;
|
||||
@@ -82,8 +83,7 @@ public class ChatWallpaperPreviewActivity extends PassphraseRequiredActivity {
|
||||
adapter.submitList(Collections.singletonList(new ChatWallpaperSelectionMappingModel(selected)));
|
||||
repository.getAllWallpaper(wallpapers -> adapter.submitList(Stream.of(wallpapers)
|
||||
.map(wallpaper -> ChatWallpaperFactory.updateWithDimming(wallpaper, dim ? ChatWallpaper.FIXED_DIM_LEVEL_FOR_DARK_THEME : 0f))
|
||||
.<MappingModel<?>>map(ChatWallpaperSelectionMappingModel::new)
|
||||
.toList()));
|
||||
.<MappingModel<?>>map(ChatWallpaperSelectionMappingModel::new).collect(Collectors.toList())));
|
||||
|
||||
submit.setOnClickListener(unused -> {
|
||||
ChatWallpaperSelectionMappingModel model = (ChatWallpaperSelectionMappingModel) adapter.getCurrentList().get(viewPager.getCurrentItem());
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.lifecycle.Transformations;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.annimon.stream.Collectors;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.conversation.colors.AvatarColor;
|
||||
@@ -141,7 +142,7 @@ public class ChatWallpaperViewModel extends ViewModel {
|
||||
return LiveDataUtil.combineLatest(builtins, dimInDarkTheme, (wallpapers, dimInDarkMode) ->
|
||||
Stream.of(wallpapers)
|
||||
.map(paper -> ChatWallpaperFactory.updateWithDimming(paper, dimInDarkMode ? ChatWallpaper.FIXED_DIM_LEVEL_FOR_DARK_THEME : 0f))
|
||||
.<MappingModel<?>>map(ChatWallpaperSelectionMappingModel::new).toList()
|
||||
.<MappingModel<?>>map(ChatWallpaperSelectionMappingModel::new).collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user