public async Task UpdateProfileAsync(UserProfileChangeRequest request)
        {
            try
            {
                var userProfileChangeRequest = _user.ProfileChangeRequest();
                if (request.IsDisplayNameChanged)
                {
                    userProfileChangeRequest.DisplayName = request.DisplayName;
                }
                if (request.IsPhotoUrlChanged)
                {
                    userProfileChangeRequest.PhotoUrl = request.PhotoUrl != null ? new NSUrl(request.PhotoUrl.ToString()) : null;
                }

                await userProfileChangeRequest.CommitChangesAsync().ConfigureAwait(false);
            }
            catch (NSErrorException e)
            {
                throw ExceptionMapper.Map(e);
            }
        }
Esempio n. 2
0
        public async Task UpdateProfileAsync(UserProfileChangeRequest request)
        {
            try
            {
                var builder = new Firebase.Auth.UserProfileChangeRequest.Builder();

                if (request.IsDisplayNameChanged)
                {
                    builder.SetDisplayName(request.DisplayName);
                }
                if (request.IsPhotoUrlChanged)
                {
                    var uri = request.PhotoUrl != null?Android.Net.Uri.Parse(request.PhotoUrl.ToString()) : null;

                    builder.SetPhotoUri(uri);
                }

                await _user.UpdateProfileAsync(builder.Build()).ConfigureAwait(false);
            }
            catch (FirebaseException e)
            {
                throw ExceptionMapper.Map(e);
            }
        }