Search in sources :

Example 1 with LinkPreviewRepository

use of org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository in project Signal-Android by WhisperSystems.

the class ShareInterstitialActivity method initializeViewModels.

private void initializeViewModels(@NonNull MultiShareArgs args) {
    ShareInterstitialRepository repository = new ShareInterstitialRepository();
    ShareInterstitialViewModel.Factory factory = new ShareInterstitialViewModel.Factory(args, repository);
    viewModel = ViewModelProviders.of(this, factory).get(ShareInterstitialViewModel.class);
    LinkPreviewRepository linkPreviewRepository = new LinkPreviewRepository();
    LinkPreviewViewModel.Factory linkPreviewViewModelFactory = new LinkPreviewViewModel.Factory(linkPreviewRepository);
    linkPreviewViewModel = ViewModelProviders.of(this, linkPreviewViewModelFactory).get(LinkPreviewViewModel.class);
    boolean hasSms = Stream.of(args.getShareContactAndThreads()).anyMatch(c -> {
        Recipient recipient = Recipient.resolved(c.getRecipientId());
        return !recipient.isRegistered() || recipient.isForceSmsSelection();
    });
    if (hasSms) {
        linkPreviewViewModel.onTransportChanged(hasSms);
    }
}
Also used : LinkPreviewViewModel(org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel) LinkPreviewRepository(org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository) Recipient(org.thoughtcrime.securesms.recipients.Recipient)

Aggregations

LinkPreviewRepository (org.thoughtcrime.securesms.linkpreview.LinkPreviewRepository)1 LinkPreviewViewModel (org.thoughtcrime.securesms.linkpreview.LinkPreviewViewModel)1 Recipient (org.thoughtcrime.securesms.recipients.Recipient)1