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:
Alan Evans
2021-02-03 12:45:14 -04:00
committed by Greyson Parrelli
parent 213ffdab62
commit ddb04c6ea3
8 changed files with 67 additions and 29 deletions

View File

@@ -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);
}