/** * Constructor * * @param dataHandler the data handler * @param restClient the group rest client */ public GroupsManager(MXDataHandler dataHandler, GroupsRestClient restClient) { mDataHandler = dataHandler; mStore = mDataHandler.getStore(); mGroupsRestClient = restClient; mUIHandler = new Handler(Looper.getMainLooper()); }
/** * @return the context */ public Context getContext() { return mDataHandler.getStore().getContext(); }
@Override public void onReadReceiptsLoaded(final String roomId) { final List<ReceiptData> receipts = mDataHandler.getStore().getEventReceipts(roomId, null, false, false); final List<String> senders = new ArrayList<>(); for (ReceiptData receipt : receipts) { senders.add(receipt.userId); } mDataHandler.onReceiptEvent(roomId, senders); } });
@Override public void onSuccess(Void info) { // Update the object member before calling the given callback MyUser.this.displayname = displayName; mDataHandler.getStore().setDisplayName(displayName, System.currentTimeMillis()); callback.onSuccess(info); } });
/** * Tells if the global URL preview settings is enabled * * @return true if it is enabled. */ public boolean isURLPreviewEnabled() { return getDataHandler().getStore().isURLPreviewEnabled(); }
/** * Get user widget from user AccountData * * @return */ public Map<String, Object> getUserWidgets() { return getDataHandler().getStore().getUserWidgets(); }
/** * Update the event state and warn the listener if there is an update. * * @param event the event * @param newState the new state */ public void updateEventState(Event event, Event.SentState newState) { if ((null != event) && (event.mSentState != newState)) { event.mSentState = newState; getStore().flushRoomEvents(event.roomId); onEventSentStateUpdated(event); } }
/** * Tells if the URL preview has been allowed by the user. * * @return @return true if allowed. */ public boolean isURLPreviewAllowedByUser() { return !getDataHandler().getStore().getRoomsWithoutURLPreviews().contains(getRoomId()); }
@Override public void onSuccess(Void info) { // Update the object member before calling the given callback setAvatarUrl(avatarUrl); mDataHandler.getStore().setAvatarURL(avatarUrl, System.currentTimeMillis()); callback.onSuccess(info); } });
@Override public void onSuccess(String aDisplayname) { if (mDataHandler.isAlive()) { // local value displayname = aDisplayname; // store metadata mDataHandler.getStore().setDisplayName(aDisplayname, System.currentTimeMillis()); mIsDisplayNameRefreshed = true; // jump to the next items refreshUserInfos(true, null); } }
/** * When the encryption is toogled, the room summaries must be updated * to display the right messages. */ private void decryptRoomSummaries() { if (null != getDataHandler().getStore()) { Collection<RoomSummary> summaries = getDataHandler().getStore().getSummaries(); for (RoomSummary summary : summaries) { mDataHandler.decryptEvent(summary.getLatestReceivedEvent(), null); } } }
@Override public void onSuccess(FilterResponse filter) { // Store the couple filter/filterId getDataHandler().getStore().addFilter(wantedJsonFilter, filter.filterId); // Ensure the filter is still corresponding to the current filter if (TextUtils.equals(wantedJsonFilter, mCurrentFilter.toJSONString())) { // Tell the event thread to use the id now mEventsThread.setFilterOrFilterId(filter.filterId); } } });
@Override public void onSuccess(List<ThirdPartyIdentifier> identifiers) { if (mDataHandler.isAlive()) { // store mDataHandler.getStore().setThirdPartyIdentifiers(identifiers); buildIdentifiersLists(); mAre3PIdsLoaded = true; // jump to the next items refreshUserInfos(true, null); } }
@Override public void onStoreCorrupted(String accountId, String description) { Log.d(LOG_TAG, "## onStoreCorrupted() : token " + getDataHandler().getStore().getEventStreamToken()); // nothing was saved if (null == getDataHandler().getStore().getEventStreamToken()) { getDataHandler().onStoreReady(); } }
@Override public void onSuccess(Void info) { Log.d(LOG_TAG, "## addUserWidget() : succeeds"); getDataHandler().getStore().setUserWidgets(params); if (null != callback) { callback.onSuccess(null); } }
@Override public void onSuccess(Void info) { Log.d(LOG_TAG, "## setURLPreviewStatus() : succeeds"); getDataHandler().getStore().setURLPreviewEnabled(status); if (null != callback) { callback.onSuccess(null); } }
@Override public void onSuccess(Void info) { getState().groups = groupIds; getDataHandler().getStore().storeLiveStateForRoom(getRoomId()); if (null != callback) { callback.onSuccess(null); } } });
@Override public void onSuccess(ChunkEvents info) { Room room = getRoom(roomId); if (info.chunk != null) { for (Event event : info.chunk) { room.getState().applyState(event, true, getStore()); } } callback.onSuccess(room.getState().getLoadedMembers()); } });
@Override public void onSuccess(String roomId) { Log.d(LOG_TAG, "getConferenceUserRoom : the room creation succeeds"); Room room = mSession.getDataHandler().getRoom(roomId); if (null != room) { room.setIsConferenceUserRoom(true); mSession.getDataHandler().getStore().commit(); callback.onSuccess(room); } }