Migrate search models to kotlin

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2022-03-24 18:33:13 +01:00 committed by Tim Krüger
parent 3935ce7955
commit 2884c6e01c
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E
5 changed files with 77 additions and 153 deletions

View File

@ -143,7 +143,7 @@ class ContactAddressBookWorker(val context: Context, workerParameters: WorkerPar
}
override fun onNext(foundContacts: ContactsByNumberOverall) {
val contactsWithAssociatedPhoneNumbers = foundContacts.ocs.map
val contactsWithAssociatedPhoneNumbers = foundContacts.ocs!!.map
deleteLinkedAccounts(contactsWithAssociatedPhoneNumbers)
createLinkedAccounts(contactsWithAssociatedPhoneNumbers)
}

View File

@ -1,78 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky <tobias.kaminsky@nextcloud.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.search;
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.Map;
@Parcel
@JsonObject
public class ContactsByNumberOCS extends GenericOCS {
@JsonField(name = "data")
public Map<String, String> map = new HashMap();
public Map<String, String> getMap() {
return this.map;
}
public void setMap(Map<String, String> map) {
this.map = map;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ContactsByNumberOCS)) {
return false;
}
final ContactsByNumberOCS other = (ContactsByNumberOCS) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$map = this.getMap();
final Object other$map = other.getMap();
return this$map == null ? other$map == null : this$map.equals(other$map);
}
protected boolean canEqual(final Object other) {
return other instanceof ContactsByNumberOCS;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $map = this.getMap();
result = result * PRIME + ($map == null ? 43 : $map.hashCode());
return result;
}
public String toString() {
return "ContactsByNumberOCS(map=" + this.getMap() + ")";
}
}

View File

@ -0,0 +1,39 @@
/*
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2020 Tobias Kaminsky <tobias.kaminsky@nextcloud.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.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 java.util.HashMap
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class ContactsByNumberOCS(
@JsonField(name = ["data"])
var map: Map<String, String> = HashMap()
) : GenericOCS(), Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(HashMap())
}

View File

@ -1,74 +0,0 @@
/*
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* Copyright (C) 2020 Tobias Kaminsky <tobias.kaminsky@nextcloud.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.search;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class ContactsByNumberOverall {
@JsonField(name = "ocs")
public ContactsByNumberOCS ocs;
public ContactsByNumberOCS getOcs() {
return this.ocs;
}
public void setOcs(ContactsByNumberOCS ocs) {
this.ocs = ocs;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ContactsByNumberOverall)) {
return false;
}
final ContactsByNumberOverall other = (ContactsByNumberOverall) 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 ContactsByNumberOverall;
}
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 "ContactsByNumberOverall(ocs=" + this.getOcs() + ")";
}
}

View File

@ -0,0 +1,37 @@
/*
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2020 Tobias Kaminsky <tobias.kaminsky@nextcloud.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.search
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 ContactsByNumberOverall(
@JsonField(name = ["ocs"])
var ocs: ContactsByNumberOCS?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null)
}