More progress on moving to new Retrofit impl
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Родитель
43a1187e3a
Коммит
63c2063de6
|
@ -48,7 +48,6 @@ import com.nextcloud.talk.utils.AccountUtils;
|
|||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
|
||||
import java.net.CookieManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -68,9 +67,6 @@ public class SwitchAccountController extends BaseController {
|
|||
@Inject
|
||||
UserUtils userUtils;
|
||||
|
||||
@Inject
|
||||
CookieManager cookieManager;
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
|
@ -109,7 +105,6 @@ public class SwitchAccountController extends BaseController {
|
|||
|
||||
@Override
|
||||
public void onNext(UserEntity userEntity) {
|
||||
cookieManager.getCookieStore().removeAll();
|
||||
userUtils.disableAllUsersWithoutId(userEntity.getId());
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
|
|
|
@ -83,6 +83,7 @@ public class AccountRemovalWorker extends Worker {
|
|||
PushConfigurationState.class);
|
||||
PushConfigurationState finalPushConfigurationState = pushConfigurationState;
|
||||
|
||||
ApplicationWideApiHolder.getInstance().removeNcApiInstanceForAccountId(userEntity.getId());
|
||||
ncApi = ApplicationWideApiHolder.getInstance().getNcApiInstanceForAccountId(userEntity.getId(), null);
|
||||
credentials = ApiUtils.getCredentials(userEntity.getUserId(), userEntity.getToken());
|
||||
|
||||
|
@ -139,7 +140,6 @@ public class AccountRemovalWorker extends Worker {
|
|||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.nextcloud.talk.models.json.mention.Mention;
|
|||
import com.nextcloud.talk.models.json.mention.MentionOverall;
|
||||
import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideApiHolder;
|
||||
import com.otaliastudios.autocomplete.RecyclerViewPresenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -51,8 +52,8 @@ import io.reactivex.schedulers.Schedulers;
|
|||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention> implements FlexibleAdapter.OnItemClickListener {
|
||||
@Inject
|
||||
NcApi ncApi;
|
||||
private NcApi ncApi;
|
||||
private UserEntity currentUser;
|
||||
|
||||
@Inject
|
||||
UserUtils userUtils;
|
||||
|
@ -77,6 +78,11 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
|
|||
NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
|
||||
}
|
||||
|
||||
private void setupNcApi() {
|
||||
currentUser = userUtils.getCurrentUser();
|
||||
ncApi = ApplicationWideApiHolder.getInstance().getNcApiInstanceForAccountId(currentUser.getId(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RecyclerView.Adapter instantiateAdapter() {
|
||||
adapter = new FlexibleAdapter<>(abstractFlexibleItemList, context, false);
|
||||
|
@ -87,7 +93,6 @@ public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention>
|
|||
@Override
|
||||
protected void onQuery(@Nullable CharSequence query) {
|
||||
if (!TextUtils.isEmpty(query)) {
|
||||
UserEntity currentUser = userUtils.getCurrentUser();
|
||||
|
||||
adapter.setFilter(query.toString());
|
||||
ncApi.getMentionAutocompleteSuggestions(ApiUtils.getCredentials(currentUser.getUserId(), currentUser
|
||||
|
|
|
@ -77,4 +77,8 @@ public class ApplicationWideApiHolder {
|
|||
|
||||
return ncApiHashMap.get(accountId);
|
||||
}
|
||||
|
||||
public void removeNcApiInstanceForAccountId(long accountId) {
|
||||
ncApiHashMap.remove(accountId);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче