Browse Source

migrate userprofile to kotlin and align icon work with latest server

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 3 years ago
parent
commit
9a2a3f3b6d
18 changed files with 333 additions and 690 deletions
  1. 5 5
      app/src/main/java/com/nextcloud/talk/controllers/AccountVerificationController.kt
  2. 17 16
      app/src/main/java/com/nextcloud/talk/controllers/ProfileController.kt
  3. 1 1
      app/src/main/java/com/nextcloud/talk/models/json/converters/ScopeConverter.java
  4. 0 1
      app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOverall.kt
  5. 5 14
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/Scope.kt
  6. 0 348
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileData.java
  7. 102 0
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileData.kt
  8. 0 80
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.java
  9. 39 0
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.kt
  10. 0 74
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOverall.java
  11. 37 0
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOverall.kt
  12. 0 75
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.java
  13. 38 0
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.kt
  14. 0 74
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOverall.java
  15. 37 0
      app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOverall.kt
  16. 25 0
      app/src/main/res/drawable-night/ic_cellphone.xml
  17. 25 0
      app/src/main/res/drawable/ic_cellphone.xml
  18. 2 2
      app/src/main/res/layout/dialog_scope.xml

+ 5 - 5
app/src/main/java/com/nextcloud/talk/controllers/AccountVerificationController.kt

@@ -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 {

+ 17 - 16
app/src/main/java/com/nextcloud/talk/controllers/ProfileController.kt

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

+ 1 - 1
app/src/main/java/com/nextcloud/talk/models/json/converters/ScopeConverter.java

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

+ 0 - 1
app/src/main/java/com/nextcloud/talk/models/json/statuses/StatusesOverall.kt

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

+ 5 - 14
app/src/main/java/com/nextcloud/talk/models/json/userprofile/Scope.java → app/src/main/java/com/nextcloud/talk/models/json/userprofile/Scope.kt

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

+ 0 - 348
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileData.java

@@ -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() + ")";
-    }
-}

+ 102 - 0
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileData.kt

@@ -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
+        }
+    }
+}

+ 0 - 80
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.java

@@ -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;
-    }
-}

+ 39 - 0
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOCS.kt

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

+ 0 - 74
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileFieldsOverall.java

@@ -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() + ")";
-    }
-}

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

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

+ 0 - 75
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOCS.java

@@ -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() + ")";
-    }
-}

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

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

+ 0 - 74
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOverall.java

@@ -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() + ")";
-    }
-}

+ 37 - 0
app/src/main/java/com/nextcloud/talk/models/json/userprofile/UserProfileOverall.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 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)
+}

+ 25 - 0
app/src/main/res/drawable-night/ic_cellphone.xml

@@ -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>

+ 25 - 0
app/src/main/res/drawable/ic_cellphone.xml

@@ -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>

+ 2 - 2
app/src/main/res/layout/dialog_scope.xml

@@ -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"