use of com.waz.api.IConversation in project wire-android by wireapp.
the class MainActivity method onStartCall.
//////////////////////////////////////////////////////////////////////////////////////////
//
// Cursor callback
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void onStartCall(boolean withVideo) {
handleOnStartCall(withVideo);
IConversation conversation = getStoreFactory().getConversationStore().getCurrentConversation();
if (withVideo) {
injectJava(GlobalTrackingController.class).tagEvent(OpenedMediaActionEvent.cursorAction(OpenedMediaAction.VIDEO_CALL, conversation));
} else {
injectJava(GlobalTrackingController.class).tagEvent(OpenedMediaActionEvent.cursorAction(OpenedMediaAction.AUDIO_CALL, conversation));
}
}
use of com.waz.api.IConversation 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();
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class MainActivity method onPageVisible.
//////////////////////////////////////////////////////////////////////////////////////////
//
// NavigationControllerObserver
//
//////////////////////////////////////////////////////////////////////////////////////////
@Override
public void onPageVisible(Page page) {
getControllerFactory().getGlobalLayoutController().setSoftInputModeForPage(page);
getControllerFactory().getNavigationController().setPagerSettingForPage(page);
switch(page) {
case CONVERSATION_LIST:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CONVERSATION_LIST);
break;
case MESSAGE_STREAM:
IConversation currentConversation = getStoreFactory().getConversationStore().getCurrentConversation();
if (currentConversation == null) {
break;
}
String conversationName = currentConversation.getName();
if (currentConversation.getType() == IConversation.Type.ONE_TO_ONE && ((conversationName.toLowerCase(Locale.getDefault()).contains("otto") && conversationName.toLowerCase(Locale.getDefault()).contains("bot")) || TextUtils.equals(currentConversation.getOtherParticipant().getEmail(), "ottobot@wire.com"))) {
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CONVERSATION__BOT);
} else {
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CONVERSATION);
}
break;
case CAMERA:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CAMERA);
break;
case DRAWING:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.DRAW_SKETCH);
break;
case CONNECT_REQUEST_INBOX:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CONVERSATION__INBOX);
break;
case PENDING_CONNECT_REQUEST_AS_CONVERSATION:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CONVERSATION__PENDING);
break;
case PARTICIPANT:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.CONVERSATION__PARTICIPANTS);
break;
case PICK_USER_ADD_TO_CONVERSATION:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.START_UI__ADD_TO_CONVERSATION);
break;
case PICK_USER:
injectJava(GlobalTrackingController.class).onApplicationScreen(ApplicationScreen.START_UI);
break;
}
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ConversationFragmentTest method assertNoVideoCallButtonInNonActiveConversation.
@Test
public void assertNoVideoCallButtonInNonActiveConversation() throws InterruptedException {
IConversation mockConversation = mock(IConversation.class);
when(mockConversation.getType()).thenReturn(IConversation.Type.ONE_TO_ONE);
when(mockConversation.isMemberOfConversation()).thenReturn(false);
MockHelper.setupConversationMocks(mockConversation, activity);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.action_video_call)).check(CustomViewAssertions.isNull());
}
use of com.waz.api.IConversation in project wire-android by wireapp.
the class ConversationFragmentTest method assertAudioMessageIconVisibleInOneToOneConversation.
@Test
public void assertAudioMessageIconVisibleInOneToOneConversation() 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);
attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
onView(withId(R.id.cursor_menu_item_audio_message)).check(isVisible());
}
Aggregations