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.database.user.UserUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.parceler.Parcels;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -183,17 +182,17 @@ public class ProfileController extends BaseController {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UserProfileFieldsOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
public void onSubscribe(@io.reactivex.annotations.NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull UserProfileFieldsOverall userProfileFieldsOverall) {
|
||||
public void onNext(@io.reactivex.annotations.NonNull UserProfileFieldsOverall userProfileFieldsOverall) {
|
||||
editableFields = userProfileFieldsOverall.getOcs().getData();
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NotNull Throwable e) {
|
||||
public void onError(@io.reactivex.annotations.NonNull Throwable e) {
|
||||
edit = false;
|
||||
}
|
||||
|
||||
|
@ -243,11 +242,11 @@ public class ProfileController extends BaseController {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<GenericOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull GenericOverall genericOverall) {
|
||||
public void onNext(@NonNull GenericOverall genericOverall) {
|
||||
DisplayUtils.loadAvatarImage(
|
||||
currentUser,
|
||||
getActivity().findViewById(R.id.avatar_image),
|
||||
|
@ -255,7 +254,7 @@ public class ProfileController extends BaseController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NotNull Throwable e) {
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.content.Context;
|
|||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import autodagger.AutoInjector;
|
||||
|
||||
import com.bluelinelabs.logansquare.LoganSquare;
|
||||
import com.nextcloud.talk.R;
|
||||
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.utils.database.user.UserUtils;
|
||||
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 javax.inject.Inject;
|
||||
import java.io.*;
|
||||
import java.security.*;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
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.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
@ -51,6 +61,14 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
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)
|
||||
public class PushUtils {
|
||||
private static final String TAG = "PushUtils";
|
||||
|
@ -247,18 +265,17 @@ public class PushUtils {
|
|||
|
||||
credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
||||
|
||||
String finalCredentials = credentials;
|
||||
ncApi.registerDeviceForNotificationsWithNextcloud(
|
||||
credentials,
|
||||
ApiUtils.getUrlNextcloudPush(userEntity.getBaseUrl()), queryMap)
|
||||
.subscribe(new Observer<PushRegistrationOverall>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(PushRegistrationOverall pushRegistrationOverall) {
|
||||
public void onNext(@NonNull PushRegistrationOverall pushRegistrationOverall) {
|
||||
Map<String, String> proxyMap = new HashMap<>();
|
||||
proxyMap.put("pushToken", token);
|
||||
proxyMap.put("deviceIdentifier", pushRegistrationOverall.getOcs().getData().
|
||||
|
@ -274,12 +291,12 @@ public class PushUtils {
|
|||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new Observer<Void>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Void aVoid) {
|
||||
public void onNext(@NonNull Void aVoid) {
|
||||
PushConfigurationState pushConfigurationState =
|
||||
new PushConfigurationState();
|
||||
pushConfigurationState.setPushToken(token);
|
||||
|
@ -332,7 +349,7 @@ public class PushUtils {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
public void onError(@NonNull Throwable e) {
|
||||
eventBus.post(new EventStatus(userEntity.getId(),
|
||||
EventStatus.EventType.PUSH_REGISTRATION, false));
|
||||
}
|
||||
|
@ -345,7 +362,7 @@ public class PushUtils {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
public void onError(@NonNull Throwable e) {
|
||||
eventBus.post(new EventStatus(userEntity.getId(),
|
||||
EventStatus.EventType.PUSH_REGISTRATION, false));
|
||||
|
||||
|
|
Loading…
Reference in a new issue