mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 08:55:54 +03:00
codacy: Avoid unused local variables such as 'finalCredentials'.
Use correct annotation Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
8cb0293e83
commit
7563dc5fba
2 changed files with 37 additions and 21 deletions
|
@ -65,7 +65,6 @@ import com.nextcloud.talk.utils.DisplayUtils;
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.parceler.Parcels;
|
import org.parceler.Parcels;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -183,17 +182,17 @@ public class ProfileController extends BaseController {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<UserProfileFieldsOverall>() {
|
.subscribe(new Observer<UserProfileFieldsOverall>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NotNull Disposable d) {
|
public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NotNull UserProfileFieldsOverall userProfileFieldsOverall) {
|
public void onNext(@io.reactivex.annotations.NonNull UserProfileFieldsOverall userProfileFieldsOverall) {
|
||||||
editableFields = userProfileFieldsOverall.getOcs().getData();
|
editableFields = userProfileFieldsOverall.getOcs().getData();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NotNull Throwable e) {
|
public void onError(@io.reactivex.annotations.NonNull Throwable e) {
|
||||||
edit = false;
|
edit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,11 +242,11 @@ public class ProfileController extends BaseController {
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<GenericOverall>() {
|
.subscribe(new Observer<GenericOverall>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(@NotNull Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(@NotNull GenericOverall genericOverall) {
|
public void onNext(@NonNull GenericOverall genericOverall) {
|
||||||
DisplayUtils.loadAvatarImage(
|
DisplayUtils.loadAvatarImage(
|
||||||
currentUser,
|
currentUser,
|
||||||
getActivity().findViewById(R.id.avatar_image),
|
getActivity().findViewById(R.id.avatar_image),
|
||||||
|
@ -255,7 +254,7 @@ public class ProfileController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NotNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
|
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import autodagger.AutoInjector;
|
|
||||||
import com.bluelinelabs.logansquare.LoganSquare;
|
import com.bluelinelabs.logansquare.LoganSquare;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.api.NcApi;
|
import com.nextcloud.talk.api.NcApi;
|
||||||
|
@ -36,14 +36,24 @@ import com.nextcloud.talk.models.json.push.PushConfigurationState;
|
||||||
import com.nextcloud.talk.models.json.push.PushRegistrationOverall;
|
import com.nextcloud.talk.models.json.push.PushRegistrationOverall;
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
import com.nextcloud.talk.utils.preferences.AppPreferences;
|
||||||
import io.reactivex.Observer;
|
|
||||||
import io.reactivex.disposables.Disposable;
|
|
||||||
import io.reactivex.schedulers.Schedulers;
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import java.io.File;
|
||||||
import java.io.*;
|
import java.io.FileInputStream;
|
||||||
import java.security.*;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.Key;
|
||||||
|
import java.security.KeyFactory;
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.KeyPairGenerator;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.PublicKey;
|
||||||
|
import java.security.Signature;
|
||||||
|
import java.security.SignatureException;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
import java.security.spec.PKCS8EncodedKeySpec;
|
import java.security.spec.PKCS8EncodedKeySpec;
|
||||||
import java.security.spec.X509EncodedKeySpec;
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
@ -51,6 +61,14 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import autodagger.AutoInjector;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.annotations.NonNull;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
@AutoInjector(NextcloudTalkApplication.class)
|
@AutoInjector(NextcloudTalkApplication.class)
|
||||||
public class PushUtils {
|
public class PushUtils {
|
||||||
private static final String TAG = "PushUtils";
|
private static final String TAG = "PushUtils";
|
||||||
|
@ -247,18 +265,17 @@ public class PushUtils {
|
||||||
|
|
||||||
credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
||||||
|
|
||||||
String finalCredentials = credentials;
|
|
||||||
ncApi.registerDeviceForNotificationsWithNextcloud(
|
ncApi.registerDeviceForNotificationsWithNextcloud(
|
||||||
credentials,
|
credentials,
|
||||||
ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap)
|
ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap)
|
||||||
.subscribe(new Observer<PushRegistrationOverall>() {
|
.subscribe(new Observer<PushRegistrationOverall>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(PushRegistrationOverall pushRegistrationOverall) {
|
public void onNext(@NonNull PushRegistrationOverall pushRegistrationOverall) {
|
||||||
Map<String, String> proxyMap = new HashMap<>();
|
Map<String, String> proxyMap = new HashMap<>();
|
||||||
proxyMap.put("pushToken", token);
|
proxyMap.put("pushToken", token);
|
||||||
proxyMap.put("deviceIdentifier", pushRegistrationOverall.getOcs().getData().
|
proxyMap.put("deviceIdentifier", pushRegistrationOverall.getOcs().getData().
|
||||||
|
@ -274,12 +291,12 @@ public class PushUtils {
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe(new Observer<Void>() {
|
.subscribe(new Observer<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(Void aVoid) {
|
public void onNext(@NonNull Void aVoid) {
|
||||||
PushConfigurationState pushConfigurationState =
|
PushConfigurationState pushConfigurationState =
|
||||||
new PushConfigurationState();
|
new PushConfigurationState();
|
||||||
pushConfigurationState.setPushToken(token);
|
pushConfigurationState.setPushToken(token);
|
||||||
|
@ -332,7 +349,7 @@ public class PushUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
eventBus.post(new EventStatus(userEntity.getId(),
|
eventBus.post(new EventStatus(userEntity.getId(),
|
||||||
EventStatus.EventType.PUSH_REGISTRATION, false));
|
EventStatus.EventType.PUSH_REGISTRATION, false));
|
||||||
}
|
}
|
||||||
|
@ -345,7 +362,7 @@ public class PushUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
eventBus.post(new EventStatus(userEntity.getId(),
|
eventBus.post(new EventStatus(userEntity.getId(),
|
||||||
EventStatus.EventType.PUSH_REGISTRATION, false));
|
EventStatus.EventType.PUSH_REGISTRATION, false));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue