Exemple #1
0
 internal override Task <ParseObject> FetchAsyncInternal(Task toAwait, CancellationToken cancellationToken)
 {
     return(base.FetchAsyncInternal(toAwait, cancellationToken).OnSuccess(t => {
         if (!CurrentUserController.IsCurrent(this))
         {
             return Task <ParseObject> .FromResult(t.Result);
         }
         // If this is already the current user, refresh its state on disk.
         return SaveCurrentUserAsync(this).OnSuccess(_ => t.Result);
     }).Unwrap());
 }
Exemple #2
0
 internal override Task SaveAsync(Task toAwait, CancellationToken cancellationToken)
 {
     lock (mutex) {
         if (ObjectId == null)
         {
             throw new InvalidOperationException("You must call SignUpAsync before calling SaveAsync.");
         }
         return(base.SaveAsync(toAwait, cancellationToken).OnSuccess(_ => {
             if (!CurrentUserController.IsCurrent(this))
             {
                 return Task.FromResult(0);
             }
             return SaveCurrentUserAsync(this);
         }).Unwrap());
     }
 }
Exemple #3
0
        /// <summary>
        /// Removes null values from authData (which exist temporarily for unlinking)
        /// </summary>
        private void CleanupAuthData()
        {
            lock (mutex) {
                if (!CurrentUserController.IsCurrent(this))
                {
                    return;
                }
                var authData = AuthData;

                if (authData == null)
                {
                    return;
                }

                foreach (var pair in new Dictionary <string, IDictionary <string, object> >(authData))
                {
                    if (pair.Value == null)
                    {
                        authData.Remove(pair.Key);
                    }
                }
            }
        }