use of com.waz.api.IConversation in project wire-android by wireapp.
the class ParticipantsDialogFragment method onSelectedUsers.
@Override
public void onSelectedUsers(List<User> users, ConversationChangeRequester requester) {
// TODO https://wearezeta.atlassian.net/browse/AN-3730
getControllerFactory().getPickUserController().hidePickUser(getCurrentPickerDestination(), false);
IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
if (currentConversation.getType() == IConversation.Type.ONE_TO_ONE) {
getStoreFactory().getConversationStore().createGroupConversation(users, requester);
if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
ViewUtils.showAlertDialog(getActivity(), R.string.conversation__create_group_conversation__no_network__title, R.string.conversation__create_group_conversation__no_network__message, R.string.conversation__create_group_conversation__no_network__button, null, true);
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new CreatedGroupConversationEvent(true, (users.size() + 1)));
} else if (currentConversation.getType() == IConversation.Type.GROUP) {
currentConversation.addMembers(users);
if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
ViewUtils.showAlertDialog(getActivity(), R.string.conversation__add_user__no_network__title, R.string.conversation__add_user__no_network__message, R.string.conversation__add_user__no_network__button, null, true);
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new AddedMemberToGroupEvent(getParticipantsCount(), users.size()));
}
hide();
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ParticipantFragment method onSelectedUsers.
//////////////////////////////////////////////////////////////////////////////////////////
//
// PickUserFragment.Container
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void onSelectedUsers(List<User> users, ConversationChangeRequester requester) {
IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
if (currentConversation.getType() == IConversation.Type.ONE_TO_ONE) {
getControllerFactory().getPickUserController().hidePickUser(getCurrentPickerDestination(), false);
dismissDialog();
getStoreFactory().getConversationStore().createGroupConversation(users, requester);
if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
ViewUtils.showAlertDialog(getActivity(), R.string.conversation__create_group_conversation__no_network__title, R.string.conversation__create_group_conversation__no_network__message, R.string.conversation__create_group_conversation__no_network__button, null, true);
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new CreatedGroupConversationEvent(true, (users.size() + 1)));
} else if (currentConversation.getType() == IConversation.Type.GROUP) {
currentConversation.addMembers(users);
getControllerFactory().getPickUserController().hidePickUser(getCurrentPickerDestination(), false);
if (!getStoreFactory().getNetworkStore().hasInternetConnection()) {
ViewUtils.showAlertDialog(getActivity(), R.string.conversation__add_user__no_network__title, R.string.conversation__add_user__no_network__message, R.string.conversation__add_user__no_network__button, null, true);
}
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new AddedMemberToGroupEvent(getParticipantsCount(), users.size()));
}
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ParticipantFragment method deleteConversation.
public void deleteConversation(final IConversation conversation) {
ConfirmationCallback callback = new TwoButtonConfirmationCallback() {
@Override
public void positiveButtonClicked(boolean checkboxIsSelected) {
}
@Override
public void negativeButtonClicked() {
}
@Override
public void onHideAnimationEnd(boolean confirmed, boolean canceled, boolean checkboxIsSelected) {
if (getStoreFactory() == null || getStoreFactory().isTornDown() || getControllerFactory() == null || getControllerFactory().isTornDown()) {
return;
}
if (!confirmed) {
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new DeleteConversationEvent(ConversationType.getValue(conversation), DeleteConversationEvent.Context.LIST, DeleteConversationEvent.Response.CANCEL));
return;
}
IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
boolean deleteCurrentConversation = conversation != null && currentConversation != null && conversation.getId().equals(currentConversation.getId());
getStoreFactory().getConversationStore().deleteConversation(conversation, checkboxIsSelected);
((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new DeleteConversationEvent(ConversationType.getValue(conversation), DeleteConversationEvent.Context.PARTICIPANTS, DeleteConversationEvent.Response.DELETE));
if (deleteCurrentConversation) {
getStoreFactory().getConversationStore().setCurrentConversationToNext(ConversationChangeRequester.DELETE_CONVERSATION);
}
if (LayoutSpec.isTablet(getActivity())) {
getControllerFactory().getConversationScreenController().hideParticipants(false, true);
}
}
};
String header = getString(R.string.confirmation_menu__meta_delete);
String text = getString(R.string.confirmation_menu__meta_delete_text);
String confirm = getString(R.string.confirmation_menu__confirm_delete);
String cancel = getString(R.string.confirmation_menu__cancel);
ConfirmationRequest.Builder builder = new ConfirmationRequest.Builder().withHeader(header).withMessage(text).withPositiveButton(confirm).withNegativeButton(cancel).withConfirmationCallback(callback).withWireTheme(getControllerFactory().getThemeController().getThemeDependentOptionsTheme());
if (conversation.getType() == IConversation.Type.GROUP) {
builder = builder.withCheckboxLabel(getString(R.string.confirmation_menu__delete_conversation__checkbox__label)).withCheckboxSelectedByDefault();
}
getControllerFactory().getConfirmationController().requestConfirmation(builder.build(), IConfirmationController.PARTICIPANTS);
SoundController ctrl = inject(SoundController.class);
if (ctrl != null) {
ctrl.playAlert();
}
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ImageSharingPreviewFragment method confirmShareImages.
private void confirmShareImages() {
SharedContentType sharedContentType = getControllerFactory().getSharingController().getSharedContentType();
if (sharedContentType == null) {
return;
}
IConversation destination = getControllerFactory().getSharingController().getDestination();
List<Uri> sharedImageUris = getControllerFactory().getSharingController().getSharedFileUris();
switch(sharedContentType) {
case IMAGE:
getStoreFactory().getConversationStore().sendMessage(destination, ImageAssetFactory.getImageAsset(sharedImageUris.get(0)));
TrackingUtils.onSentPhotoMessageFromSharing(((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class), destination);
break;
}
getControllerFactory().getSharingController().onContentShared(getActivity(), destination);
getActivity().finish();
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ScalaConversationStore method loadConversation.
@Override
public void loadConversation(String conversationId, OnConversationLoadedListener onConversationLoadedListener) {
IConversation conversation = conversationsList.getConversation(conversationId);
onConversationLoadedListener.onConversationLoaded(conversation);
}
Aggregations