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