Search in sources :

Example 1 with IZMessagingApiStore

use of com.waz.zclient.core.stores.api.IZMessagingApiStore in project wire-android by wireapp.

the class SpotifyController method setActivity.

@Override
public void setActivity(Activity activity) {
    final IStoreFactory storeFactory = ZApplication.from(activity).getStoreFactory();
    if (storeFactory == null || storeFactory.isTornDown()) {
        return;
    }
    final IZMessagingApiStore zMessagingApiStore = storeFactory.getZMessagingApiStore();
    final ZMessagingApi api = zMessagingApiStore.getApi();
    this.spotify = api.getSpotify();
}
Also used : IStoreFactory(com.waz.zclient.core.stores.IStoreFactory) ZMessagingApi(com.waz.api.ZMessagingApi) IZMessagingApiStore(com.waz.zclient.core.stores.api.IZMessagingApiStore)

Example 2 with IZMessagingApiStore

use of com.waz.zclient.core.stores.api.IZMessagingApiStore in project wire-android by wireapp.

the class SingleOtrClientFragmentTest method setupMocksForCurrentOtrClient.

private void setupMocksForCurrentOtrClient(Self mockSelf, Fingerprint mockFingerprint) {
    IZMessagingApiStore mockZMessagingApiStore = activity.getStoreFactory().getZMessagingApiStore();
    ZMessagingApi mockZMessagingApi = mock(ZMessagingApi.class);
    when(mockZMessagingApiStore.getApi()).thenReturn(mockZMessagingApi);
    when(mockZMessagingApi.getSelf()).thenReturn(mockSelf);
    UiSignal<OtrClient> otrClientUiSignal = MockHelper.mockUiSignal();
    when(mockSelf.getOtrClient()).thenReturn(otrClientUiSignal);
    final OtrClient mockOtrClient = mock(OtrClient.class);
    MockHelper.mockSubscription(otrClientUiSignal, mockOtrClient);
    UiSignal<Fingerprint> fingerprintUiSignal = MockHelper.mockUiSignal();
    when(mockOtrClient.getFingerprint()).thenReturn(fingerprintUiSignal);
    MockHelper.mockSubscription(fingerprintUiSignal, mockFingerprint);
    when(mockFingerprint.getRawBytes()).thenReturn(DEFAULT_FINGERPRINT.getBytes());
    // Not really needed, as user is not used for current device
    IProfileStore mockProfileStore = activity.getStoreFactory().getProfileStore();
    User mockUser = mock(User.class);
    when(mockProfileStore.getSelfUser()).thenReturn(mockUser);
}
Also used : Fingerprint(com.waz.api.Fingerprint) ZMessagingApi(com.waz.api.ZMessagingApi) IProfileStore(com.waz.zclient.core.stores.profile.IProfileStore) User(com.waz.api.User) OtrClient(com.waz.api.OtrClient) IZMessagingApiStore(com.waz.zclient.core.stores.api.IZMessagingApiStore)

Example 3 with IZMessagingApiStore

use of com.waz.zclient.core.stores.api.IZMessagingApiStore in project wire-android by wireapp.

the class UsernamesTakeOverScreenTest method verifyUserHasTakeOverScreenWithUsername.

@Test
public void verifyUserHasTakeOverScreenWithUsername() {
    activity.setOnChooseUsernameChosenCalled(false);
    activity.setOnKeepUsernameCalled(false);
    Self mockSelf = mock(Self.class);
    when(mockSelf.getName()).thenReturn(DEFAULT_DISPLAY_NAME);
    when(mockSelf.getUsername()).thenReturn("");
    IZMessagingApiStore mockZMessagingApiStore = activity.getStoreFactory().getZMessagingApiStore();
    ZMessagingApi mockZMessagingApi = mock(ZMessagingApi.class);
    when(mockZMessagingApiStore.getApi()).thenReturn(mockZMessagingApi);
    when(mockZMessagingApi.getSelf()).thenReturn(mockSelf);
    attachFragment(FirstTimeAssignUsernameFragment.newInstance(mockSelf.getName(), DEFAULT_DISPLAY_USERNAME), FirstTimeAssignUsernameFragment.TAG);
    onView(withId(R.id.ttv__name)).check(matches(withText(mockSelf.getName())));
    onView(withId(R.id.ttv__username)).check(matches(withText(StringUtils.formatHandle(DEFAULT_DISPLAY_USERNAME))));
}
Also used : ZMessagingApi(com.waz.api.ZMessagingApi) Self(com.waz.api.impl.Self) IZMessagingApiStore(com.waz.zclient.core.stores.api.IZMessagingApiStore) Test(org.junit.Test) FragmentTest(com.waz.zclient.testutils.FragmentTest)

Aggregations

ZMessagingApi (com.waz.api.ZMessagingApi)3 IZMessagingApiStore (com.waz.zclient.core.stores.api.IZMessagingApiStore)3 Fingerprint (com.waz.api.Fingerprint)1 OtrClient (com.waz.api.OtrClient)1 User (com.waz.api.User)1 Self (com.waz.api.impl.Self)1 IStoreFactory (com.waz.zclient.core.stores.IStoreFactory)1 IProfileStore (com.waz.zclient.core.stores.profile.IProfileStore)1 FragmentTest (com.waz.zclient.testutils.FragmentTest)1 Test (org.junit.Test)1