protected void toggleBlocked() { if (getUser().isMe()) return; boolean blocked = ChatSDK.blocking().isBlocked(getUser().getEntityID()); if (blocked) unblock(); else block(); }
protected void block() { if (getUser().isMe()) return; disposableList.add(ChatSDK.blocking().blockUser(getUser().getEntityID()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(() -> { updateBlockedButton(true); updateInterface(); ToastHelper.show(getContext(), getString(R.string.user_blocked)); }, throwable1 -> { ChatSDK.logError(throwable1); Toast.makeText(ProfileFragment.this.getContext(), throwable1.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); })); }
protected void unblock() { if (getUser().isMe()) return; disposableList.add(ChatSDK.blocking().unblockUser(getUser().getEntityID()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(() -> { updateBlockedButton(false); updateInterface(); ToastHelper.show(getContext(), R.string.user_unblocked); }, throwable12 -> { ChatSDK.logError(throwable12); Toast.makeText(ProfileFragment.this.getContext(), throwable12.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); })); }
if (ChatSDK.blocking() != null && ChatSDK.blocking().blockingSupported()) { updateBlockedButton(ChatSDK.blocking().isBlocked(getUser().getEntityID())); if (blockOrUnblockButton != null) blockOrUnblockButton.setOnClickListener(v -> toggleBlocked());
if (userIDObject instanceof String) { String userID = (String) userIDObject; if (ChatSDK.blocking() != null && ChatSDK.blocking().isBlocked(userID)) { return;