use of com.waz.zclient.controllers.SharingController in project wire-android by wireapp.
the class MainActivity method onUserLoggedInAndVerified.
private void onUserLoggedInAndVerified(Self self) {
getStoreFactory().getProfileStore().setUser(self);
getControllerFactory().getAccentColorController().setColor(AccentColorChangeRequester.LOGIN, self.getAccent().getColor());
getControllerFactory().getUsernameController().setUser(self);
final Intent intent = getIntent();
if (IntentUtils.isLaunchFromNotificationIntent(intent)) {
final IConversation conversation = getStoreFactory().getConversationStore().getConversation(IntentUtils.getLaunchConversationId(intent));
final boolean startCallNotificationIntent = IntentUtils.isStartCallNotificationIntent(intent);
Timber.i("Start from notification with call=%b", startCallNotificationIntent);
IntentUtils.clearLaunchIntentExtra(intent);
if (conversation != null) {
// Only want to swipe over when app has loaded
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
getStoreFactory().getConversationStore().setCurrentConversation(conversation, ConversationChangeRequester.NOTIFICATION);
if (startCallNotificationIntent) {
startCall(false);
}
}
}, LAUNCH_CONVERSATION_CHANGE_DELAY);
}
} else if (IntentUtils.isLaunchFromSharingIntent(intent)) {
List<String> targetConversations = IntentUtils.getLaunchConversationIds(intent);
String sharedText = IntentUtils.getLaunchConversationSharedText(intent);
List<Uri> sharedFileUris = IntentUtils.getLaunchConversationSharedFiles(intent);
EphemeralExpiration expiration = IntentUtils.getEphemeralExpiration(intent);
SharingController sharingController = injectJava(SharingController.class);
if (targetConversations != null) {
if (targetConversations.size() == 1 && targetConversations.get(0) != null) {
String conversationId = targetConversations.get(0);
final IConversation conversation = getStoreFactory().getConversationStore().getConversation(conversationId);
if (!TextUtils.isEmpty(sharedText)) {
getControllerFactory().getSharingController().setSharedContentType(SharedContentType.TEXT);
} else {
getControllerFactory().getSharingController().setSharedContentType(SharedContentType.FILE);
}
getControllerFactory().getSharingController().setSharedText(sharedText);
getControllerFactory().getSharingController().setSharedUris(sharedFileUris);
getControllerFactory().getSharingController().setSharingConversationId(conversationId);
if (conversation != null) {
conversation.setEphemeralExpiration(expiration);
}
// Only want to swipe over when app has loaded
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
getStoreFactory().getConversationStore().setCurrentConversation(conversation, ConversationChangeRequester.SHARING);
}
}, LAUNCH_CONVERSATION_CHANGE_DELAY);
} else {
sharingController.sendContent(sharedText, sharedFileUris, targetConversations, expiration, this);
}
}
IntentUtils.clearLaunchIntentExtra(intent);
}
setIntent(intent);
openMainPage();
}
Aggregations