コード例 #1
0
ファイル: SessionData.cs プロジェクト: GSDan/Speeching_Client
        public SessionData()
        {
            CurrentUser = new User();
            Categories = new List<ActivityCategory>();
            ResultsToUpload = new List<IResultItem>();
            UserCache = new List<User>();

            PlacesPhotos = new Dictionary<string, string>();
        }
コード例 #2
0
        private void PrepUser(IPerson currentPerson)
        {
            string email = PlusClass.AccountApi.GetAccountName(apiClient);

            string token = GoogleAuthUtil.GetToken(this, email, "audience:server:client_id:" + ConfidentialData.GoogleOAuthWebAppId);

            User thisUser = new User
            {
                Name = currentPerson.DisplayName,
                IdToken = token,
                Email = email
            };

            thisUser.Nickname = (currentPerson.HasNickname) ? currentPerson.Nickname : thisUser.Name;
            thisUser.Avatar = (currentPerson.Image != null) ? currentPerson.Image.Url : null;
            thisUser.App = User.AppType.Fluent;

            SetupUserAccount(thisUser);
            needLogin = false;
        }
コード例 #3
0
ファイル: _AppData.cs プロジェクト: GSDan/Speeching_Client
        /// <summary>
        /// Makes the current user the owner of this session
        /// </summary>
        public static void AssignCurrentUser(User thisUser)
        {
            if (Session == null) Session = new SessionData();
            Session.CurrentUser = thisUser;
            ServerData.StorageRemoteDir = "uploads/" + thisUser.Key + "/";

            SaveCurrentData();
        }
コード例 #4
0
 public void LoadData(User user, Context context)
 {
     Username.Text = user.Name;
     LoadImageIntoCircle(user.Avatar, avatarView, context);
 }
コード例 #5
0
        /// <summary>
        /// Takes the account created from the Google login and sends it to the server for comparison.
        /// The returned User object contains a Key for authentication in future POST requests
        /// </summary>
        /// <param name="thisUser">The user created from 3rd party systems</param>
        private async void SetupUserAccount(User thisUser)
        {
            ProgressDialog dialog = null;

            RunOnUiThread(() =>
            {
                dialog = new ProgressDialog(this);
                dialog.SetTitle("Signing in...");
                dialog.SetMessage("Please wait...");
                dialog.SetCancelable(false);
                dialog.Show();
            });

            User serverUser = await ServerData.PostUserAccount(thisUser);
            RunOnUiThread(() => dialog.Hide());

            if (serverUser == null)
            {
                ThrowError("Failed to set up your account with the service. Please try again later.");
                return;
            }

            AppData.AssignCurrentUser(serverUser);
            ReadyMainMenu();
        }