Search in sources :

Example 1 with IConversation

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));
    }
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) IConversation(com.waz.api.IConversation)

Example 2 with IConversation

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();
}
Also used : Handler(android.os.Handler) ExceptionHandler(net.hockeyapp.android.ExceptionHandler) EphemeralExpiration(com.waz.api.EphemeralExpiration) Intent(android.content.Intent) IConversation(com.waz.api.IConversation) List(java.util.List) ArrayList(java.util.ArrayList) ConversationsList(com.waz.api.ConversationsList) SharingController(com.waz.zclient.controllers.SharingController)

Example 3 with IConversation

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;
    }
}
Also used : GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) IConversation(com.waz.api.IConversation)

Example 4 with IConversation

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());
}
Also used : IConversation(com.waz.api.IConversation) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test)

Example 5 with IConversation

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());
}
Also used : IConversation(com.waz.api.IConversation) FragmentTest(com.waz.zclient.testutils.FragmentTest) Test(org.junit.Test)

Aggregations

IConversation (com.waz.api.IConversation)69 FragmentTest (com.waz.zclient.testutils.FragmentTest)25 Test (org.junit.Test)25 GlobalTrackingController (com.waz.zclient.tracking.GlobalTrackingController)14 View (android.view.View)10 User (com.waz.api.User)9 ArrayList (java.util.ArrayList)6 SuppressLint (android.annotation.SuppressLint)5 Intent (android.content.Intent)4 Handler (android.os.Handler)4 AbsListView (android.widget.AbsListView)4 CreatedGroupConversationEvent (com.waz.zclient.controllers.tracking.events.group.CreatedGroupConversationEvent)4 FooterMenuCallback (com.waz.zclient.views.menus.FooterMenuCallback)4 Instrumentation (android.app.Instrumentation)3 TextView (android.widget.TextView)3 BaseScalaActivity (com.waz.zclient.BaseScalaActivity)3 AddedMemberToGroupEvent (com.waz.zclient.controllers.tracking.events.group.AddedMemberToGroupEvent)3 ExceptionHandler (net.hockeyapp.android.ExceptionHandler)3 Animator (android.animation.Animator)2 AnimatorSet (android.animation.AnimatorSet)2