Merge pull request #1849 from nextcloud/bugfix/noid/migratePushToKotlin

Migrate Push to Kotlin
This commit is contained in:
Andy Scherzinger 2022-03-07 15:23:42 +01:00 committed by GitHub
commit 34b82f8da2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 353 additions and 792 deletions

View File

@ -178,7 +178,7 @@ class MagicFirebaseMessagingService : FirebaseMessagingService() {
} else if (deleteAll) {
cancelAllNotificationsForAccount(applicationContext, signatureVerification!!.userEntity)
} else if (deleteMultiple) {
notificationIds.forEach {
notificationIds!!.forEach {
cancelExistingNotificationWithId(
applicationContext,
signatureVerification!!.userEntity,

View File

@ -71,6 +71,7 @@ import com.nextcloud.talk.utils.preferences.AppPreferences;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import org.parceler.Parcels;
import java.io.IOException;
@ -255,7 +256,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
adapter = new FlexibleAdapter<>(contactItems, getActivity(), false);
if (currentUser != null) {
fetchData(true);
fetchData();
}
}
@ -459,7 +460,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
}
}
private void fetchData(boolean startFromScratch) {
private void fetchData() {
dispose(null);
alreadyFetching = true;
@ -506,12 +507,12 @@ public class ContactsController extends BaseController implements SearchView.OnQ
.retry(3)
.subscribe(new Observer<ResponseBody>() {
@Override
public void onSubscribe(Disposable d) {
public void onSubscribe(@NotNull Disposable d) {
contactsQueryDisposable = d;
}
@Override
public void onNext(ResponseBody responseBody) {
public void onNext(@NotNull ResponseBody responseBody) {
if (responseBody != null) {
Participant participant;
@ -636,7 +637,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ
}
if (o1 instanceof ContactItem && o2 instanceof ContactItem) {
if ("groups".equals(((ContactItem) o1).getModel().getSource()) && "groups".equals(((ContactItem) o2).getModel().getSource())) {
if ("groups".equals(((ContactItem) o1).getModel().getSource()) &&
"groups".equals(((ContactItem) o2).getModel().getSource())) {
return firstName.compareToIgnoreCase(secondName);
} else if ("groups".equals(((ContactItem) o1).getModel().getSource())) {
return -1;
@ -661,7 +663,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
}
@Override
public void onError(Throwable e) {
public void onError(@NotNull Throwable e) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
@ -679,7 +681,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
disengageProgressBar();
}
});
}
private void prepareViews() {
@ -688,7 +689,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(adapter);
swipeRefreshLayout.setOnRefreshListener(() -> fetchData(true));
swipeRefreshLayout.setOnRefreshListener(this::fetchData);
swipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.refresh_spinner_background);
@ -759,7 +760,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
public boolean onQueryTextChange(String newText) {
if (!newText.equals("") && adapter.hasNewFilter(newText)) {
adapter.setFilter(newText);
fetchData(true);
fetchData();
} else if (newText.equals("")) {
adapter.setFilter("");
adapter.updateDataSet(contactItems);

View File

@ -374,7 +374,7 @@ public class OperationsMenuController extends BaseController {
@io.reactivex.annotations.NonNull RoomOverall roomOverall
) {
conversation = roomOverall.getOcs().getData();
initiateConversation(false);
initiateConversation();
}
@Override
@ -388,7 +388,7 @@ public class OperationsMenuController extends BaseController {
}
});
} else {
initiateConversation(false);
initiateConversation();
}
}
@ -594,7 +594,6 @@ public class OperationsMenuController extends BaseController {
}
private void inviteUsersToAConversation() {
RetrofitBucket retrofitBucket;
final ArrayList<String> localInvitedUsers = invitedUsers;
final ArrayList<String> localInvitedGroups = invitedGroups;
if (localInvitedGroups.size() > 0) {
@ -608,7 +607,7 @@ public class OperationsMenuController extends BaseController {
addGroupsToConversation(localInvitedUsers, localInvitedGroups, apiVersion);
addUsersToConversation(localInvitedUsers, localInvitedGroups, apiVersion);
} else {
initiateConversation(true);
initiateConversation();
}
}
@ -653,7 +652,7 @@ public class OperationsMenuController extends BaseController {
}
if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) {
initiateConversation(true);
initiateConversation();
}
dispose();
}
@ -707,7 +706,7 @@ public class OperationsMenuController extends BaseController {
}
if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) {
initiateConversation(true);
initiateConversation();
}
dispose();
}
@ -717,7 +716,7 @@ public class OperationsMenuController extends BaseController {
}
}
private void initiateConversation(boolean dismissView) {
private void initiateConversation() {
eventBus.post(new ConversationsListFetchDataEvent());
Bundle bundle = new Bundle();
@ -787,7 +786,7 @@ public class OperationsMenuController extends BaseController {
showResultImage(true, false);
} else {
conversation = roomOverall.getOcs().getData();
initiateConversation(true);
initiateConversation();
}
}

View File

@ -41,6 +41,9 @@ import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageUtils;
import com.nextcloud.talk.utils.database.user.UserUtils;
import com.nextcloud.talk.webrtc.WebSocketConnectionHelper;
import org.jetbrains.annotations.NotNull;
import io.reactivex.CompletableObserver;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
@ -100,16 +103,17 @@ public class AccountRemovalWorker extends Worker {
.getBaseUrl()))
.blockingSubscribe(new Observer<GenericOverall>() {
@Override
public void onSubscribe(Disposable d) {
public void onSubscribe(@NotNull Disposable d) {
}
@Override
public void onNext(GenericOverall genericOverall) {
public void onNext(@NotNull GenericOverall genericOverall) {
if (genericOverall.getOcs().getMeta().getStatusCode() == 200
|| genericOverall.getOcs().getMeta().getStatusCode() == 202) {
HashMap<String, String> queryMap = new HashMap<>();
queryMap.put("deviceIdentifier", finalPushConfigurationState.deviceIdentifier);
queryMap.put("deviceIdentifier",
finalPushConfigurationState.getDeviceIdentifier());
queryMap.put("userPublicKey", finalPushConfigurationState.getUserPublicKey());
queryMap.put("deviceIdentifierSignature",
finalPushConfigurationState.getDeviceIdentifierSignature());
@ -118,7 +122,7 @@ public class AccountRemovalWorker extends Worker {
}
@Override
public void onError(Throwable e) {
public void onError(@NotNull Throwable e) {
Log.e(TAG, "error while trying to unregister Device For Notifications", e);
}

View File

@ -513,11 +513,11 @@ public class NotificationWorker extends Worker {
DecryptedPushMessage.class);
decryptedPushMessage.setTimestamp(System.currentTimeMillis());
if (decryptedPushMessage.isDelete()) {
if (decryptedPushMessage.getDelete()) {
NotificationUtils.INSTANCE.cancelExistingNotificationWithId(context, signatureVerification.getUserEntity(), decryptedPushMessage.getNotificationId());
} else if (decryptedPushMessage.isDeleteAll()) {
} else if (decryptedPushMessage.getDeleteAll()) {
NotificationUtils.INSTANCE.cancelAllNotificationsForAccount(context, signatureVerification.getUserEntity());
} else if (decryptedPushMessage.isDeleteMultiple()) {
} else if (decryptedPushMessage.getDeleteMultiple()) {
for (long notificationId : decryptedPushMessage.getNotificationIds()) {
NotificationUtils.INSTANCE.cancelExistingNotificationWithId(context, signatureVerification.getUserEntity(), notificationId);
}

View File

@ -1,249 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonIgnore;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class DecryptedPushMessage {
@JsonField(name = "app")
public String app;
@JsonField(name = "type")
public String type;
@JsonField(name = "subject")
public String subject;
@JsonField(name = "id")
public String id;
@JsonField(name = "nid")
public long notificationId;
@JsonField(name = "nids")
public long[] notificationIds;
@JsonField(name = "delete")
public boolean delete;
@JsonField(name = "delete-all")
public boolean deleteAll;
@JsonField(name = "delete-multiple")
public boolean deleteMultiple;
@JsonIgnore
public NotificationUser notificationUser;
@JsonIgnore
public String text;
@JsonIgnore
public long timestamp;
public String getApp() {
return this.app;
}
public String getType() {
return this.type;
}
public String getSubject() {
return this.subject;
}
public String getId() {
return this.id;
}
public long getNotificationId() {
return this.notificationId;
}
public boolean isDelete() {
return this.delete;
}
public boolean isDeleteAll() {
return this.deleteAll;
}
public NotificationUser getNotificationUser() {
return this.notificationUser;
}
public String getText() {
return this.text;
}
public long getTimestamp() {
return this.timestamp;
}
public long[] getNotificationIds() {
return notificationIds;
}
public boolean isDeleteMultiple() {
return deleteMultiple;
}
public void setApp(String app) {
this.app = app;
}
public void setType(String type) {
this.type = type;
}
public void setSubject(String subject) {
this.subject = subject;
}
public void setId(String id) {
this.id = id;
}
public void setNotificationId(long notificationId) {
this.notificationId = notificationId;
}
public void setDelete(boolean delete) {
this.delete = delete;
}
public void setDeleteAll(boolean deleteAll) {
this.deleteAll = deleteAll;
}
public void setNotificationUser(NotificationUser notificationUser) {
this.notificationUser = notificationUser;
}
public void setText(String text) {
this.text = text;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public void setNotificationIds(long[] notificationIds) {
this.notificationIds = notificationIds;
}
public void setDeleteMultiple(boolean deleteMultiple) {
this.deleteMultiple = deleteMultiple;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof DecryptedPushMessage)) {
return false;
}
final DecryptedPushMessage other = (DecryptedPushMessage) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$app = this.getApp();
final Object other$app = other.getApp();
if (this$app == null ? other$app != null : !this$app.equals(other$app)) {
return false;
}
final Object this$type = this.getType();
final Object other$type = other.getType();
if (this$type == null ? other$type != null : !this$type.equals(other$type)) {
return false;
}
final Object this$subject = this.getSubject();
final Object other$subject = other.getSubject();
if (this$subject == null ? other$subject != null : !this$subject.equals(other$subject)) {
return false;
}
final Object this$id = this.getId();
final Object other$id = other.getId();
if (this$id == null ? other$id != null : !this$id.equals(other$id)) {
return false;
}
if (this.getNotificationId() != other.getNotificationId()) {
return false;
}
if (this.isDelete() != other.isDelete()) {
return false;
}
if (this.isDeleteAll() != other.isDeleteAll()) {
return false;
}
final Object this$notificationUser = this.getNotificationUser();
final Object other$notificationUser = other.getNotificationUser();
if (this$notificationUser == null ? other$notificationUser != null : !this$notificationUser.equals(other$notificationUser)) {
return false;
}
final Object this$text = this.getText();
final Object other$text = other.getText();
if (this$text == null ? other$text != null : !this$text.equals(other$text)) {
return false;
}
return this.getTimestamp() == other.getTimestamp();
}
protected boolean canEqual(final Object other) {
return other instanceof DecryptedPushMessage;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $app = this.getApp();
result = result * PRIME + ($app == null ? 43 : $app.hashCode());
final Object $type = this.getType();
result = result * PRIME + ($type == null ? 43 : $type.hashCode());
final Object $subject = this.getSubject();
result = result * PRIME + ($subject == null ? 43 : $subject.hashCode());
final Object $id = this.getId();
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
final long $notificationId = this.getNotificationId();
result = result * PRIME + (int) ($notificationId >>> 32 ^ $notificationId);
result = result * PRIME + (this.isDelete() ? 79 : 97);
result = result * PRIME + (this.isDeleteAll() ? 79 : 97);
final Object $notificationUser = this.getNotificationUser();
result = result * PRIME + ($notificationUser == null ? 43 : $notificationUser.hashCode());
final Object $text = this.getText();
result = result * PRIME + ($text == null ? 43 : $text.hashCode());
final long $timestamp = this.getTimestamp();
result = result * PRIME + (int) ($timestamp >>> 32 ^ $timestamp);
return result;
}
public String toString() {
return "DecryptedPushMessage(app=" + this.getApp() + ", type=" + this.getType() + ", subject=" + this.getSubject() + ", id=" + this.getId() + ", notificationId=" + this.getNotificationId() + ", delete=" + this.isDelete() + ", deleteAll=" + this.isDeleteAll() + ", notificationUser=" + this.getNotificationUser() + ", text=" + this.getText() + ", timestamp=" + this.getTimestamp() + ")";
}
}

View File

@ -0,0 +1,110 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonIgnore
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class DecryptedPushMessage(
@JsonField(name = ["app"])
var app: String?,
@JsonField(name = ["type"])
var type: String?,
@JsonField(name = ["subject"])
var subject: String,
@JsonField(name = ["id"])
var id: String?,
@JsonField(name = ["nid"])
var notificationId: Long?,
@JsonField(name = ["nids"])
var notificationIds: LongArray?,
@JsonField(name = ["delete"])
var delete: Boolean,
@JsonField(name = ["delete-all"])
var deleteAll: Boolean,
@JsonField(name = ["delete-multiple"])
var deleteMultiple: Boolean,
@JsonIgnore
var notificationUser: NotificationUser?,
@JsonIgnore
var text: String?,
@JsonIgnore
var timestamp: Long
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, "", null, 0, null, false, false, false, null, null, 0)
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as DecryptedPushMessage
if (app != other.app) return false
if (type != other.type) return false
if (subject != other.subject) return false
if (id != other.id) return false
if (notificationId != other.notificationId) return false
if (notificationIds != null) {
if (other.notificationIds == null) return false
if (!notificationIds.contentEquals(other.notificationIds)) return false
} else if (other.notificationIds != null) return false
if (delete != other.delete) return false
if (deleteAll != other.deleteAll) return false
if (deleteMultiple != other.deleteMultiple) return false
if (notificationUser != other.notificationUser) return false
if (text != other.text) return false
if (timestamp != other.timestamp) return false
return true
}
override fun hashCode(): Int {
var result = app?.hashCode() ?: 0
result = 31 * result + (type?.hashCode() ?: 0)
result = 31 * result + (subject?.hashCode() ?: 0)
result = 31 * result + (id?.hashCode() ?: 0)
result = 31 * result + (notificationId?.hashCode() ?: 0)
result = 31 * result + (notificationIds?.contentHashCode() ?: 0)
result = 31 * result + (delete?.hashCode() ?: 0)
result = 31 * result + (deleteAll?.hashCode() ?: 0)
result = 31 * result + (deleteMultiple?.hashCode() ?: 0)
result = 31 * result + (notificationUser?.hashCode() ?: 0)
result = 31 * result + (text?.hashCode() ?: 0)
result = 31 * result + (timestamp?.hashCode() ?: 0)
return result
}
}

View File

@ -1,110 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017-2019 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class NotificationUser {
@JsonField(name = "type")
String type;
@JsonField(name = "id")
String id;
@JsonField(name = "name")
String name;
public String getType() {
return this.type;
}
public String getId() {
return this.id;
}
public String getName() {
return this.name;
}
public void setType(String type) {
this.type = type;
}
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof NotificationUser)) {
return false;
}
final NotificationUser other = (NotificationUser) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$type = this.getType();
final Object other$type = other.getType();
if (this$type == null ? other$type != null : !this$type.equals(other$type)) {
return false;
}
final Object this$id = this.getId();
final Object other$id = other.getId();
if (this$id == null ? other$id != null : !this$id.equals(other$id)) {
return false;
}
final Object this$name = this.getName();
final Object other$name = other.getName();
return this$name == null ? other$name == null : this$name.equals(other$name);
}
protected boolean canEqual(final Object other) {
return other instanceof NotificationUser;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $type = this.getType();
result = result * PRIME + ($type == null ? 43 : $type.hashCode());
final Object $id = this.getId();
result = result * PRIME + ($id == null ? 43 : $id.hashCode());
final Object $name = this.getName();
result = result * PRIME + ($name == null ? 43 : $name.hashCode());
return result;
}
public String toString() {
return "NotificationUser(type=" + this.getType() + ", id=" + this.getId() + ", name=" + this.getName() + ")";
}
}

View File

@ -0,0 +1,43 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class NotificationUser(
@JsonField(name = ["type"])
var type: String?,
@JsonField(name = ["id"])
var id: String?,
@JsonField(name = ["name"])
var name: String?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null)
}

View File

@ -1,143 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class PushConfigurationState {
@JsonField(name = "pushToken")
public String pushToken;
@JsonField(name = "deviceIdentifier")
public String deviceIdentifier;
@JsonField(name = "deviceIdentifierSignature")
public String deviceIdentifierSignature;
@JsonField(name = "userPublicKey")
public String userPublicKey;
@JsonField(name = "usesRegularPass")
public boolean usesRegularPass;
public String getPushToken() {
return this.pushToken;
}
public String getDeviceIdentifier() {
return this.deviceIdentifier;
}
public String getDeviceIdentifierSignature() {
return this.deviceIdentifierSignature;
}
public String getUserPublicKey() {
return this.userPublicKey;
}
public boolean isUsesRegularPass() {
return this.usesRegularPass;
}
public void setPushToken(String pushToken) {
this.pushToken = pushToken;
}
public void setDeviceIdentifier(String deviceIdentifier) {
this.deviceIdentifier = deviceIdentifier;
}
public void setDeviceIdentifierSignature(String deviceIdentifierSignature) {
this.deviceIdentifierSignature = deviceIdentifierSignature;
}
public void setUserPublicKey(String userPublicKey) {
this.userPublicKey = userPublicKey;
}
public void setUsesRegularPass(boolean usesRegularPass) {
this.usesRegularPass = usesRegularPass;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof PushConfigurationState)) {
return false;
}
final PushConfigurationState other = (PushConfigurationState) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$pushToken = this.getPushToken();
final Object other$pushToken = other.getPushToken();
if (this$pushToken == null ? other$pushToken != null : !this$pushToken.equals(other$pushToken)) {
return false;
}
final Object this$deviceIdentifier = this.getDeviceIdentifier();
final Object other$deviceIdentifier = other.getDeviceIdentifier();
if (this$deviceIdentifier == null ? other$deviceIdentifier != null : !this$deviceIdentifier.equals(other$deviceIdentifier)) {
return false;
}
final Object this$deviceIdentifierSignature = this.getDeviceIdentifierSignature();
final Object other$deviceIdentifierSignature = other.getDeviceIdentifierSignature();
if (this$deviceIdentifierSignature == null ? other$deviceIdentifierSignature != null : !this$deviceIdentifierSignature.equals(other$deviceIdentifierSignature)) {
return false;
}
final Object this$userPublicKey = this.getUserPublicKey();
final Object other$userPublicKey = other.getUserPublicKey();
if (this$userPublicKey == null ? other$userPublicKey != null : !this$userPublicKey.equals(other$userPublicKey)) {
return false;
}
return this.isUsesRegularPass() == other.isUsesRegularPass();
}
protected boolean canEqual(final Object other) {
return other instanceof PushConfigurationState;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $pushToken = this.getPushToken();
result = result * PRIME + ($pushToken == null ? 43 : $pushToken.hashCode());
final Object $deviceIdentifier = this.getDeviceIdentifier();
result = result * PRIME + ($deviceIdentifier == null ? 43 : $deviceIdentifier.hashCode());
final Object $deviceIdentifierSignature = this.getDeviceIdentifierSignature();
result = result * PRIME + ($deviceIdentifierSignature == null ? 43 : $deviceIdentifierSignature.hashCode());
final Object $userPublicKey = this.getUserPublicKey();
result = result * PRIME + ($userPublicKey == null ? 43 : $userPublicKey.hashCode());
result = result * PRIME + (this.isUsesRegularPass() ? 79 : 97);
return result;
}
public String toString() {
return "PushConfigurationState(pushToken=" + this.getPushToken() + ", deviceIdentifier=" + this.getDeviceIdentifier() + ", deviceIdentifierSignature=" + this.getDeviceIdentifierSignature() + ", userPublicKey=" + this.getUserPublicKey() + ", usesRegularPass=" + this.isUsesRegularPass() + ")";
}
}

View File

@ -0,0 +1,49 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class PushConfigurationState(
@JsonField(name = ["pushToken"])
var pushToken: String?,
@JsonField(name = ["deviceIdentifier"])
var deviceIdentifier: String?,
@JsonField(name = ["deviceIdentifierSignature"])
var deviceIdentifierSignature: String?,
@JsonField(name = ["userPublicKey"])
var userPublicKey: String?,
@JsonField(name = ["usesRegularPass"])
var usesRegularPass: Boolean?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null, null, false)
}

View File

@ -1,112 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class PushRegistration {
@JsonField(name = "publicKey")
String publicKey;
@JsonField(name = "deviceIdentifier")
String deviceIdentifier;
@JsonField(name = "signature")
String signature;
public String getPublicKey() {
return this.publicKey;
}
public String getDeviceIdentifier() {
return this.deviceIdentifier;
}
public String getSignature() {
return this.signature;
}
public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}
public void setDeviceIdentifier(String deviceIdentifier) {
this.deviceIdentifier = deviceIdentifier;
}
public void setSignature(String signature) {
this.signature = signature;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof PushRegistration)) {
return false;
}
final PushRegistration other = (PushRegistration) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$publicKey = this.getPublicKey();
final Object other$publicKey = other.getPublicKey();
if (this$publicKey == null ? other$publicKey != null : !this$publicKey.equals(other$publicKey)) {
return false;
}
final Object this$deviceIdentifier = this.getDeviceIdentifier();
final Object other$deviceIdentifier = other.getDeviceIdentifier();
if (this$deviceIdentifier == null ? other$deviceIdentifier != null : !this$deviceIdentifier.equals(other$deviceIdentifier)) {
return false;
}
final Object this$signature = this.getSignature();
final Object other$signature = other.getSignature();
return this$signature == null ? other$signature == null : this$signature.equals(other$signature);
}
protected boolean canEqual(final Object other) {
return other instanceof PushRegistration;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $publicKey = this.getPublicKey();
result = result * PRIME + ($publicKey == null ? 43 : $publicKey.hashCode());
final Object $deviceIdentifier = this.getDeviceIdentifier();
result = result * PRIME + ($deviceIdentifier == null ? 43 : $deviceIdentifier.hashCode());
final Object $signature = this.getSignature();
result = result * PRIME + ($signature == null ? 43 : $signature.hashCode());
return result;
}
public String toString() {
return "PushRegistration(publicKey=" + this.getPublicKey() + ", deviceIdentifier=" + this.getDeviceIdentifier() + ", signature=" + this.getSignature() + ")";
}
}

View File

@ -0,0 +1,43 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class PushRegistration(
@JsonField(name = ["publicKey"])
var publicKey: String?,
@JsonField(name = ["deviceIdentifier"])
var deviceIdentifier: String?,
@JsonField(name = ["signature"])
var signature: String?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null)
}

View File

@ -1,75 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.models.json.generic.GenericOCS;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class PushRegistrationOCS extends GenericOCS {
@JsonField(name = "data")
PushRegistration data;
public PushRegistration getData() {
return this.data;
}
public void setData(PushRegistration data) {
this.data = data;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof PushRegistrationOCS)) {
return false;
}
final PushRegistrationOCS other = (PushRegistrationOCS) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$data = this.getData();
final Object other$data = other.getData();
return this$data == null ? other$data == null : this$data.equals(other$data);
}
protected boolean canEqual(final Object other) {
return other instanceof PushRegistrationOCS;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $data = this.getData();
result = result * PRIME + ($data == null ? 43 : $data.hashCode());
return result;
}
public String toString() {
return "PushRegistrationOCS(data=" + this.getData() + ")";
}
}

View File

@ -0,0 +1,38 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import com.nextcloud.talk.models.json.generic.GenericOCS
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class PushRegistrationOCS(
@JsonField(name = ["data"])
var data: PushRegistration?
) : GenericOCS(), Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null)
}

View File

@ -1,74 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class PushRegistrationOverall {
@JsonField(name = "ocs")
PushRegistrationOCS ocs;
public PushRegistrationOCS getOcs() {
return this.ocs;
}
public void setOcs(PushRegistrationOCS ocs) {
this.ocs = ocs;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof PushRegistrationOverall)) {
return false;
}
final PushRegistrationOverall other = (PushRegistrationOverall) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$ocs = this.getOcs();
final Object other$ocs = other.getOcs();
return this$ocs == null ? other$ocs == null : this$ocs.equals(other$ocs);
}
protected boolean canEqual(final Object other) {
return other instanceof PushRegistrationOverall;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $ocs = this.getOcs();
result = result * PRIME + ($ocs == null ? 43 : $ocs.hashCode());
return result;
}
public String toString() {
return "PushRegistrationOverall(ocs=" + this.getOcs() + ")";
}
}

View File

@ -0,0 +1,37 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.push
import android.os.Parcelable
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class PushRegistrationOverall(
@JsonField(name = ["ocs"])
var ocs: PushRegistrationOCS?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null)
}

View File

@ -193,7 +193,7 @@ object NotificationUtils {
}
}
fun cancelExistingNotificationWithId(context: Context?, conversationUser: UserEntity, notificationId: Long) {
fun cancelExistingNotificationWithId(context: Context?, conversationUser: UserEntity, notificationId: Long?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && conversationUser.id != -1L &&
context != null
) {

View File

@ -331,7 +331,7 @@ public class PushUtils {
pushConfigurationState.setDeviceIdentifier(proxyMap.get("deviceIdentifier"));
pushConfigurationState.setDeviceIdentifierSignature(proxyMap.get("deviceIdentifierSignature"));
pushConfigurationState.setUserPublicKey(proxyMap.get("userPublicKey"));
pushConfigurationState.setUsesRegularPass(false);
pushConfigurationState.setUsesRegularPass(Boolean.FALSE);
userUtils.createOrUpdateUser(null,
null,

View File

@ -1,5 +1,5 @@
build:
maxIssues: 223
maxIssues: 217
weights:
# complexity: 2
# LongParameterList: 1

View File

@ -1 +1 @@
448
446