use of com.waz.api.IConversation in project wire-android by wireapp.
the class PendingConnectRequestFragment method setFooterForIncomingConnectRequest.
private void setFooterForIncomingConnectRequest(final User user) {
if (userRequester != IConnectStore.UserRequester.PARTICIPANTS) {
return;
}
footerMenu.setVisibility(View.VISIBLE);
footerMenu.setRightActionText(getString(R.string.glyph__minus));
footerMenu.setCallback(new FooterMenuCallback() {
@Override
public void onLeftActionClicked() {
IConversation conversation = user.acceptConnection();
getContainer().onAcceptedConnectRequest(conversation);
}
@Override
public void onRightActionClicked() {
getContainer().showRemoveConfirmation(user);
}
});
footerMenu.setLeftActionText(getString(R.string.glyph__plus));
footerMenu.setLeftActionLabelText(getString(R.string.send_connect_request__connect_button__text));
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class PendingConnectRequestFragment method setFooterForIgnoredConnectRequest.
private void setFooterForIgnoredConnectRequest(final User user) {
footerMenu.setVisibility(View.VISIBLE);
footerMenu.setRightActionText("");
footerMenu.setRightActionLabelText("");
footerMenu.setCallback(new FooterMenuCallback() {
@Override
public void onLeftActionClicked() {
IConversation conversation = user.acceptConnection();
getContainer().onAcceptedConnectRequest(conversation);
}
@Override
public void onRightActionClicked() {
}
});
footerMenu.setLeftActionText(getString(R.string.glyph__plus));
footerMenu.setLeftActionLabelText(getString(R.string.send_connect_request__connect_button__text));
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ConversationFragmentTest method assertToolbarVisibleInOneToOneConversation.
@Test
public void assertToolbarVisibleInOneToOneConversation() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
MockHelper.setupConversationMocks(mockConversation, activity);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.t_conversation_toolbar)).check(isVisible());
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class FileUploadTest method assertFileIsLargeWarningShowed.
@Test
@SuppressLint("NewApi")
public void assertFileIsLargeWarningShowed() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
when(mockConversation.isActive()).thenReturn(true);
MockHelper.setupConversationMocks(mockConversation, activity);
IConversationStore mockConversationStore = activity.getStoreFactory().getConversationStore();
// Mock intent result
String action;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
action = Intent.ACTION_OPEN_DOCUMENT;
} else {
action = Intent.ACTION_GET_CONTENT;
}
Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("*/*"));
Intent intent = new Intent();
intent.setData(Uri.parse("file:///tmp/whatever.txt"));
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
intending(expectedIntent).respondWith(result);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
MessageContent.Asset.ErrorHandler errorHandler = (MessageContent.Asset.ErrorHandler) args[1];
errorHandler.noWifiAndFileIsLarge(20 * 1024 * 1024, NetworkMode._3G, mock(MessageContent.Asset.Answer.class));
return null;
}
}).when(mockConversationStore).sendMessage(any(AssetForUpload.class), any(MessageContent.Asset.ErrorHandler.class));
// attach fragment
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
// verify stuff
Thread.sleep(500);
onView(withId(R.id.cursor_menu_item_more)).perform(click());
Thread.sleep(500);
onView(withId(R.id.cursor_menu_item_file)).perform(click());
Thread.sleep(200);
onView(withText(activity.getString(R.string.asset_upload_warning__large_file__title))).check(isVisible());
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ParticipantHeaderFragmentTest method assertGroupMembersSummaryIsVisibleInGroup.
@Test
public void assertGroupMembersSummaryIsVisibleInGroup() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.GROUP);
when(mockConversation.isMemberOfConversation()).thenReturn(true);
MockHelper.setupParticipantsMocks(mockConversation, activity);
attachFragment(ParticipantHeaderFragment.newInstance(IConnectStore.UserRequester.CONVERSATION), ParticipantHeaderFragment.TAG);
Thread.sleep(400);
onView(withId(R.id.ttv__participants__sub_header)).check(isVisible());
}
Aggregations