private async Task AddUserConnectionProfileAsync(UserConnnectionProfile userConnectionProfile) { // Set the connection profiles inside the list of all existing profiles var profiles = await RetrieveAllConnectionProfilesAsync(); profiles[userConnectionProfile.User.Username] = userConnectionProfile; // Save the dictionary in local storage await _localObjectStorageHelper.SaveFileAsync(LocalStorageConstants.UserConnectionProfiles, profiles); }
private void HandleLoginSuccess() { _tvshowtimeApiService.GetCurrentUser().Subscribe(async(userResponse) => { // Cache access token in Password vault SaveUserToken(userResponse.User.Username); // Save user information (connection profile) in local storage var userConnectionProfile = new UserConnnectionProfile { User = userResponse.User, ExpirationDate = DateTime.Now.AddSeconds(LoginConstants.TokenLifetime) }; await AddUserConnectionProfileAsync(userConnectionProfile); // Navigate to main page await DispatcherHelper.ExecuteOnUIThreadAsync(() => { _navigationService.NavigateTo(ViewConstants.Main); }); }); }