Merge pull request #1884 from nextcloud/bugfix/noid/kotlinConversion4

Migrate userprofile/search to kotlin and align icon work with latest server
This commit is contained in:
Tim Krueger 2022-03-29 18:07:20 +02:00 committed by GitHub
commit 231c19108a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 411 additions and 902 deletions

View File

@ -307,13 +307,13 @@ class AccountVerificationController(args: Bundle? = null) :
@SuppressLint("SetTextI18n")
override fun onNext(userProfileOverall: UserProfileOverall) {
var displayName: String? = null
if (!TextUtils.isEmpty(userProfileOverall.ocs.data.displayName)) {
displayName = userProfileOverall.ocs.data.displayName
} else if (!TextUtils.isEmpty(userProfileOverall.ocs.data.displayNameAlt)) {
displayName = userProfileOverall.ocs.data.displayNameAlt
if (!TextUtils.isEmpty(userProfileOverall.ocs!!.data!!.displayName)) {
displayName = userProfileOverall.ocs!!.data!!.displayName
} else if (!TextUtils.isEmpty(userProfileOverall.ocs!!.data!!.displayNameAlt)) {
displayName = userProfileOverall.ocs!!.data!!.displayNameAlt
}
if (!TextUtils.isEmpty(displayName)) {
storeProfile(displayName, userProfileOverall.ocs.data.userId)
storeProfile(displayName, userProfileOverall.ocs!!.data!!.userId!!)
} else {
if (activity != null) {
activity!!.runOnUiThread {

View File

@ -165,7 +165,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
}
override fun onNext(userProfileFieldsOverall: UserProfileFieldsOverall) {
editableFields = userProfileFieldsOverall.ocs.data
editableFields = userProfileFieldsOverall.ocs!!.data!!
adapter!!.notifyDataSetChanged()
}
@ -241,7 +241,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
}
override fun onNext(userProfileOverall: UserProfileOverall) {
userInfo = userProfileOverall.ocs.data
userInfo = userProfileOverall.ocs!!.data
showUserProfile()
}
@ -284,12 +284,12 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
adapter!!.setData(createUserInfoDetails(userInfo))
if (isAllEmpty(
arrayOf(
userInfo!!.displayName,
userInfo!!.phone,
userInfo!!.email,
userInfo!!.address,
userInfo!!.twitter,
userInfo!!.website
userInfo!!.displayName!!,
userInfo!!.phone!!,
userInfo!!.email!!,
userInfo!!.address!!,
userInfo!!.twitter!!,
userInfo!!.website!!
)
)
) {
@ -320,7 +320,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
}
override fun onNext(userProfileFieldsOverall: UserProfileFieldsOverall) {
editableFields = userProfileFieldsOverall.ocs.data
editableFields = userProfileFieldsOverall.ocs!!.data!!
activity!!.invalidateOptionsMenu()
adapter!!.notifyDataSetChanged()
}
@ -355,7 +355,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
result.add(
UserInfoDetailsItem(
R.drawable.ic_user,
userInfo!!.displayName,
userInfo!!.displayName!!,
resources!!.getString(R.string.user_info_displayname),
Field.DISPLAYNAME,
userInfo.displayNameScope
@ -364,7 +364,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
result.add(
UserInfoDetailsItem(
R.drawable.ic_phone,
userInfo.phone,
userInfo.phone!!,
resources!!.getString(R.string.user_info_phone),
Field.PHONE,
userInfo.phoneScope
@ -373,7 +373,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
result.add(
UserInfoDetailsItem(
R.drawable.ic_email,
userInfo.email,
userInfo.email!!,
resources!!.getString(R.string.user_info_email),
Field.EMAIL,
userInfo.emailScope
@ -382,7 +382,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
result.add(
UserInfoDetailsItem(
R.drawable.ic_map_marker,
userInfo.address,
userInfo.address!!,
resources!!.getString(R.string.user_info_address),
Field.ADDRESS,
userInfo.addressScope
@ -436,7 +436,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
}
override fun onError(e: Throwable) {
item.text = userInfo!!.getValueByField(item.field)
item.text = userInfo!!.getValueByField(item.field)!!
Toast.makeText(
applicationContext,
String.format(
@ -595,7 +595,7 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
credentials,
ApiUtils.getUrlForUserData(currentUser!!.baseUrl, currentUser!!.userId),
item.field.scopeName,
item.scope!!.getName()
item.scope!!.name
)
.retry(DEFAULT_RETRIES)
.subscribeOn(Schedulers.io())
@ -755,7 +755,8 @@ class ProfileController : NewBaseController(R.layout.controller_profile) {
} else {
holder.binding.scope.visibility = View.VISIBLE
when (item.scope) {
Scope.PRIVATE, Scope.LOCAL -> holder.binding.scope.setImageResource(R.drawable.ic_password)
Scope.PRIVATE -> holder.binding.scope.setImageResource(R.drawable.ic_cellphone)
Scope.LOCAL -> holder.binding.scope.setImageResource(R.drawable.ic_password)
Scope.FEDERATED -> holder.binding.scope.setImageResource(R.drawable.ic_contacts)
Scope.PUBLISHED -> holder.binding.scope.setImageResource(R.drawable.ic_link)
}

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

@ -42,6 +42,6 @@ public class ScopeConverter extends StringBasedTypeConverter<Scope> {
@Override
public String convertToString(Scope scope) {
return scope.getName();
return scope.getId();
}
}

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)
}

View File

@ -1,5 +1,4 @@
/*
*
* Nextcloud Talk application
*
* @author Tim Krüger

View File

@ -2,6 +2,8 @@
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2021 Tobias Kaminsky <tobias.kaminsky@nextcloud.com>
*
* This program is free software: you can redistribute it and/or modify
@ -17,22 +19,11 @@
* 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.userprofile
package com.nextcloud.talk.models.json.userprofile;
public enum Scope {
enum class Scope(val id: String) {
PRIVATE("v2-private"),
LOCAL("v2-local"),
FEDERATED("v2-federated"),
PUBLISHED("v2-published");
private final String name;
Scope(String name) {
this.name = name;
}
public String getName() {
return name;
}
PUBLISHED("v2-published")
}

View File

@ -1,348 +0,0 @@
/*
*
* Nextcloud Talk application
*
* @author Mario Danic
* Copyright (C) 2017 Mario Danic (mario@lovelyhq.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.userprofile;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.controllers.ProfileController;
import com.nextcloud.talk.models.json.converters.ScopeConverter;
import org.parceler.Parcel;
@Parcel
@JsonObject()
public class UserProfileData {
@JsonField(name = "display-name")
String displayName;
@JsonField(name = "displaynameScope", typeConverter = ScopeConverter.class)
Scope displayNameScope;
@JsonField(name = "displayname")
String displayNameAlt;
@JsonField(name = "id")
String userId;
@JsonField(name = "phone")
String phone;
@JsonField(name = "phoneScope", typeConverter = ScopeConverter.class)
Scope phoneScope;
@JsonField(name = "email")
String email;
@JsonField(name = "emailScope", typeConverter = ScopeConverter.class)
Scope emailScope;
@JsonField(name = "address")
String address;
@JsonField(name = "addressScope", typeConverter = ScopeConverter.class)
Scope addressScope;
@JsonField(name = "twitter")
String twitter;
@JsonField(name = "twitterScope", typeConverter = ScopeConverter.class)
Scope twitterScope;
@JsonField(name = "website")
String website;
@JsonField(name = "websiteScope", typeConverter = ScopeConverter.class)
Scope websiteScope;
public String getValueByField(ProfileController.Field field) {
switch (field) {
case EMAIL:
return email;
case DISPLAYNAME:
return displayName;
case PHONE:
return phone;
case ADDRESS:
return address;
case WEBSITE:
return website;
case TWITTER:
return twitter;
default:
return "";
}
}
public Scope getScopeByField(ProfileController.Field field) {
switch (field) {
case EMAIL:
return emailScope;
case DISPLAYNAME:
return displayNameScope;
case PHONE:
return phoneScope;
case ADDRESS:
return addressScope;
case WEBSITE:
return websiteScope;
case TWITTER:
return twitterScope;
default:
return null;
}
}
public String getDisplayName() {
return this.displayName;
}
public Scope getDisplayNameScope() {
return this.displayNameScope;
}
public String getDisplayNameAlt() {
return this.displayNameAlt;
}
public String getUserId() {
return this.userId;
}
public String getPhone() {
return this.phone;
}
public Scope getPhoneScope() {
return this.phoneScope;
}
public String getEmail() {
return this.email;
}
public Scope getEmailScope() {
return this.emailScope;
}
public String getAddress() {
return this.address;
}
public Scope getAddressScope() {
return this.addressScope;
}
public String getTwitter() {
return this.twitter;
}
public Scope getTwitterScope() {
return this.twitterScope;
}
public String getWebsite() {
return this.website;
}
public Scope getWebsiteScope() {
return this.websiteScope;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public void setDisplayNameScope(Scope displayNameScope) {
this.displayNameScope = displayNameScope;
}
public void setDisplayNameAlt(String displayNameAlt) {
this.displayNameAlt = displayNameAlt;
}
public void setUserId(String userId) {
this.userId = userId;
}
public void setPhone(String phone) {
this.phone = phone;
}
public void setPhoneScope(Scope phoneScope) {
this.phoneScope = phoneScope;
}
public void setEmail(String email) {
this.email = email;
}
public void setEmailScope(Scope emailScope) {
this.emailScope = emailScope;
}
public void setAddress(String address) {
this.address = address;
}
public void setAddressScope(Scope addressScope) {
this.addressScope = addressScope;
}
public void setTwitter(String twitter) {
this.twitter = twitter;
}
public void setTwitterScope(Scope twitterScope) {
this.twitterScope = twitterScope;
}
public void setWebsite(String website) {
this.website = website;
}
public void setWebsiteScope(Scope websiteScope) {
this.websiteScope = websiteScope;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof UserProfileData)) {
return false;
}
final UserProfileData other = (UserProfileData) o;
if (!other.canEqual((Object) this)) {
return false;
}
final Object this$displayName = this.getDisplayName();
final Object other$displayName = other.getDisplayName();
if (this$displayName == null ? other$displayName != null : !this$displayName.equals(other$displayName)) {
return false;
}
final Object this$displayNameScope = this.getDisplayNameScope();
final Object other$displayNameScope = other.getDisplayNameScope();
if (this$displayNameScope == null ? other$displayNameScope != null : !this$displayNameScope.equals(other$displayNameScope)) {
return false;
}
final Object this$displayNameAlt = this.getDisplayNameAlt();
final Object other$displayNameAlt = other.getDisplayNameAlt();
if (this$displayNameAlt == null ? other$displayNameAlt != null : !this$displayNameAlt.equals(other$displayNameAlt)) {
return false;
}
final Object this$userId = this.getUserId();
final Object other$userId = other.getUserId();
if (this$userId == null ? other$userId != null : !this$userId.equals(other$userId)) {
return false;
}
final Object this$phone = this.getPhone();
final Object other$phone = other.getPhone();
if (this$phone == null ? other$phone != null : !this$phone.equals(other$phone)) {
return false;
}
final Object this$phoneScope = this.getPhoneScope();
final Object other$phoneScope = other.getPhoneScope();
if (this$phoneScope == null ? other$phoneScope != null : !this$phoneScope.equals(other$phoneScope)) {
return false;
}
final Object this$email = this.getEmail();
final Object other$email = other.getEmail();
if (this$email == null ? other$email != null : !this$email.equals(other$email)) {
return false;
}
final Object this$emailScope = this.getEmailScope();
final Object other$emailScope = other.getEmailScope();
if (this$emailScope == null ? other$emailScope != null : !this$emailScope.equals(other$emailScope)) {
return false;
}
final Object this$address = this.getAddress();
final Object other$address = other.getAddress();
if (this$address == null ? other$address != null : !this$address.equals(other$address)) {
return false;
}
final Object this$addressScope = this.getAddressScope();
final Object other$addressScope = other.getAddressScope();
if (this$addressScope == null ? other$addressScope != null : !this$addressScope.equals(other$addressScope)) {
return false;
}
final Object this$twitter = this.getTwitter();
final Object other$twitter = other.getTwitter();
if (this$twitter == null ? other$twitter != null : !this$twitter.equals(other$twitter)) {
return false;
}
final Object this$twitterScope = this.getTwitterScope();
final Object other$twitterScope = other.getTwitterScope();
if (this$twitterScope == null ? other$twitterScope != null : !this$twitterScope.equals(other$twitterScope)) {
return false;
}
final Object this$website = this.getWebsite();
final Object other$website = other.getWebsite();
if (this$website == null ? other$website != null : !this$website.equals(other$website)) {
return false;
}
final Object this$websiteScope = this.getWebsiteScope();
final Object other$websiteScope = other.getWebsiteScope();
return this$websiteScope == null ? other$websiteScope == null : this$websiteScope.equals(other$websiteScope);
}
protected boolean canEqual(final Object other) {
return other instanceof UserProfileData;
}
public int hashCode() {
final int PRIME = 59;
int result = 1;
final Object $displayName = this.getDisplayName();
result = result * PRIME + ($displayName == null ? 43 : $displayName.hashCode());
final Object $displayNameScope = this.getDisplayNameScope();
result = result * PRIME + ($displayNameScope == null ? 43 : $displayNameScope.hashCode());
final Object $displayNameAlt = this.getDisplayNameAlt();
result = result * PRIME + ($displayNameAlt == null ? 43 : $displayNameAlt.hashCode());
final Object $userId = this.getUserId();
result = result * PRIME + ($userId == null ? 43 : $userId.hashCode());
final Object $phone = this.getPhone();
result = result * PRIME + ($phone == null ? 43 : $phone.hashCode());
final Object $phoneScope = this.getPhoneScope();
result = result * PRIME + ($phoneScope == null ? 43 : $phoneScope.hashCode());
final Object $email = this.getEmail();
result = result * PRIME + ($email == null ? 43 : $email.hashCode());
final Object $emailScope = this.getEmailScope();
result = result * PRIME + ($emailScope == null ? 43 : $emailScope.hashCode());
final Object $address = this.getAddress();
result = result * PRIME + ($address == null ? 43 : $address.hashCode());
final Object $addressScope = this.getAddressScope();
result = result * PRIME + ($addressScope == null ? 43 : $addressScope.hashCode());
final Object $twitter = this.getTwitter();
result = result * PRIME + ($twitter == null ? 43 : $twitter.hashCode());
final Object $twitterScope = this.getTwitterScope();
result = result * PRIME + ($twitterScope == null ? 43 : $twitterScope.hashCode());
final Object $website = this.getWebsite();
result = result * PRIME + ($website == null ? 43 : $website.hashCode());
final Object $websiteScope = this.getWebsiteScope();
result = result * PRIME + ($websiteScope == null ? 43 : $websiteScope.hashCode());
return result;
}
public String toString() {
return "UserProfileData(displayName=" + this.getDisplayName() + ", displayNameScope=" + this.getDisplayNameScope() + ", displayNameAlt=" + this.getDisplayNameAlt() + ", userId=" + this.getUserId() + ", phone=" + this.getPhone() + ", phoneScope=" + this.getPhoneScope() + ", email=" + this.getEmail() + ", emailScope=" + this.getEmailScope() + ", address=" + this.getAddress() + ", addressScope=" + this.getAddressScope() + ", twitter=" + this.getTwitter() + ", twitterScope=" + this.getTwitterScope() + ", website=" + this.getWebsite() + ", websiteScope=" + this.getWebsiteScope() + ")";
}
}

View File

@ -0,0 +1,102 @@
/*
* Nextcloud Talk application
*
* @author Mario Danic
* @author Andy Scherzinger
* Copyright (C) 2022 Andy Scherzinger <info@andy-scherzinger.de>
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.nextcloud.talk.models.json.userprofile
import com.bluelinelabs.logansquare.annotation.JsonField
import com.bluelinelabs.logansquare.annotation.JsonObject
import com.nextcloud.talk.controllers.ProfileController
import com.nextcloud.talk.models.json.converters.ScopeConverter
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
@Parcelize
@JsonObject
data class UserProfileData(
@JsonField(name = ["display-name"])
var displayName: String?,
@JsonField(name = ["displaynameScope"], typeConverter = ScopeConverter::class)
var displayNameScope: Scope?,
@JsonField(name = ["displayname"])
var displayNameAlt: String?,
@JsonField(name = ["id"])
var userId: String?,
@JsonField(name = ["phone"])
var phone: String?,
@JsonField(name = ["phoneScope"], typeConverter = ScopeConverter::class)
var phoneScope: Scope?,
@JsonField(name = ["email"])
var email: String?,
@JsonField(name = ["emailScope"], typeConverter = ScopeConverter::class)
var emailScope: Scope?,
@JsonField(name = ["address"])
var address: String?,
@JsonField(name = ["addressScope"], typeConverter = ScopeConverter::class)
var addressScope: Scope?,
@JsonField(name = ["twitter"])
var twitter: String?,
@JsonField(name = ["twitterScope"], typeConverter = ScopeConverter::class)
var twitterScope: Scope?,
@JsonField(name = ["website"])
var website: String?,
@JsonField(name = ["websiteScope"], typeConverter = ScopeConverter::class)
var websiteScope: Scope?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null, null, null, null, null, null, null, null, null, null, null, null, null, null)
fun getValueByField(field: ProfileController.Field?): String? {
return when (field) {
ProfileController.Field.EMAIL -> email
ProfileController.Field.DISPLAYNAME -> displayName
ProfileController.Field.PHONE -> phone
ProfileController.Field.ADDRESS -> address
ProfileController.Field.WEBSITE -> website
ProfileController.Field.TWITTER -> twitter
else -> ""
}
}
fun getScopeByField(field: ProfileController.Field?): Scope? {
return when (field) {
ProfileController.Field.EMAIL -> emailScope
ProfileController.Field.DISPLAYNAME -> displayNameScope
ProfileController.Field.PHONE -> phoneScope
ProfileController.Field.ADDRESS -> addressScope
ProfileController.Field.WEBSITE -> websiteScope
ProfileController.Field.TWITTER -> twitterScope
else -> null
}
}
}

View File

@ -1,80 +0,0 @@
/*
*
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* Copyright (C) 2021 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.userprofile;
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.ArrayList;
@Parcel
@JsonObject
public class UserProfileFieldsOCS extends GenericOCS {
@JsonField(name = "data")
ArrayList<String> data;
public ArrayList<String> getData() {
return this.data;
}
public void setData(ArrayList<String> data) {
this.data = data;
}
public String toString() {
return "UserProfileFieldsOCS(data=" + this.getData() + ")";
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof UserProfileFieldsOCS)) {
return false;
}
final UserProfileFieldsOCS other = (UserProfileFieldsOCS) o;
if (!other.canEqual((Object) this)) {
return false;
}
if (!super.equals(o)) {
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 UserProfileFieldsOCS;
}
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final Object $data = this.getData();
result = result * PRIME + ($data == null ? 43 : $data.hashCode());
return result;
}
}

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) 2021 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.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 kotlinx.android.parcel.Parcelize
import java.util.ArrayList
@Parcelize
@JsonObject
data class UserProfileFieldsOCS(
@JsonField(name = ["data"])
var data: ArrayList<String>? = null
) : GenericOCS(), Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null)
}

View File

@ -1,74 +0,0 @@
/*
*
* Nextcloud Talk application
*
* @author Tobias Kaminsky
* Copyright (C) 2021 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.userprofile;
import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject;
import org.parceler.Parcel;
@Parcel
@JsonObject
public class UserProfileFieldsOverall {
@JsonField(name = "ocs")
UserProfileFieldsOCS ocs;
public UserProfileFieldsOCS getOcs() {
return this.ocs;
}
public void setOcs(UserProfileFieldsOCS ocs) {
this.ocs = ocs;
}
public boolean equals(final Object o) {
if (o == this) {
return true;
}
if (!(o instanceof UserProfileFieldsOverall)) {
return false;
}
final UserProfileFieldsOverall other = (UserProfileFieldsOverall) 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 UserProfileFieldsOverall;
}
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 "UserProfileFieldsOverall(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) 2021 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.userprofile
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 UserProfileFieldsOverall(
@JsonField(name = ["ocs"])
var ocs: UserProfileFieldsOCS?
) : Parcelable {
// This constructor is added to work with the 'com.bluelinelabs.logansquare.annotation.JsonObject'
constructor() : this(null)
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,29 +0,0 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017 Mario Danic
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
</vector>

View File

@ -0,0 +1,25 @@
<!--
@author Google LLC
Copyright (C) 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M17,19H7V5H17M17,1H7C5.89,1 5,1.89 5,3V21A2,2 0 0,0 7,23H17A2,2 0 0,0 19,21V3C19,1.89 18.1,1 17,1Z" />
</vector>

View File

@ -1,29 +0,0 @@
<!--
~ Nextcloud Talk application
~
~ @author Mario Danic
~ Copyright (C) 2017 Mario Danic
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6.62,10.79c1.44,2.83 3.76,5.14 6.59,6.59l2.2,-2.2c0.27,-0.27 0.67,-0.36 1.02,-0.24 1.12,0.37 2.33,0.57 3.57,0.57 0.55,0 1,0.45 1,1V20c0,0.55 -0.45,1 -1,1 -9.39,0 -17,-7.61 -17,-17 0,-0.55 0.45,-1 1,-1h3.5c0.55,0 1,0.45 1,1 0,1.25 0.2,2.45 0.57,3.57 0.11,0.35 0.03,0.74 -0.25,1.02l-2.2,2.2z"/>
</vector>

View File

@ -0,0 +1,25 @@
<!--
@author Google LLC
Copyright (C) 2018 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M17,19H7V5H17M17,1H7C5.89,1 5,1.89 5,3V21A2,2 0 0,0 7,23H17A2,2 0 0,0 19,21V3C19,1.89 18.1,1 17,1Z" />
</vector>

View File

@ -40,11 +40,11 @@
android:paddingBottom="@dimen/standard_half_padding">
<ImageView
android:layout_width="24dp"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_gravity="top"
android:contentDescription="@string/lock_symbol"
app:srcCompat="@drawable/ic_call" />
app:srcCompat="@drawable/ic_cellphone" />
<LinearLayout
android:layout_width="match_parent"

View File

@ -1 +1 @@
431
413