mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 05:55:39 +03:00
Migrate AddParticipantsToConversation from requery to room
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
67318883d0
commit
70d777ec3b
1 changed files with 11 additions and 5 deletions
|
@ -24,12 +24,13 @@ import android.content.Context;
|
|||
|
||||
import com.nextcloud.talk.api.NcApi;
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||
import com.nextcloud.talk.data.user.model.User;
|
||||
import com.nextcloud.talk.events.EventStatus;
|
||||
import com.nextcloud.talk.models.RetrofitBucket;
|
||||
import com.nextcloud.talk.models.database.UserEntity;
|
||||
import com.nextcloud.talk.users.UserManager;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.UserIdUtils;
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class AddParticipantsToConversation extends Worker {
|
|||
NcApi ncApi;
|
||||
|
||||
@Inject
|
||||
UserUtils userUtils;
|
||||
UserManager userManager;
|
||||
|
||||
@Inject
|
||||
EventBus eventBus;
|
||||
|
@ -66,7 +67,10 @@ public class AddParticipantsToConversation extends Worker {
|
|||
String[] selectedGroupIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_GROUPS());
|
||||
String[] selectedCircleIds = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_CIRCLES());
|
||||
String[] selectedEmails = data.getStringArray(BundleKeys.INSTANCE.getKEY_SELECTED_EMAILS());
|
||||
UserEntity user = userUtils.getUserWithInternalId(data.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), -1));
|
||||
User user =
|
||||
userManager.getUserWithInternalId(
|
||||
data.getLong(BundleKeys.INSTANCE.getKEY_INTERNAL_USER_ID(), -1))
|
||||
.blockingGet();
|
||||
|
||||
int apiVersion = ApiUtils.getConversationApiVersion(user, new int[] {ApiUtils.APIv4, 1});
|
||||
|
||||
|
@ -134,7 +138,9 @@ public class AddParticipantsToConversation extends Worker {
|
|||
}
|
||||
}
|
||||
|
||||
eventBus.post(new EventStatus(user.getId(), EventStatus.EventType.PARTICIPANTS_UPDATE, true));
|
||||
eventBus.post(new EventStatus(UserIdUtils.INSTANCE.getIdForUser(user),
|
||||
EventStatus.EventType.PARTICIPANTS_UPDATE,
|
||||
true));
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue