private async Task <UserInfo> UserToUserInfo(User user) { var userInfo = new UserInfo { Email = user.Email, Name = user.FirstName + " " + user.LastName, Selected = false }; var friendResult = await FriendshipsApi.GetFriendship(_settings.Jwt, user.Email); if (friendResult.IsSuccessful && friendResult.Content != null) { userInfo.FriendStatus = friendResult.Content.IsConfirmed ? FriendStatus.IsConfirmed : FriendStatus.IsNotConfirmed; } else { userInfo.FriendStatus = FriendStatus.NotFriend; } userInfo.ProfilePhoto = (await ImagesApi.GetProfileImage(userInfo.Email, true)).Content; userInfo.IsSelectable = _context.MultiSelection && userInfo.FriendStatus == FriendStatus.IsConfirmed; return(userInfo); }
protected override async void OnAppearing() { base.OnAppearing(); if (_email == null) { _userContext.User = (await AccountsApi.GetUserByJwt(_settings.Jwt)).Content; } else { _userContext.User = (await AccountsApi.GetUserByEmail(_settings.Jwt, _email)).Content; LayoutAddAsFriend.IsVisible = true; await SetFriendshipStatus(); } var photoResult = await ImagesApi.GetProfileImage(_userContext.User.Email, false); if (photoResult.IsSuccessful) { _userContext.Photo = photoResult.Content; } LayoutLoading.IsVisible = false; LayoutContent.IsVisible = true; }
public async Task Initialize() { var keys = _userPhotos.Keys.ToList(); foreach (var email in keys) { var imageResult = await ImagesApi.GetProfileImagePersistent(email, true); if (imageResult.IsSuccessful) { _userPhotos[email] = imageResult.Content; } } }
void SendExample() { foreach (Transform child in ResultsLayout.transform) { Destroy(child.gameObject); } Resources.UnloadUnusedAssets(); Debug.Log($"Searching : {SearchInput.text}", this); SearchButton.interactable = false; lastPageNo = 1; ClearResults(); ImagesApi.Search(SearchInput.text, SafeSearch.Off, lastPageNo, location, OnSearchCallback); }
async void OnPhotoPressed(object sender, EventArgs args) { if (_email == null) { var choice = await DisplayActionSheet("Update Photo", "Cancel", null, "Upload a Photo", "Take a Picture"); if (choice == "Upload a Photo") { await CrossMedia.Current.Initialize(); var mediaOptions = new PickMediaOptions() { PhotoSize = PhotoSize.Medium }; var selectedImageFile = await CrossMedia.Current.PickPhotoAsync(mediaOptions); if (selectedImageFile != null) { if ((await ImagesApi.PostProfileImage(_settings.Jwt, selectedImageFile)).IsSuccessful) { _userContext.Photo = ImageSource.FromStream(() => selectedImageFile.GetStream()); } } } else if (choice == "Take a Picture") { var selectedImageFile = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions() { }); if (selectedImageFile != null) { if ((await ImagesApi.PostProfileImage(_settings.Jwt, selectedImageFile)).IsSuccessful) { _userContext.Photo = ImageSource.FromStream(() => { return(selectedImageFile.GetStream()); }); } } } } }
public void Init() { m_instance = new ImagesApi(TestUtils.Configuration); }
public ImageAPIExamples() { api = new ImagesApi(AppSID, SecretKey); }
void PreviousPage() { lastPageNo--; ClearResults(); ImagesApi.Search(SearchInput.text, SafeSearch.Off, lastPageNo, location, OnSearchCallback); }