Improve CallNotificationController ncapi usage

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-08-11 00:16:31 +02:00
parent 6d97847baa
commit d5476f83ec

View File

@ -76,6 +76,7 @@ import com.nextcloud.talk.utils.MagicFlipView;
import com.nextcloud.talk.utils.bundle.BundleKeys; import com.nextcloud.talk.utils.bundle.BundleKeys;
import com.nextcloud.talk.utils.glide.GlideApp; import com.nextcloud.talk.utils.glide.GlideApp;
import com.nextcloud.talk.utils.preferences.AppPreferences; import com.nextcloud.talk.utils.preferences.AppPreferences;
import com.nextcloud.talk.utils.singletons.ApplicationWideApiHolder;
import com.nextcloud.talk.utils.singletons.AvatarStatusCodeHolder; import com.nextcloud.talk.utils.singletons.AvatarStatusCodeHolder;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -96,15 +97,13 @@ import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import okhttp3.Cache;
@AutoInjector(NextcloudTalkApplication.class) @AutoInjector(NextcloudTalkApplication.class)
public class CallNotificationController extends BaseController { public class CallNotificationController extends BaseController {
private static final String TAG = "CallNotificationController"; private static final String TAG = "CallNotificationController";
@Inject private NcApi ncApi;
NcApi ncApi;
@Inject @Inject
AppPreferences appPreferences; AppPreferences appPreferences;
@ -130,9 +129,6 @@ public class CallNotificationController extends BaseController {
@BindView(R.id.incomingTextRelativeLayout) @BindView(R.id.incomingTextRelativeLayout)
RelativeLayout incomingTextRelativeLayout; RelativeLayout incomingTextRelativeLayout;
@Inject
Cache cache;
private List<Disposable> disposablesList = new ArrayList<>(); private List<Disposable> disposablesList = new ArrayList<>();
private Bundle originalBundle; private Bundle originalBundle;
private String roomId; private String roomId;
@ -302,11 +298,7 @@ public class CallNotificationController extends BaseController {
if (handler == null) { if (handler == null) {
handler = new Handler(); handler = new Handler();
try { ncApi = ApplicationWideApiHolder.getInstance().getNcApiInstanceForAccountId(userBeingCalled.getId(), null);
cache.evictAll();
} catch (IOException e) {
Log.e(TAG, "Failed to evict cache");
}
} }
if (currentConversation == null) { if (currentConversation == null) {