mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Do not linkify message body if recipient is not message request accepted.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
committed by
Greyson Parrelli
parent
213ffdab62
commit
ddb04c6ea3
@@ -198,6 +198,22 @@ public final class LiveDataUtil {
|
||||
return outputLiveData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Observes a source until the predicate is met. The final value matching the predicate is emitted.
|
||||
*/
|
||||
public static @NonNull <A> LiveData<A> until(@NonNull LiveData<A> source, @NonNull Predicate<A> predicate) {
|
||||
MediatorLiveData<A> mediator = new MediatorLiveData<>();
|
||||
|
||||
mediator.addSource(source, newValue -> {
|
||||
mediator.setValue(newValue);
|
||||
if (predicate.test(newValue)) {
|
||||
mediator.removeSource(source);
|
||||
}
|
||||
});
|
||||
|
||||
return mediator;
|
||||
}
|
||||
|
||||
public interface Combine<A, B, R> {
|
||||
@NonNull R apply(@NonNull A a, @NonNull B b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user