mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 02:39:55 +01:00
Add basic attachment keyboard support to CFv2.
This commit is contained in:
committed by
Greyson Parrelli
parent
0c57113d8e
commit
4b09f4a654
@@ -22,6 +22,7 @@ import com.annimon.stream.Stream;
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.mms.PartAuthority;
|
||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||
import org.signal.core.util.SqlUtil;
|
||||
@@ -40,6 +41,9 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.core.Single;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Handles the retrieval of media present on the user's device.
|
||||
*/
|
||||
@@ -61,6 +65,25 @@ public class MediaRepository {
|
||||
SignalExecutors.BOUNDED.execute(() -> callback.onComplete(getFolders(context)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of recent media items (images and videos).
|
||||
*/
|
||||
public Single<List<Media>> getRecentMedia() {
|
||||
return Single.<List<Media>>fromCallable(() -> {
|
||||
if (!StorageUtil.canReadFromMediaStore()) {
|
||||
Log.w(TAG, "No storage permissions!", new Throwable());
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return getMediaInBucket(ApplicationDependencies.getApplication(), Media.ALL_MEDIA_BUCKET_ID);
|
||||
})
|
||||
.onErrorReturn(t -> {
|
||||
Log.w(TAG, "Unable to get recent media", t);
|
||||
return Collections.emptyList();
|
||||
})
|
||||
.subscribeOn(Schedulers.io());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of media items (images and videos) that are present int he specified bucket.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user