Browse Source

Migrate remaining chat models to kotlin data classes

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 3 years ago
parent
commit
d683cb109a
19 changed files with 256 additions and 473 deletions
  1. 1 1
      app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt
  2. 4 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.kt
  3. 2 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.kt
  4. 2 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.kt
  5. 0 74
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.java
  6. 37 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.kt
  7. 0 74
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.java
  8. 37 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.kt
  9. 0 76
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.java
  10. 38 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.kt
  11. 0 75
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.java
  12. 37 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.kt
  13. 0 78
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.java
  14. 41 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.kt
  15. 0 75
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.java
  16. 37 0
      app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.kt
  17. 2 3
      app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.kt
  18. 17 16
      app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt
  19. 1 1
      app/src/main/java/com/nextcloud/talk/viewmodels/SharedItemsViewModel.kt

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/ChatController.kt

@@ -2603,7 +2603,7 @@ class ChatController(args: Bundle) :
                     }
 
                     override fun onNext(t: ChatOverallSingleMessage) {
-                        if (t.ocs.meta!!.statusCode == HttpURLConnection.HTTP_ACCEPTED) {
+                        if (t.ocs!!.meta!!.statusCode == HttpURLConnection.HTTP_ACCEPTED) {
                             Toast.makeText(
                                 context, R.string.nc_delete_message_leaked_to_matterbridge,
                                 Toast.LENGTH_LONG

+ 4 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatMessage.kt

@@ -3,6 +3,10 @@
  *
  * @author Mario Danic
  * @author Tim Krüger
+ * @author Marcel Hibbe
+ * @author Andy Scherzinger
+ * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
+ * Copyright (C) 2022 Marcel Hibbe <dev@mhibbe.de>
  * Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
  * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  *

+ 2 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCS.kt

@@ -2,6 +2,8 @@
  * Nextcloud Talk application
  *
  * @author Mario Danic
+ * @author Andy Scherzinger
+ * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
  * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  *
  * This program is free software: you can redistribute it and/or modify

+ 2 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOCSSingleMessage.kt

@@ -2,6 +2,8 @@
  * Nextcloud Talk application
  *
  * @author Marcel Hibbe
+ * @author Andy Scherzinger
+ * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
  * Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
  *
  * This program is free software: you can redistribute it and/or modify

+ 0 - 74
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.java

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

+ 37 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverall.kt

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

+ 0 - 74
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.java

@@ -1,74 +0,0 @@
-/*
- * Nextcloud Talk application
- *
- * @author Marcel Hibbe
- * Copyright (C) 2021 Marcel Hibbe <dev@mhibbe.de>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.nextcloud.talk.models.json.chat;
-
-import com.bluelinelabs.logansquare.annotation.JsonField;
-import com.bluelinelabs.logansquare.annotation.JsonObject;
-
-import org.parceler.Parcel;
-
-@Parcel
-@JsonObject
-public class ChatOverallSingleMessage {
-    @JsonField(name = "ocs")
-    public ChatOCSSingleMessage ocs;
-
-    public ChatOCSSingleMessage getOcs() {
-        return this.ocs;
-    }
-
-    public void setOcs(ChatOCSSingleMessage ocs) {
-        this.ocs = ocs;
-    }
-
-    public boolean equals(final Object o) {
-        if (o == this) {
-            return true;
-        }
-        if (!(o instanceof ChatOverallSingleMessage)) {
-            return false;
-        }
-        final ChatOverallSingleMessage other = (ChatOverallSingleMessage) 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 ChatOverallSingleMessage;
-    }
-
-    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 "ChatOverallSingleMessage(ocs=" + this.getOcs() + ")";
-    }
-}

+ 37 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatOverallSingleMessage.kt

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

+ 0 - 76
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.java

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

+ 38 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOCS.kt

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

+ 0 - 75
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.java

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

+ 37 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverall.kt

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

+ 0 - 78
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.java

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

+ 41 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOCS.kt

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

+ 0 - 75
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.java

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

+ 37 - 0
app/src/main/java/com/nextcloud/talk/models/json/chat/ChatShareOverviewOverall.kt

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

+ 2 - 3
app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.java → app/src/main/java/com/nextcloud/talk/models/json/chat/ReadStatus.kt

@@ -17,9 +17,8 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+package com.nextcloud.talk.models.json.chat
 
-package com.nextcloud.talk.models.json.chat;
-
-public enum ReadStatus {
+enum class ReadStatus {
     NONE, SENT, READ
 }

+ 17 - 16
app/src/main/java/com/nextcloud/talk/models/json/conversations/Conversation.kt

@@ -1,24 +1,25 @@
 /*
+ * Nextcloud Talk application
  *
- *   Nextcloud Talk application
+ * @author Mario Danic
+ * @author Tim Krüger
+ * @author Andy Scherzinger
+ * Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
+ * Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
+ * Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
  *
- *   @author Mario Danic
- *   @author Tim Krüger
- *   Copyright (C) 2021 Tim Krüger <t@timkrueger.me>
- *   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 <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 package com.nextcloud.talk.models.json.conversations
 

+ 1 - 1
app/src/main/java/com/nextcloud/talk/viewmodels/SharedItemsViewModel.kt

@@ -140,7 +140,7 @@ class SharedItemsViewModel(private val repository: SharedItemsRepository, privat
                 override fun onSubscribe(d: Disposable) = Unit
 
                 override fun onNext(response: Response<ChatShareOverviewOverall>) {
-                    val typeMap = response.body()!!.ocs!!.data
+                    val typeMap = response.body()!!.ocs!!.data!!
                     for (it in typeMap) {
                         if (it.value.size > 0) {
                             try {