From 0c824120e36aabb4b4ac8c260a383490238f7782 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 14 May 2022 15:15:58 +0200 Subject: [PATCH 1/6] migrate generic OCS to kotlin data classes + interface Signed-off-by: Andy Scherzinger --- .../talk/controllers/SettingsController.java | 2 +- .../talk/jobs/AccountRemovalWorker.java | 9 +- .../talk/models/json/generic/GenericMeta.java | 107 ------------------ .../talk/models/json/generic/GenericMeta.kt | 41 +++++++ .../talk/models/json/generic/GenericOCS.java | 41 ------- .../models/json/generic/GenericOverall.java | 74 ------------ .../models/json/generic/GenericOverall.kt | 40 +++++++ .../talk/models/json/generic/IGenericOCS.kt | 24 ++++ .../json/notifications/NotificationOCS.kt | 12 +- .../talk/ui/dialog/MessageActionsDialog.kt | 2 +- 10 files changed, 122 insertions(+), 230 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/IGenericOCS.kt diff --git a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java index 112284224..d48e8fe53 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java @@ -968,7 +968,7 @@ public class SettingsController extends BaseController { @Override public void onNext(@io.reactivex.annotations.NonNull GenericOverall genericOverall) { - int statusCode = genericOverall.ocs.meta.statusCode; + int statusCode = Objects.requireNonNull(genericOverall.getMeta()).getStatusCode(); if (statusCode == 200) { dialog.dismiss(); Toast.makeText(context, context.getResources().getString( 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 c9b0ea931..3eb0ea2a3 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/AccountRemovalWorker.java @@ -55,6 +55,7 @@ import javax.inject.Inject; import java.io.IOException; import java.net.CookieManager; import java.util.HashMap; +import java.util.Objects; import java.util.zip.CRC32; @AutoInjector(NextcloudTalkApplication.class) @@ -104,13 +105,13 @@ public class AccountRemovalWorker extends Worker { .blockingSubscribe(new Observer() { @Override public void onSubscribe(@NotNull Disposable d) { - + // unused atm } @Override public void onNext(@NotNull GenericOverall genericOverall) { - if (genericOverall.getOcs().getMeta().getStatusCode() == 200 - || genericOverall.getOcs().getMeta().getStatusCode() == 202) { + if (Objects.requireNonNull(genericOverall.getMeta()).getStatusCode() == 200 || + genericOverall.getMeta().getStatusCode() == 202) { HashMap queryMap = new HashMap<>(); queryMap.put("deviceIdentifier", finalPushConfigurationState.getDeviceIdentifier()); @@ -128,7 +129,7 @@ public class AccountRemovalWorker extends Worker { @Override public void onComplete() { - + // unused atm } }); } else { diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.java b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.java deleted file mode 100644 index bca1ca26f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.java +++ /dev/null @@ -1,107 +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 . - */ -package com.nextcloud.talk.models.json.generic; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject(serializeNullObjects = true) -public class GenericMeta { - @JsonField(name = "status") - public String status; - - @JsonField(name = "statuscode") - public int statusCode; - - @JsonField(name = "message") - public String message; - - public String getStatus() { - return this.status; - } - - public int getStatusCode() { - return this.statusCode; - } - - public String getMessage() { - return this.message; - } - - public void setStatus(String status) { - this.status = status; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - public void setMessage(String message) { - this.message = message; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof GenericMeta)) { - return false; - } - final GenericMeta other = (GenericMeta) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$status = this.getStatus(); - final Object other$status = other.getStatus(); - if (this$status == null ? other$status != null : !this$status.equals(other$status)) { - return false; - } - if (this.getStatusCode() != other.getStatusCode()) { - return false; - } - final Object this$message = this.getMessage(); - final Object other$message = other.getMessage(); - - return this$message == null ? other$message == null : this$message.equals(other$message); - } - - protected boolean canEqual(final Object other) { - return other instanceof GenericMeta; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $status = this.getStatus(); - result = result * PRIME + ($status == null ? 43 : $status.hashCode()); - result = result * PRIME + this.getStatusCode(); - final Object $message = this.getMessage(); - result = result * PRIME + ($message == null ? 43 : $message.hashCode()); - return result; - } - - public String toString() { - return "GenericMeta(status=" + this.getStatus() + ", statusCode=" + this.getStatusCode() + ", message=" + this.getMessage() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.kt b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.kt new file mode 100644 index 000000000..8ec5c0f9e --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericMeta.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.generic + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject(serializeNullObjects = true) +data class GenericMeta( + @JsonField(name = ["status"]) + var status: String? = null, + @JsonField(name = ["statuscode"]) + var statusCode: Int = 0, + @JsonField(name = ["message"]) + var message: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, 0, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java index c4273a5af..c17a7a3ad 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java @@ -30,45 +30,4 @@ import org.parceler.Parcel; public class GenericOCS { @JsonField(name = "meta") public GenericMeta meta; - - public GenericMeta getMeta() { - return this.meta; - } - - public void setMeta(GenericMeta meta) { - this.meta = meta; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof GenericOCS)) { - return false; - } - final GenericOCS other = (GenericOCS) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$meta = this.getMeta(); - final Object other$meta = other.getMeta(); - - return this$meta == null ? other$meta == null : this$meta.equals(other$meta); - } - - protected boolean canEqual(final Object other) { - return other instanceof GenericOCS; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $meta = this.getMeta(); - result = result * PRIME + ($meta == null ? 43 : $meta.hashCode()); - return result; - } - - public String toString() { - return "GenericOCS(meta=" + this.getMeta() + ")"; - } } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.java deleted file mode 100644 index 012542b0e..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.java +++ /dev/null @@ -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 . - */ -package com.nextcloud.talk.models.json.generic; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class GenericOverall { - @JsonField(name = "ocs") - public GenericOCS ocs; - - public GenericOCS getOcs() { - return this.ocs; - } - - public void setOcs(GenericOCS ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof GenericOverall)) { - return false; - } - final GenericOverall other = (GenericOverall) 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 GenericOverall; - } - - 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 "GenericOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt new file mode 100644 index 000000000..23135f07d --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOverall.kt @@ -0,0 +1,40 @@ +/* + * + * 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 . + */ +package com.nextcloud.talk.models.json.generic + +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 GenericOverall( + @JsonField(name = ["meta"]) + var meta: GenericMeta? = null +) : IGenericOCS, Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null) + + override fun getGenericMeta(): GenericMeta? { + return meta + } +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/IGenericOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/generic/IGenericOCS.kt new file mode 100644 index 000000000..fc147be49 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/IGenericOCS.kt @@ -0,0 +1,24 @@ +/* + * Nextcloud Talk application + * + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * + * 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.generic + +interface IGenericOCS { + fun getGenericMeta(): GenericMeta? +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt index 999073a55..bcd9320a0 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt @@ -24,15 +24,23 @@ package com.nextcloud.talk.models.json.notifications import android.os.Parcelable import com.bluelinelabs.logansquare.annotation.JsonField import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.generic.GenericMeta import com.nextcloud.talk.models.json.generic.GenericOCS +import com.nextcloud.talk.models.json.generic.IGenericOCS import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class NotificationOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var notification: Notification? -) : GenericOCS(), Parcelable { +) : IGenericOCS, Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) + + override fun getGenericMeta(): GenericMeta? { + return meta + } } diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt index 31bdacf75..e3edd0e4e 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/MessageActionsDialog.kt @@ -318,7 +318,7 @@ class MessageActionsDialog( } override fun onNext(@NonNull genericOverall: GenericOverall) { - val statusCode = genericOverall.ocs.meta.statusCode + val statusCode = genericOverall.meta?.statusCode if (statusCode == HTTP_CREATED) { chatController.updateAdapterAfterSendReaction(message, emoji) } From 90b9207b1aaeb89fe0876ca2ca1866e16d193322 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 14 May 2022 15:24:55 +0200 Subject: [PATCH 2/6] migrate Status to kotlin data class Signed-off-by: Andy Scherzinger --- .../controllers/ServerSelectionController.kt | 12 +- .../talk/models/json/generic/Status.java | 173 ------------------ .../talk/models/json/generic/Status.kt | 55 ++++++ 3 files changed, 61 insertions(+), 179 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/Status.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/generic/Status.kt diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.kt b/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.kt index 8194e2b4c..a85e0009e 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.kt +++ b/app/src/main/java/com/nextcloud/talk/controllers/ServerSelectionController.kt @@ -224,7 +224,7 @@ class ServerSelectionController : .observeOn(AndroidSchedulers.mainThread()) .subscribe({ status: Status -> val productName = resources!!.getString(R.string.nc_server_product_name) - val versionString: String = status.getVersion().substring(0, status.getVersion().indexOf(".")) + val versionString: String = status.version!!.substring(0, status.version!!.indexOf(".")) val version: Int = versionString.toInt() if (isServerStatusQueryable(status) && version >= MIN_SERVER_MAJOR_VERSION) { router.pushController( @@ -237,27 +237,27 @@ class ServerSelectionController : .pushChangeHandler(HorizontalChangeHandler()) .popChangeHandler(HorizontalChangeHandler()) ) - } else if (!status.isInstalled) { + } else if (!status.installed) { setErrorText( String.format( resources!!.getString(R.string.nc_server_not_installed), productName ) ) - } else if (status.isNeedsUpgrade) { + } else if (status.needsUpgrade) { setErrorText( String.format( resources!!.getString(R.string.nc_server_db_upgrade_needed), productName ) ) - } else if (status.isMaintenance) { + } else if (status.maintenance) { setErrorText( String.format( resources!!.getString(R.string.nc_server_maintenance), productName ) ) - } else if (!status.getVersion().startsWith("13.")) { + } else if (!status.version!!.startsWith("13.")) { setErrorText( String.format( resources!!.getString(R.string.nc_server_version), @@ -297,7 +297,7 @@ class ServerSelectionController : } private fun isServerStatusQueryable(status: Status): Boolean { - return status.isInstalled && !status.isMaintenance && !status.isNeedsUpgrade + return status.installed && !status.maintenance && !status.needsUpgrade } private fun setErrorText(text: String) { diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/Status.java b/app/src/main/java/com/nextcloud/talk/models/json/generic/Status.java deleted file mode 100644 index 29eceb139..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/Status.java +++ /dev/null @@ -1,173 +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 . - */ - -package com.nextcloud.talk.models.json.generic; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class Status { - @JsonField(name = "installed") - public boolean installed; - - @JsonField(name = "maintenance") - public boolean maintenance; - - @JsonField(name = "upgrade") - public boolean needsUpgrade; - - @JsonField(name = "version") - public String version; - - @JsonField(name = "versionstring") - public String versionString; - - @JsonField(name = "edition") - public String edition; - - @JsonField(name = "productname") - public String productName; - - public boolean isInstalled() { - return this.installed; - } - - public boolean isMaintenance() { - return this.maintenance; - } - - public boolean isNeedsUpgrade() { - return this.needsUpgrade; - } - - public String getVersion() { - return this.version; - } - - public String getVersionString() { - return this.versionString; - } - - public String getEdition() { - return this.edition; - } - - public String getProductName() { - return this.productName; - } - - public void setInstalled(boolean installed) { - this.installed = installed; - } - - public void setMaintenance(boolean maintenance) { - this.maintenance = maintenance; - } - - public void setNeedsUpgrade(boolean needsUpgrade) { - this.needsUpgrade = needsUpgrade; - } - - public void setVersion(String version) { - this.version = version; - } - - public void setVersionString(String versionString) { - this.versionString = versionString; - } - - public void setEdition(String edition) { - this.edition = edition; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof Status)) { - return false; - } - final Status other = (Status) o; - if (!other.canEqual((Object) this)) { - return false; - } - if (this.isInstalled() != other.isInstalled()) { - return false; - } - if (this.isMaintenance() != other.isMaintenance()) { - return false; - } - if (this.isNeedsUpgrade() != other.isNeedsUpgrade()) { - return false; - } - final Object this$version = this.getVersion(); - final Object other$version = other.getVersion(); - if (this$version == null ? other$version != null : !this$version.equals(other$version)) { - return false; - } - final Object this$versionString = this.getVersionString(); - final Object other$versionString = other.getVersionString(); - if (this$versionString == null ? other$versionString != null : !this$versionString.equals(other$versionString)) { - return false; - } - final Object this$edition = this.getEdition(); - final Object other$edition = other.getEdition(); - if (this$edition == null ? other$edition != null : !this$edition.equals(other$edition)) { - return false; - } - final Object this$productName = this.getProductName(); - final Object other$productName = other.getProductName(); - - return this$productName == null ? other$productName == null : this$productName.equals(other$productName); - } - - protected boolean canEqual(final Object other) { - return other instanceof Status; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - result = result * PRIME + (this.isInstalled() ? 79 : 97); - result = result * PRIME + (this.isMaintenance() ? 79 : 97); - result = result * PRIME + (this.isNeedsUpgrade() ? 79 : 97); - final Object $version = this.getVersion(); - result = result * PRIME + ($version == null ? 43 : $version.hashCode()); - final Object $versionString = this.getVersionString(); - result = result * PRIME + ($versionString == null ? 43 : $versionString.hashCode()); - final Object $edition = this.getEdition(); - result = result * PRIME + ($edition == null ? 43 : $edition.hashCode()); - final Object $productName = this.getProductName(); - result = result * PRIME + ($productName == null ? 43 : $productName.hashCode()); - return result; - } - - public String toString() { - return "Status(installed=" + this.isInstalled() + ", maintenance=" + this.isMaintenance() + ", needsUpgrade=" + this.isNeedsUpgrade() + ", version=" + this.getVersion() + ", versionString=" + this.getVersionString() + ", edition=" + this.getEdition() + ", productName=" + this.getProductName() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/Status.kt b/app/src/main/java/com/nextcloud/talk/models/json/generic/Status.kt new file mode 100644 index 000000000..4e13cfc9c --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/Status.kt @@ -0,0 +1,55 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.generic + +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 Status( + @JsonField(name = ["installed"]) + var installed: Boolean = false, + + @JsonField(name = ["maintenance"]) + var maintenance: Boolean = false, + + @JsonField(name = ["upgrade"]) + var needsUpgrade: Boolean = false, + + @JsonField(name = ["version"]) + var version: String? = null, + + @JsonField(name = ["versionstring"]) + var versionString: String? = null, + + @JsonField(name = ["edition"]) + var edition: String? = null, + + @JsonField(name = ["productname"]) + var productName: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(false, false, false, null, null, null, null) +} From 4b05ed662ffa25a9c102de5c72aaf0f70dd90d47 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 14 May 2022 15:38:59 +0200 Subject: [PATCH 3/6] move data classes away from inheritance Signed-off-by: Andy Scherzinger --- .../json/autocomplete/AutocompleteOCS.kt | 10 +++-- .../json/capabilities/CapabilitiesOCS.kt | 10 +++-- .../models/json/hovercard/HoverCardOCS.kt | 39 +++++++++++-------- .../talk/models/json/mention/MentionOCS.kt | 10 +++-- .../json/notifications/NotificationOCS.kt | 8 +--- .../json/notifications/NotificationsOCS.kt | 10 +++-- .../models/json/push/PushRegistrationOCS.kt | 8 ++-- .../models/json/reactions/ReactionsOCS.kt | 36 +++++++++-------- .../models/json/search/ContactsByNumberOCS.kt | 8 ++-- .../talk/models/json/status/StatusOCS.kt | 38 +++++++++--------- .../status/predefined/PredefinedStatusOCS.kt | 10 +++-- .../talk/models/json/statuses/StatusesOCS.kt | 38 +++++++++--------- .../json/userprofile/UserProfileFieldsOCS.kt | 8 ++-- .../models/json/userprofile/UserProfileOCS.kt | 38 +++++++++--------- 14 files changed, 154 insertions(+), 117 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/models/json/autocomplete/AutocompleteOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/autocomplete/AutocompleteOCS.kt index 7378a147d..6c8912016 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/autocomplete/AutocompleteOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/autocomplete/AutocompleteOCS.kt @@ -3,6 +3,8 @@ * * @author Mario Danic * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger * Copyright (C) 2022 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * @@ -24,15 +26,17 @@ package com.nextcloud.talk.models.json.autocomplete 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class AutocompleteOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: List? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/capabilities/CapabilitiesOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/capabilities/CapabilitiesOCS.kt index 561451a1c..46316ca54 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/capabilities/CapabilitiesOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/capabilities/CapabilitiesOCS.kt @@ -3,6 +3,8 @@ * * @author Mario Danic * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger * Copyright (C) 2022 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * @@ -24,15 +26,17 @@ package com.nextcloud.talk.models.json.capabilities 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class CapabilitiesOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: CapabilitiesList? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/hovercard/HoverCardOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/hovercard/HoverCardOCS.kt index 0b9d16393..acba60336 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/hovercard/HoverCardOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/hovercard/HoverCardOCS.kt @@ -1,34 +1,41 @@ /* * - * Nextcloud Talk application + * Nextcloud Talk application * - * @author Tim Krüger - * Copyright (C) 2021-2022 Tim Krüger + * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2021-2022 Tim Krüger * - * 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 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. + * 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 . + * 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.hovercard +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 com.nextcloud.talk.models.json.generic.GenericMeta +import kotlinx.android.parcel.Parcelize +@Parcelize @JsonObject data class HoverCardOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: HoverCard? -) : GenericOCS() { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/mention/MentionOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/mention/MentionOCS.kt index 9a6162034..fd82964c2 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/mention/MentionOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/mention/MentionOCS.kt @@ -3,6 +3,8 @@ * * @author Mario Danic * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger * Copyright (C) 2022 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * @@ -24,15 +26,17 @@ package com.nextcloud.talk.models.json.mention 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class MentionOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: List? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt index bcd9320a0..bf23947f6 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationOCS.kt @@ -25,8 +25,6 @@ import android.os.Parcelable import com.bluelinelabs.logansquare.annotation.JsonField import com.bluelinelabs.logansquare.annotation.JsonObject import com.nextcloud.talk.models.json.generic.GenericMeta -import com.nextcloud.talk.models.json.generic.GenericOCS -import com.nextcloud.talk.models.json.generic.IGenericOCS import kotlinx.android.parcel.Parcelize @Parcelize @@ -36,11 +34,7 @@ data class NotificationOCS( var meta: GenericMeta?, @JsonField(name = ["data"]) var notification: Notification? -) : IGenericOCS, Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' constructor() : this(null, null) - - override fun getGenericMeta(): GenericMeta? { - return meta - } } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationsOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationsOCS.kt index ad01a610f..f4e5a451d 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationsOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/notifications/NotificationsOCS.kt @@ -3,6 +3,8 @@ * * @author Mario Danic * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger * Copyright (C) 2022 Tim Krüger * Copyright (C) 2017-2018 Mario Danic * @@ -24,15 +26,17 @@ package com.nextcloud.talk.models.json.notifications 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject class NotificationsOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var notificationsList: List? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } 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 index 85e8c0fc2..ec17284c9 100644 --- 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 @@ -24,15 +24,17 @@ 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class PushRegistrationOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: PushRegistration? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/reactions/ReactionsOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/reactions/ReactionsOCS.kt index 6a251584d..cc0318f54 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/reactions/ReactionsOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/reactions/ReactionsOCS.kt @@ -1,37 +1,41 @@ /* - * Nextcloud Talk application + * Nextcloud Talk application * - * @author Marcel Hibbe - * Copyright (C) 2022 Marcel Hibbe + * @author Marcel Hibbe + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2022 Marcel Hibbe * - * 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 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. + * 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 . + * 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.reactions 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize import java.util.HashMap @Parcelize @JsonObject data class ReactionsOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: HashMap>? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(HashMap()) + constructor() : this(null, HashMap()) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/search/ContactsByNumberOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/search/ContactsByNumberOCS.kt index f2f4017c2..d42dd2bd3 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/search/ContactsByNumberOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/search/ContactsByNumberOCS.kt @@ -22,18 +22,20 @@ package com.nextcloud.talk.models.json.search import android.os.Parcelable -import com.nextcloud.talk.models.json.generic.GenericOCS import com.bluelinelabs.logansquare.annotation.JsonField import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.generic.GenericMeta import java.util.HashMap import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class ContactsByNumberOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var map: Map = HashMap() -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(HashMap()) + constructor() : this(null, HashMap()) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/status/StatusOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/status/StatusOCS.kt index f35bfeb45..4d982fba3 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/status/StatusOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/status/StatusOCS.kt @@ -1,38 +1,40 @@ /* - * Nextcloud Talk application + * Nextcloud Talk application * - * @author Tim Krüger - * @author Andy Scherzinger - * Copyright (C) 2022 Andy Scherzinger - * Copyright (C) 2021 Tim Krüger + * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2021 Tim Krüger * - * 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 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. + * 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 . + * 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.status 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class StatusOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: Status? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/status/predefined/PredefinedStatusOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/status/predefined/PredefinedStatusOCS.kt index 2f2b6682b..526890a4f 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/status/predefined/PredefinedStatusOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/status/predefined/PredefinedStatusOCS.kt @@ -2,6 +2,8 @@ * Nextcloud Talk application * * @author Marcel Hibbe + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger * Copyright (C) 2022 Marcel Hibbe (dev@mhibbe.de) * * This program is free software: you can redistribute it and/or modify @@ -23,15 +25,17 @@ package com.nextcloud.talk.models.json.status.predefined 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class PredefinedStatusOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: List? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOCS.kt index 2764d1665..95937fff4 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOCS.kt @@ -1,39 +1,41 @@ /* - * Nextcloud Talk application + * Nextcloud Talk application * - * @author Tim Krüger - * @author Andy Scherzinger - * Copyright (C) 2022 Andy Scherzinger - * Copyright (C) 2021 Tim Krüger + * @author Tim Krüger + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * Copyright (C) 2021 Tim Krüger * - * 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 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. + * 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 . + * 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.statuses 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 com.nextcloud.talk.models.json.generic.GenericMeta import com.nextcloud.talk.models.json.status.Status import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class StatusesOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: List? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.kt index 9146f72f4..3dcab0e67 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.kt @@ -24,16 +24,18 @@ package com.nextcloud.talk.models.json.userprofile 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize import java.util.ArrayList @Parcelize @JsonObject data class UserProfileFieldsOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: ArrayList? = null -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } diff --git a/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.kt index 074c4eb77..dc74e7400 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.kt +++ b/app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.kt @@ -1,38 +1,40 @@ /* - * Nextcloud Talk application + * Nextcloud Talk application * - * @author Mario Danic - * @author Andy Scherzinger - * Copyright (C) 2022 Andy Scherzinger - * Copyright (C) 2017 Mario Danic (mario@lovelyhq.com) + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 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. + * 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 . + * 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.userprofile 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 com.nextcloud.talk.models.json.generic.GenericMeta import kotlinx.android.parcel.Parcelize @Parcelize @JsonObject data class UserProfileOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, @JsonField(name = ["data"]) var data: UserProfileData? -) : GenericOCS(), Parcelable { +) : Parcelable { // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' - constructor() : this(null) + constructor() : this(null, null) } From 199107857fae9ee1c48edc82cb7e200ffcf93b4c Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 14 May 2022 15:48:35 +0200 Subject: [PATCH 4/6] mark GenericOCS as deprecated Signed-off-by: Andy Scherzinger --- .../com/nextcloud/talk/models/json/generic/GenericOCS.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java index c17a7a3ad..ea55f20d5 100644 --- a/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java +++ b/app/src/main/java/com/nextcloud/talk/models/json/generic/GenericOCS.java @@ -25,8 +25,13 @@ import com.bluelinelabs.logansquare.annotation.JsonObject; import org.parceler.Parcel; +/** + * Legacy class for the remaining java parceler classes + * that haven't yet been migrated to kotlin data classes + */ @Parcel @JsonObject +@Deprecated public class GenericOCS { @JsonField(name = "meta") public GenericMeta meta; From de542099dc0515a1a33052b20c7af4fcc8638a98 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sat, 14 May 2022 16:01:46 +0200 Subject: [PATCH 5/6] migrate sharee classes to kotlin data classes Signed-off-by: Andy Scherzinger --- .../models/json/sharees/ExactSharees.java | 76 ------------ .../talk/models/json/sharees/ExactSharees.kt | 37 ++++++ .../talk/models/json/sharees/Sharee.java | 110 ------------------ .../talk/models/json/sharees/Sharee.kt | 41 +++++++ .../talk/models/json/sharees/ShareesOCS.java | 75 ------------ .../talk/models/json/sharees/ShareesOCS.kt | 40 +++++++ .../models/json/sharees/ShareesOverall.java | 74 ------------ .../models/json/sharees/ShareesOverall.kt | 37 ++++++ .../talk/models/json/sharees/SharesData.java | 94 --------------- .../talk/models/json/sharees/SharesData.kt | 39 +++++++ .../talk/models/json/sharees/Value.java | 74 ------------ .../talk/models/json/sharees/Value.kt | 37 ++++++ 12 files changed, 231 insertions(+), 503 deletions(-) delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.kt delete mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.java create mode 100644 app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.kt diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.java b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.java deleted file mode 100644 index 47777628a..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.java +++ /dev/null @@ -1,76 +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 . - */ -package com.nextcloud.talk.models.json.sharees; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.List; - -@Parcel -@JsonObject -public class ExactSharees { - @JsonField(name = "users") - List exactSharees; - - public List getExactSharees() { - return this.exactSharees; - } - - public void setExactSharees(List exactSharees) { - this.exactSharees = exactSharees; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ExactSharees)) { - return false; - } - final ExactSharees other = (ExactSharees) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$exactSharees = this.getExactSharees(); - final Object other$exactSharees = other.getExactSharees(); - - return this$exactSharees == null ? other$exactSharees == null : this$exactSharees.equals(other$exactSharees); - } - - protected boolean canEqual(final Object other) { - return other instanceof ExactSharees; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $exactSharees = this.getExactSharees(); - result = result * PRIME + ($exactSharees == null ? 43 : $exactSharees.hashCode()); - return result; - } - - public String toString() { - return "ExactSharees(exactSharees=" + this.getExactSharees() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.kt b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.kt new file mode 100644 index 000000000..9c98a64a9 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ExactSharees.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.sharees + +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 ExactSharees( + @JsonField(name = ["users"]) + var exactSharees: List? = null +) : 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/sharees/Sharee.java b/app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.java deleted file mode 100644 index 9a9385a41..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.java +++ /dev/null @@ -1,110 +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 . - */ -package com.nextcloud.talk.models.json.sharees; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class Sharee { - @JsonField(name = "id") - String id; - - @JsonField(name = "value") - Value value; - - @JsonField(name = "label") - String label; - - public String getId() { - return this.id; - } - - public Value getValue() { - return this.value; - } - - public String getLabel() { - return this.label; - } - - public void setId(String id) { - this.id = id; - } - - public void setValue(Value value) { - this.value = value; - } - - public void setLabel(String label) { - this.label = label; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof Sharee)) { - return false; - } - final Sharee other = (Sharee) o; - if (!other.canEqual((Object) this)) { - 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$value = this.getValue(); - final Object other$value = other.getValue(); - if (this$value == null ? other$value != null : !this$value.equals(other$value)) { - return false; - } - final Object this$label = this.getLabel(); - final Object other$label = other.getLabel(); - - return this$label == null ? other$label == null : this$label.equals(other$label); - } - - protected boolean canEqual(final Object other) { - return other instanceof Sharee; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $id = this.getId(); - result = result * PRIME + ($id == null ? 43 : $id.hashCode()); - final Object $value = this.getValue(); - result = result * PRIME + ($value == null ? 43 : $value.hashCode()); - final Object $label = this.getLabel(); - result = result * PRIME + ($label == null ? 43 : $label.hashCode()); - return result; - } - - public String toString() { - return "Sharee(id=" + this.getId() + ", value=" + this.getValue() + ", label=" + this.getLabel() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.kt b/app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.kt new file mode 100644 index 000000000..a7259ae23 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/sharees/Sharee.kt @@ -0,0 +1,41 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.sharees + +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 Sharee( + @JsonField(name = ["id"]) + var id: String? = null, + @JsonField(name = ["value"]) + var value: Value? = null, + @JsonField(name = ["label"]) + var label: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.java b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.java deleted file mode 100644 index 3246ae4d4..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.java +++ /dev/null @@ -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 . - */ -package com.nextcloud.talk.models.json.sharees; - -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 ShareesOCS extends GenericOCS { - @JsonField(name = "data") - SharesData data; - - public SharesData getData() { - return this.data; - } - - public void setData(SharesData data) { - this.data = data; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ShareesOCS)) { - return false; - } - final ShareesOCS other = (ShareesOCS) 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 ShareesOCS; - } - - 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 "ShareesOCS(data=" + this.getData() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.kt b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.kt new file mode 100644 index 000000000..e8847d440 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOCS.kt @@ -0,0 +1,40 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.sharees + +import android.os.Parcelable +import com.bluelinelabs.logansquare.annotation.JsonField +import com.bluelinelabs.logansquare.annotation.JsonObject +import com.nextcloud.talk.models.json.generic.GenericMeta +import kotlinx.android.parcel.Parcelize + +@Parcelize +@JsonObject +data class ShareesOCS( + @JsonField(name = ["meta"]) + var meta: GenericMeta?, + @JsonField(name = ["data"]) + var data: SharesData? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.java b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.java deleted file mode 100644 index 2047b3842..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.java +++ /dev/null @@ -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 . - */ -package com.nextcloud.talk.models.json.sharees; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class ShareesOverall { - @JsonField(name = "ocs") - ShareesOCS ocs; - - public ShareesOCS getOcs() { - return this.ocs; - } - - public void setOcs(ShareesOCS ocs) { - this.ocs = ocs; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof ShareesOverall)) { - return false; - } - final ShareesOverall other = (ShareesOverall) 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 ShareesOverall; - } - - 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 "ShareesOverall(ocs=" + this.getOcs() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.kt b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.kt new file mode 100644 index 000000000..b6d6c35cb --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/sharees/ShareesOverall.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.sharees + +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 ShareesOverall( + @JsonField(name = ["ocs"]) + var ocs: ShareesOCS? = null +) : 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/sharees/SharesData.java b/app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.java deleted file mode 100644 index f4eb8611f..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.java +++ /dev/null @@ -1,94 +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 . - */ -package com.nextcloud.talk.models.json.sharees; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -import java.util.List; - -@Parcel -@JsonObject -public class SharesData { - @JsonField(name = "users") - List users; - - @JsonField(name = "exact") - ExactSharees exactUsers; - - public List getUsers() { - return this.users; - } - - public ExactSharees getExactUsers() { - return this.exactUsers; - } - - public void setUsers(List users) { - this.users = users; - } - - public void setExactUsers(ExactSharees exactUsers) { - this.exactUsers = exactUsers; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof SharesData)) { - return false; - } - final SharesData other = (SharesData) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$users = this.getUsers(); - final Object other$users = other.getUsers(); - if (this$users == null ? other$users != null : !this$users.equals(other$users)) { - return false; - } - final Object this$exactUsers = this.getExactUsers(); - final Object other$exactUsers = other.getExactUsers(); - - return this$exactUsers == null ? other$exactUsers == null : this$exactUsers.equals(other$exactUsers); - } - - protected boolean canEqual(final Object other) { - return other instanceof SharesData; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $users = this.getUsers(); - result = result * PRIME + ($users == null ? 43 : $users.hashCode()); - final Object $exactUsers = this.getExactUsers(); - result = result * PRIME + ($exactUsers == null ? 43 : $exactUsers.hashCode()); - return result; - } - - public String toString() { - return "SharesData(users=" + this.getUsers() + ", exactUsers=" + this.getExactUsers() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.kt b/app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.kt new file mode 100644 index 000000000..63e8608d3 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/sharees/SharesData.kt @@ -0,0 +1,39 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.sharees + +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 SharesData( + @JsonField(name = ["users"]) + var users: List? = null, + @JsonField(name = ["exact"]) + var exactUsers: ExactSharees? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null, null) +} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.java b/app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.java deleted file mode 100644 index 525621416..000000000 --- a/app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.java +++ /dev/null @@ -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 . - */ -package com.nextcloud.talk.models.json.sharees; - -import com.bluelinelabs.logansquare.annotation.JsonField; -import com.bluelinelabs.logansquare.annotation.JsonObject; - -import org.parceler.Parcel; - -@Parcel -@JsonObject -public class Value { - @JsonField(name = "shareWith") - String shareWith; - - public String getShareWith() { - return this.shareWith; - } - - public void setShareWith(String shareWith) { - this.shareWith = shareWith; - } - - public boolean equals(final Object o) { - if (o == this) { - return true; - } - if (!(o instanceof Value)) { - return false; - } - final Value other = (Value) o; - if (!other.canEqual((Object) this)) { - return false; - } - final Object this$shareWith = this.getShareWith(); - final Object other$shareWith = other.getShareWith(); - - return this$shareWith == null ? other$shareWith == null : this$shareWith.equals(other$shareWith); - } - - protected boolean canEqual(final Object other) { - return other instanceof Value; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - final Object $shareWith = this.getShareWith(); - result = result * PRIME + ($shareWith == null ? 43 : $shareWith.hashCode()); - return result; - } - - public String toString() { - return "Value(shareWith=" + this.getShareWith() + ")"; - } -} diff --git a/app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.kt b/app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.kt new file mode 100644 index 000000000..c040dfb9f --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/models/json/sharees/Value.kt @@ -0,0 +1,37 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * @author Andy Scherzinger + * Copyright (C) 2022 Andy Scherzinger + * 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 . + */ +package com.nextcloud.talk.models.json.sharees + +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 Value( + @JsonField(name = ["shareWith"]) + var shareWith: String? = null +) : Parcelable { + // This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject' + constructor() : this(null) +} From 6d2fff8f6872608e4661f7fa4617f036dc3f0480 Mon Sep 17 00:00:00 2001 From: drone Date: Sat, 14 May 2022 14:07:25 +0000 Subject: [PATCH 6/6] Drone: update FindBugs results to reflect reduced error/warning count [skip ci] Signed-off-by: drone --- scripts/analysis/findbugs-results.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/analysis/findbugs-results.txt b/scripts/analysis/findbugs-results.txt index 25493604e..e8930b6df 100644 --- a/scripts/analysis/findbugs-results.txt +++ b/scripts/analysis/findbugs-results.txt @@ -1 +1 @@ -395 \ No newline at end of file +364 \ No newline at end of file