mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Fix credentials issue
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
4bcbbf3296
commit
bcb16bb251
@ -15,8 +15,8 @@ android {
|
||||
targetSdkVersion 27
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
versionCode 60
|
||||
versionName "3.0.0beta9"
|
||||
versionCode 61
|
||||
versionName "3.0.0beta10"
|
||||
|
||||
flavorDimensions "default"
|
||||
renderscriptTargetApi 19
|
||||
|
@ -134,6 +134,7 @@ import io.reactivex.schedulers.Schedulers;
|
||||
import me.zhanghai.android.effortlesspermissions.AfterPermissionDenied;
|
||||
import me.zhanghai.android.effortlesspermissions.EffortlessPermissions;
|
||||
import me.zhanghai.android.effortlesspermissions.OpenAppDetailsDialogFragment;
|
||||
import okhttp3.Cache;
|
||||
import pub.devrel.easypermissions.AfterPermissionGranted;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
@ -189,6 +190,8 @@ public class CallController extends BaseController {
|
||||
UserUtils userUtils;
|
||||
@Inject
|
||||
AppPreferences appPreferences;
|
||||
@Inject
|
||||
Cache cache;
|
||||
|
||||
private PeerConnectionFactory peerConnectionFactory;
|
||||
private MediaConstraints audioConstraints;
|
||||
@ -298,6 +301,11 @@ public class CallController extends BaseController {
|
||||
.setRepeatCount(PulseAnimation.INFINITE)
|
||||
.setRepeatMode(PulseAnimation.REVERSE);
|
||||
|
||||
try {
|
||||
cache.evictAll();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to evict cache");
|
||||
}
|
||||
|
||||
if (isVoiceOnlyCall) {
|
||||
callControlEnableSpeaker.setVisibility(View.VISIBLE);
|
||||
|
@ -97,6 +97,7 @@ import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.Cache;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class CallNotificationController extends BaseController {
|
||||
@ -109,6 +110,9 @@ public class CallNotificationController extends BaseController {
|
||||
@Inject
|
||||
AppPreferences appPreferences;
|
||||
|
||||
@Inject
|
||||
Cache cache;
|
||||
|
||||
@Inject
|
||||
EventBus eventBus;
|
||||
|
||||
@ -298,6 +302,12 @@ public class CallNotificationController extends BaseController {
|
||||
|
||||
if (handler == null) {
|
||||
handler = new Handler();
|
||||
|
||||
try {
|
||||
cache.evictAll();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Failed to evict cache");
|
||||
}
|
||||
}
|
||||
|
||||
if (currentConversation == null) {
|
||||
|
@ -48,6 +48,7 @@ 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;
|
||||
|
||||
@ -70,6 +71,9 @@ public class SwitchAccountController extends BaseController {
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
|
||||
@Inject
|
||||
CookieManager cookieManager;
|
||||
|
||||
@BindView(R.id.swipe_refresh_layout)
|
||||
SwipeRefreshLayout swipeRefreshLayout;
|
||||
private FlexibleAdapter<AbstractFlexibleItem> adapter;
|
||||
@ -105,6 +109,8 @@ public class SwitchAccountController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void onNext(UserEntity userEntity) {
|
||||
cookieManager.getCookieStore().removeAll();
|
||||
|
||||
userUtils.disableAllUsersWithoutId(userEntity.getId());
|
||||
if (getActivity() != null) {
|
||||
getActivity().runOnUiThread(() -> getRouter().popCurrentController());
|
||||
|
@ -39,6 +39,7 @@ import com.nextcloud.talk.utils.ApiUtils;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.CookieManager;
|
||||
import java.util.HashMap;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
@ -49,6 +50,7 @@ import autodagger.AutoInjector;
|
||||
import io.reactivex.CompletableObserver;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.JavaNetCookieJar;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -65,7 +67,6 @@ public class AccountRemovalWorker extends Worker {
|
||||
@Inject
|
||||
OkHttpClient okHttpClient;
|
||||
|
||||
@Inject
|
||||
NcApi ncApi;
|
||||
|
||||
@NonNull
|
||||
@ -85,6 +86,9 @@ public class AccountRemovalWorker extends Worker {
|
||||
|
||||
credentials = ApiUtils.getCredentials(userEntity.getUserId(), userEntity.getToken());
|
||||
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new
|
||||
JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
|
||||
|
||||
String finalCredentials = credentials;
|
||||
ncApi.unregisterDeviceForNotificationsWithNextcloud(credentials, ApiUtils.getUrlNextcloudPush(userEntity
|
||||
.getBaseUrl()))
|
||||
|
@ -36,6 +36,7 @@ import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.CookieManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -46,6 +47,7 @@ import androidx.work.Worker;
|
||||
import autodagger.AutoInjector;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.JavaNetCookieJar;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@ -65,7 +67,6 @@ public class CapabilitiesWorker extends Worker {
|
||||
@Inject
|
||||
OkHttpClient okHttpClient;
|
||||
|
||||
@Inject
|
||||
NcApi ncApi;
|
||||
|
||||
private void updateUser(CapabilitiesOverall capabilitiesOverall, UserEntity internalUserEntity) {
|
||||
@ -124,6 +125,9 @@ public class CapabilitiesWorker extends Worker {
|
||||
for (Object userEntityObject : userEntityObjectList) {
|
||||
UserEntity internalUserEntity = (UserEntity) userEntityObject;
|
||||
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new
|
||||
JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
|
||||
|
||||
ncApi.getCapabilities(ApiUtils.getCredentials(internalUserEntity.getUsername(),
|
||||
internalUserEntity.getToken()), ApiUtils.getUrlForCapabilities(internalUserEntity.getBaseUrl()))
|
||||
.retry(3)
|
||||
|
@ -58,7 +58,6 @@ import com.nextcloud.talk.utils.DoNotDisturbUtils;
|
||||
import com.nextcloud.talk.utils.NotificationUtils;
|
||||
import com.nextcloud.talk.utils.PushUtils;
|
||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideCurrentRoomHolder;
|
||||
import com.nextcloud.talk.utils.singletons.ApplicationWideStateHolder;
|
||||
@ -66,6 +65,7 @@ import com.nextcloud.talk.utils.singletons.ApplicationWideStateHolder;
|
||||
import org.parceler.Parcels;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.CookieManager;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivateKey;
|
||||
@ -82,18 +82,23 @@ import androidx.work.Worker;
|
||||
import autodagger.AutoInjector;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.JavaNetCookieJar;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
@AutoInjector(NextcloudTalkApplication.class)
|
||||
public class NotificationWorker extends Worker {
|
||||
public static final String TAG = "NotificationWorker";
|
||||
|
||||
@Inject
|
||||
UserUtils userUtils;
|
||||
|
||||
@Inject
|
||||
AppPreferences appPreferences;
|
||||
|
||||
@Inject
|
||||
Retrofit retrofit;
|
||||
|
||||
@Inject
|
||||
OkHttpClient okHttpClient;
|
||||
|
||||
NcApi ncApi;
|
||||
|
||||
private DecryptedPushMessage decryptedPushMessage;
|
||||
@ -398,6 +403,9 @@ public class NotificationWorker extends Worker {
|
||||
credentials = ApiUtils.getCredentials(signatureVerification.getUserEntity().getUserId(),
|
||||
signatureVerification.getUserEntity().getToken());
|
||||
|
||||
ncApi = retrofit.newBuilder().client(okHttpClient.newBuilder().cookieJar(new
|
||||
JavaNetCookieJar(new CookieManager())).build()).build().create(NcApi.class);
|
||||
|
||||
boolean hasChatSupport = signatureVerification.getUserEntity().
|
||||
hasSpreedCapabilityWithName("chat-v2");
|
||||
|
||||
|
@ -53,6 +53,7 @@ import io.reactivex.schedulers.Schedulers;
|
||||
public class MentionAutocompletePresenter extends RecyclerViewPresenter<Mention> implements FlexibleAdapter.OnItemClickListener {
|
||||
@Inject
|
||||
NcApi ncApi;
|
||||
|
||||
private UserEntity currentUser;
|
||||
|
||||
@Inject
|
||||
|
Loading…
Reference in New Issue
Block a user