diff --git a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java index 4b526c8e7..c9b0ea931 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java @@ -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() { @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 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); } diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index 14ae12927..bee4bc1e6 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -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); } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java b/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java deleted file mode 100644 index 1f3498950..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.java +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * 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 . - */ - -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() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.kt b/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.kt new file mode 100644 index 000000000..8e9a54f14 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/DecryptedPushMessage.kt @@ -0,0 +1,110 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017 Mario Danic + * + * 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 . + */ +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, 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 + } +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/NotificationUser.java b/app/src/main/java/com/nextcloud/talk/models/json/push/NotificationUser.java deleted file mode 100644 index c1121b0cd..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/NotificationUser.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2019 Mario Danic - * - * 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 . - */ - -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() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/NotificationUser.kt b/app/src/main/java/com/nextcloud/talk/models/json/push/NotificationUser.kt new file mode 100644 index 000000000..62351a4ed --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/NotificationUser.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017 Mario Danic + * + * 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 . + */ +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) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushConfigurationState.java b/app/src/main/java/com/nextcloud/talk/models/json/push/PushConfigurationState.java deleted file mode 100644 index 19115b49b..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/PushConfigurationState.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * 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 . - */ - -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() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushConfigurationState.kt b/app/src/main/java/com/nextcloud/talk/models/json/push/PushConfigurationState.kt new file mode 100644 index 000000000..ff68fd87f --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/PushConfigurationState.kt @@ -0,0 +1,49 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017 Mario Danic + * + * 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 . + */ +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) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistration.java b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistration.java deleted file mode 100644 index cca7da596..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistration.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * 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 . - */ - -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() + ")"; - } -} - diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistration.kt b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistration.kt new file mode 100644 index 000000000..eb5c3b2d5 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistration.kt @@ -0,0 +1,43 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017 Mario Danic + * + * 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 . + */ +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) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOCS.java deleted file mode 100644 index 4ae277ada..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOCS.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * 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 . - */ - -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() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOCS.kt new file mode 100644 index 000000000..85e8c0fc2 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOCS.kt @@ -0,0 +1,38 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017 Mario Danic + * + * 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 . + */ +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) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOverall.java deleted file mode 100644 index 1bdd0160e..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOverall.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017 Mario Danic - * - * 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 . - */ - -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() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOverall.kt new file mode 100644 index 000000000..bedb13144 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/push/PushRegistrationOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2017 Mario Danic + * + * 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 . + */ +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) +}