Search in sources :

Example 1 with DebugLog

use of hugo.weaving.DebugLog in project Rocket.Chat.Android by RocketChat.

the class RocketChatWebSocketThread method terminate.

/**
   * terminate WebSocket thread.
   */
@DebugLog
public Single<Boolean> terminate() {
    if (isAlive()) {
        return Single.fromEmitter(emitter -> {
            new Handler(getLooper()).post(() -> {
                RCLog.d("thread %s: terminated()", Thread.currentThread().getId());
                unregisterListeners();
                connectivityManager.notifyConnectionLost(hostname, ConnectivityManagerInternal.REASON_CLOSED_BY_USER);
                RocketChatWebSocketThread.super.quit();
                emitter.onSuccess(true);
            });
        });
    } else {
        connectivityManager.notifyConnectionLost(hostname, ConnectivityManagerInternal.REASON_NETWORK_ERROR);
        super.quit();
        return Single.just(true);
    }
}
Also used : Handler(android.os.Handler) DebugLog(hugo.weaving.DebugLog)

Example 2 with DebugLog

use of hugo.weaving.DebugLog in project Rocket.Chat.Android by RocketChat.

the class SessionObserver method onLogin.

@DebugLog
private void onLogin() {
    streamNotifyMessage.register();
    // update push info
    pushHelper.pushSetUser(new RocketChatCache(context).getOrCreatePushId()).continueWith(new LogIfError());
}
Also used : RocketChatCache(chat.rocket.android.RocketChatCache) LogIfError(chat.rocket.android.helper.LogIfError) DebugLog(hugo.weaving.DebugLog)

Example 3 with DebugLog

use of hugo.weaving.DebugLog in project wire-android by wireapp.

the class PickUserFragment method loadStartUi.

//////////////////////////////////////////////////////////////////////////////////////////
//
//  List and grid helpers
//
//////////////////////////////////////////////////////////////////////////////////////////
@DebugLog
public void loadStartUi() {
    if (searchResultAdapter.getItemCount() == 0) {
        getContainer().getLoadingViewIndicator().show(LoadingIndicatorView.SPINNER);
    } else {
        getContainer().getLoadingViewIndicator().show(LoadingIndicatorView.INFINITE_LOADING_BAR, showLoadingBarDelay);
    }
    String filter = getControllerFactory().getPickUserController().getSearchFilter();
    boolean hasSelectedUsers = getControllerFactory().getPickUserController().hasSelectedUsers();
    switch(getDataState(hasSelectedUsers)) {
        case SHOW_ALL_USERS_TO_ADD_TO_CONVERSATION:
            filter = "";
        case SHOW_SEARCH_RESULTS_TO_ADD_TO_CONVERSATION:
            String[] excludedUsers = getStoreFactory().getPickUserStore().getExcludedUsers();
            UserSearchResult usersSearchResult = getStoreFactory().getZMessagingApiStore().getApi().search().getConnectionsByName(filter, NUM_SEARCH_RESULTS_ADD_TO_CONV, excludedUsers);
            usersSearchModelObserver.setAndUpdate(usersSearchResult);
            break;
        case SHOW_SEARCH_RESULTS:
            getStoreFactory().getPickUserStore().loadSearchByFilter(filter, NUM_SEARCH_RESULTS_LIST, false);
            if (!hasSelectedUsers) {
                getStoreFactory().getPickUserStore().searchContacts(filter);
            }
            ((BaseScalaActivity) getActivity()).injectJava(GlobalTrackingController.class).tagEvent(new EnteredSearchEvent(isAddingToConversation(), filter));
            break;
        case SHOW_TOP_USERS_AS_LIST:
        case SHOW_TOP_USERS_AND_RECOMMENDED:
            boolean excludeConversationParticipants = isAddingToConversation() && getArguments().getBoolean(ARGUMENT_GROUP_CONVERSATION);
            getStoreFactory().getPickUserStore().loadTopUserList(NUM_SEARCH_RESULTS_TOP_USERS, excludeConversationParticipants);
            break;
    }
}
Also used : EnteredSearchEvent(com.waz.zclient.controllers.tracking.events.connect.EnteredSearchEvent) GlobalTrackingController(com.waz.zclient.tracking.GlobalTrackingController) UserSearchResult(com.waz.api.UserSearchResult) DebugLog(hugo.weaving.DebugLog)

Example 4 with DebugLog

use of hugo.weaving.DebugLog in project ocreader by schaal.

the class ArticleWebView method getHtml.

@DebugLog
private String getHtml() {
    final Context context = getContext();
    final String font = Preferences.ARTICLE_FONT.getString(PreferenceManager.getDefaultSharedPreferences(context));
    Document document = Jsoup.parse(item.getBody());
    document = cleaner.clean(document);
    String firstImgString = extractFirstImg(document);
    prepareDocument(document);
    document.outputSettings().prettyPrint(false);
    return context.getString(R.string.article_html_template, FaviconLoader.getCssColor(defaultLinkColor), FaviconLoader.getCssColor(fontColor), FaviconLoader.getCssColor(backgroundColor), FaviconLoader.getCssColor(ContextCompat.getColor(context, R.color.selected_background)), StringUtils.nullToEmpty(item.getUrl()), item.getTitle(), StringUtils.getByLine(context, "<p class=\"byline\">%s</p>", item.getAuthor()), document.body().html(), firstImgString, !"system".equals(font) ? context.getString(R.string.crimson_font_css) : "");
}
Also used : Context(android.content.Context) Document(org.jsoup.nodes.Document) DebugLog(hugo.weaving.DebugLog)

Example 5 with DebugLog

use of hugo.weaving.DebugLog in project Rocket.Chat.Android by RocketChat.

the class CurrentUserObserver method onLogin.

@DebugLog
private void onLogin(RealmUser user) {
    if (listeners != null) {
        onLogout();
    }
    listeners = new ArrayList<>();
    final String userId = user.getId();
    // get and observe Room subscriptions.
    methodCall.getRoomSubscriptions().onSuccess(task -> {
        if (listeners != null) {
            Registrable listener = new StreamNotifyUserSubscriptionsChanged(context, hostname, realmHelper, ddpClientRef, userId);
            listener.register();
            listeners.add(listener);
        }
        return null;
    }).continueWith(new LogIfError());
}
Also used : Context(android.content.Context) StreamNotifyUserSubscriptionsChanged(chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged) Realm(io.realm.Realm) RealmUser(chat.rocket.persistence.realm.models.ddp.RealmUser) RealmResults(io.realm.RealmResults) LogIfError(chat.rocket.android.helper.LogIfError) DebugLog(hugo.weaving.DebugLog) ArrayList(java.util.ArrayList) MethodCallHelper(chat.rocket.android.api.MethodCallHelper) List(java.util.List) Registrable(chat.rocket.android.service.Registrable) RealmHelper(chat.rocket.persistence.realm.RealmHelper) DDPClientRef(chat.rocket.android.service.DDPClientRef) Registrable(chat.rocket.android.service.Registrable) StreamNotifyUserSubscriptionsChanged(chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged) LogIfError(chat.rocket.android.helper.LogIfError) DebugLog(hugo.weaving.DebugLog)

Aggregations

DebugLog (hugo.weaving.DebugLog)7 Context (android.content.Context)3 RocketChatCache (chat.rocket.android.RocketChatCache)3 LogIfError (chat.rocket.android.helper.LogIfError)3 MethodCallHelper (chat.rocket.android.api.MethodCallHelper)2 DDPClientRef (chat.rocket.android.service.DDPClientRef)2 RealmHelper (chat.rocket.persistence.realm.RealmHelper)2 Realm (io.realm.Realm)2 RealmResults (io.realm.RealmResults)2 List (java.util.List)2 Handler (android.os.Handler)1 RaixPushHelper (chat.rocket.android.api.RaixPushHelper)1 Registrable (chat.rocket.android.service.Registrable)1 StreamNotifyUserSubscriptionsChanged (chat.rocket.android.service.ddp.stream.StreamNotifyUserSubscriptionsChanged)1 StreamRoomMessageManager (chat.rocket.android.service.internal.StreamRoomMessageManager)1 CanCreateRoomInteractor (chat.rocket.core.interactors.CanCreateRoomInteractor)1 RoomInteractor (chat.rocket.core.interactors.RoomInteractor)1 SessionInteractor (chat.rocket.core.interactors.SessionInteractor)1 RealmUser (chat.rocket.persistence.realm.models.ddp.RealmUser)1 GetUsersOfRoomsProcedure (chat.rocket.persistence.realm.models.internal.GetUsersOfRoomsProcedure)1