public void LoadExternalProfile(object e) { if (e is InstaUserShort userShort && userShort != null) { //UserDetailsVM = new UserDetailsViewModel(); //DataContext = UserDetailsVM; UserShort = userShort; UserShortFriendship = null; Username = null; //NavigationCacheMode = NavigationCacheMode.Disabled; //NavigationCacheMode = NavigationCacheMode.Required; try { ConnectedAnimation imageAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("UserImage"); if (imageAnimation != null) { ImageAnimationExists = true; //imageAnimation.Completed += ImageAnimationClose_Completed; //if (LatestGrid?.Name != InfoGrid.Name) // LatestGrid.Background = new SolidColorBrush(Helper.GetColorFromHex("#FF2E2E2E")); imageAnimation.TryStart(UserImage); //GridShadow.Visibility = GVSHOW.Visibility = Visibility.Collapsed; } else { ImageAnimationExists = false; } } catch { } }
private void AddData(InstaUserShort user, bool follower) { Follower current; if (!_otherUsers.ContainsKey(user.UserName)) { current = new Follower() { OtherUser = user }; _otherUsers.Add(user.UserName, current); } else { current = _otherUsers[user.UserName]; } if (follower) { current.Follows = true; } if (!follower) { current.IsFollowed = true; } }
public RemoveUserDialog(InstaUserShort userShort) { this.InitializeComponent(); User = userShort; Image.UriSource = new Uri(userShort.ProfilePicture); RemoveUserText.Text = $"We won't tell @{userShort.UserName} they were removed from your followers."; }
public UnfollowUserDialog(InstaUserShort userShort) { this.InitializeComponent(); User = userShort; Image.UriSource = new Uri(userShort.ProfilePicture); UnfollowUserText.Text = $"Unfollow @{userShort.UserName}?"; }
private void AddData(InstaUserShort user, FollowListMode follower) { FollowerUI current; if (!_otherUsers.ContainsKey(user.UserName)) { current = new FollowerUI() { OtherUser = user }; _otherUsers.Add(user.UserName, current); } else { current = _otherUsers[user.UserName]; } if (follower == FollowListMode.FollowMe) { current.Follows = true; } if (follower == FollowListMode.IFollow) { current.IsFollowed = true; } }
public void LoadExternalProfile(object e) { if (e is InstaUserShort userShort && userShort != null) { ShowTVTab = false; UserShort = userShort; UserShortFriendship = null; Username = null; try { ConnectedAnimation imageAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("UserImage"); if (imageAnimation != null) { ImageAnimationExists = true; imageAnimation.TryStart(UserImage); } else { ImageAnimationExists = false; } } catch { } }
public void SetUser(InstaUserShort user) { User = user; Username = user.UserName; FollowingsGenerator.SetUserId(user.Pk); FollowersGenerator.SetUserId(user.Pk); MutualFriendsGenerator.SetUserId(user.Pk); }
public InstaUser(InstaUserShort instaUserShort) { Pk = instaUserShort.Pk; UserName = instaUserShort.UserName; FullName = instaUserShort.FullName; IsPrivate = instaUserShort.IsPrivate; ProfilePicture = instaUserShort.ProfilePicture; ProfilePictureId = instaUserShort.ProfilePictureId; IsVerified = instaUserShort.IsVerified; }
public bool RemoveFromMyFollower(InstaUserShort user) { var followerUI = _otherUsers[user.UserName]; if (followerUI.Follows) { return(false); } _otherUsers.Remove(user.UserName); return(true); }
public void ResetCache() { User = null; CurrentMedia = null; SelectedIndex = -1; PageCount = 1; Pagination = PaginationParameters.MaxPagesToLoad(1); IsLoading = true; HasMoreItems = true; Items.Clear(); FirstRun = true; }
public void SetData(InstaUserShort user, List <InstaMedia> medias, int selectedIndex = -1) { try { User = user; Items.Clear(); Items.AddRange(medias); Pagination = PaginationParameters.MaxPagesToLoad(1); SelectedIndex = selectedIndex; } catch { } }
private Result <InstaUser> CreateReturnResultInstaUser() { var instaUserShort = new InstaUserShort { UserName = userName, Pk = userId, IsPrivate = false }; var instaUser = new InstaUser(instaUserShort); return(new Result <InstaUser>(true, instaUser)); }
public static UserInfo ToUserInfo(this InstaUserShort instaUser) { UserInfo userInfo = new UserInfo { Id = instaUser.Pk, UserName = instaUser.UserName, FullName = instaUser.FullName, IsPrivate = instaUser.IsPrivate, HasProfilePicture = instaUser.ProfilePictureId != ApiConstans.UNKNOWN }; return(userInfo); }
public static InstaUserInfo ToUserInfo(this InstaUserShort userShort) { return(new InstaUserInfo { IsPrivate = userShort.IsPrivate, IsVerified = userShort.IsVerified, FullName = userShort.FullName, UserName = userShort.UserName, Pk = userShort.Pk, ProfilePictureId = userShort.ProfilePictureId, ProfilePicture = userShort.ProfilePicture, ProfilePicUrl = userShort.ProfilePicUrl, HasAnonymousProfilePicture = userShort.HasAnonymousProfilePicture }); }
public static InstaUserShort CopyUserShort(this InstaUserShort user) { return(new InstaUserShort { IsPrivate = user.IsPrivate, IsVerified = user.IsVerified, FullName = user.FullName, UserName = user.UserName, Pk = user.Pk, ProfilePictureId = user.ProfilePictureId, ProfilePicture = user.ProfilePicture, ProfilePicUrl = user.ProfilePicUrl, IsBestie = user.IsBestie }); }
public static async Task OpenUser(string username) { var shortInfo = new InstaUserShort(); shortInfo.UserName = username; var browseruri = $"https://instagram.com/{username}"; var appuri = await Launcher.CanOpenAsync($"instagram://"); if (appuri) { Device.OpenUri(new Uri($"instagram://user?username={username}")); } else { await Browser.OpenAsync(browseruri, BrowserLaunchMode.SystemPreferred); } }
private static InstaActivityDto CreateActivityDto(InstaDirectInboxItem item, InstaUserShort user) { var activity = new InstaActivityDto { User = new InstaUserDto { Fullname = user.FullName, Username = user.UserName, ProfilePicture = user.ProfilePicture }, Timestamp = item.TimeStamp }; ActivityHandler.AddMediaToActivityBasedOnType(item, activity); return(activity); }
public void SetUser(InstaUserShort userShort) { if (userShort == null) { return; } UserShort = userShort; User = userShort?.ToUserInfo(); MediaGeneratror.UserId = userShort.Pk; TVMediaGeneratror.UserId = userShort.Pk; TaggedMediaGeneratror.UserId = userShort.Pk; ShopMediaGeneratror.UserId = userShort.Pk; GetUserFriendship(); GetUserInfo(); GetHighlights(); GetStories(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode != NavigationMode.Back) { AppCore.ModerateBack(BackFunc); } this.DataContext = ((InstaDirectInboxThread)e.Parameter); var source = ((InstaDirectInboxThread)e.Parameter); ItemsList = new GenerateDirectThreadList <InstaDirectInboxItem>(100000, (count) => { return(new InstaDirectInboxItem()); }, source.ThreadId); var Message = await AppCore.InstaApi.GetDirectInboxThreadAsync(source.ThreadId, PaginationParameters.MaxPagesToLoad(1)); VieweIds = Message.Value.VieweId; ThreadIds = Message.Value.ThreadId; DataUser = Message.Value.Users[0]; try { UserId = Message.Value.Users[0].Pk; } catch { UserId = (await AppCore.InstaApi.GetCurrentUserAsync()).Value.Pk; } //MessageList.ItemsSource = Message.Value.Items; Message.Value.Items.Reverse(); //for (int a = 0; a < Message.Value.Items.Count; a++) //{ // MessageList.Items.Add(Message.Value.Items[a]); //} //foreach (InstaDirectInboxItem item in ItemsList) //{ // MessageList.Items.Insert(0, item); //} MessageList.ItemsSource = ItemsList; //var test = await AppCore.InstaApi.GetRecentRecipientsAsync(); }
public async void SetUsername(string username) { try { if (!string.IsNullOrEmpty(username)) { Username = username.TrimAnyBullshits(); } if (string.IsNullOrEmpty(Username)) { return; } await MainPage.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() => { var userInfo = await InstaApi.UserProcessor.GetUserInfoByUsernameAsync(Username); if (userInfo.Succeeded) { UserShort = userInfo.Value?.ToUserShort(); View.ScrollableUserPostUc.UpdateUser(UserShort); User = userInfo.Value; MediaGeneratror.UserId = userInfo.Value.Pk; TVMediaGeneratror.UserId = userInfo.Value.Pk; TaggedMediaGeneratror.UserId = userInfo.Value.Pk; ShopMediaGeneratror.UserId = userInfo.Value.Pk; View.CreateTabs(User.TotalIGTVVideos > 0, User.ShoppablePostsCount > 0, User.UsertagsCount > 0); GetUserFriendship(); //GetUserInfo(); GetHighlights(); View.UpdateUserImage(UserShort.ProfilePicture); GetPosts(); GetStories(); } else { if (userInfo.Info.Message.ToLower().Contains("user not found")) { $"User not found.\r\n@{Username} doesn't exists.".ShowErr(); } } }); } catch { } }
public void ResetToDefault() { if (BiographyText != null) { BiographyText.Blocks.Clear(); } MediaGeneratror.ResetCache(); UserShort = null; FriendshipStatus = null; User = null; Username = null; TVChannel = null; Highlights.Clear(); Stories.Clear(); ChainingSuggestions.Clear(); PrivateVisibility = NoPostsVisibility = ChainingVisibility = IGTVVisibility = HighlightsVisibility = Visibility.Collapsed; View = null; }
public async void SetInfo(InstaUserShort user, UserDetailsShopMediasGenerator generator, ScrollViewer scroll) { if (user == null) { return; } if (generator == null) { return; } User = user; MediaGeneratror = generator; await Task.Delay(500); if (scroll != null) { scroll.ViewChanging += MediaGeneratror.Scroll_ViewChanging; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode == NavigationMode.New) { GetType().RemovePageFromBackStack(); } NavigationMode = e.NavigationMode; //if (e.Parameter is InstaMedia media) //{ // Media = media; //} //else if (e.Parameter is object[] obj) { if (obj.Length == 2) { var mediaList = obj[0] as List <InstaMedia>; SelectedIndex = (int)obj[1]; MediaList.Clear(); if (mediaList?.Count > 0) { MediaList.AddRange(mediaList); Media = MediaList[SelectedIndex]; } } else if (obj.Length == 3) { var mediaList = obj[0] as List <InstaMedia>; SelectedIndex = (int)obj[1]; MediaList.Clear(); User = obj[2] as InstaUserShort; if (mediaList?.Count > 0) { MediaList.AddRange(mediaList); Media = MediaList[SelectedIndex]; } } } }
public void SetUser(InstaUserShortFriendship userShortFriendship) { if (userShortFriendship == null) { return; } UserShort = userShortFriendship.ToUserShort(); User = UserShort?.ToUserInfo(); MediaGeneratror.UserId = UserShort.Pk; TVMediaGeneratror.UserId = UserShort.Pk; TaggedMediaGeneratror.UserId = UserShort.Pk; ShopMediaGeneratror.UserId = UserShort.Pk; if (userShortFriendship.FriendshipStatus != null) { FriendshipStatus = userShortFriendship.FriendshipStatus?.ToStoryFriendshipStatus(); } GetUserFriendship(); GetUserInfo(); GetHighlights(); GetStories(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); KeyDown += OnKeyDownHandler; ($"===================================== NAV MODE: {e.NavigationMode} ========================").PrintDebug(); NavigationMode = e.NavigationMode; if (e.Parameter != null) { if (e.Parameter is InstaUserShort userShort) { User = userShort; } else if (e.Parameter is object[] obj) { if (obj[0] is InstaUserShort user) { User = user; SelectIndex = (int)obj[1] + 1; } } } }
public async void SetData(InstaUserShort user, UserDetailsTaggedMediasGenerator mediaGeneratror) { try { User = user; MediaGeneratror = mediaGeneratror; if (!CanLoadFirstPopUp) { try { LVPosts.ItemsSource = null; } catch { } if (Scroll == null) { Scroll = LVPosts.FindScrollViewer(); if (Scroll != null) { Scroll.ViewChanging += ScrollViewViewChanging; } } //LVPosts.ItemsSource = null; //ScrollableUserPostVM.ResetCache(); ScrollableUserTaggedPostVM.SetInfo(User, MediaGeneratror, Scroll); LVPosts.ItemsSource = ScrollableUserTaggedPostVM.MediaGeneratror.Items; ////LVPosts.ItemsSource = ScrollableUserPostVM.MediaGeneratror.ItemsX; await Task.Delay(500); //LVPosts.ScrollIntoView(ScrollableUserPostVM.MediaGeneratror.Items[SelectedIndex]); ////LVPosts.ScrollIntoView(ScrollableUserPostVM.MediaGeneratror.ItemsX[SelectedIndex]); CanLoadFirstPopUp = true; } } catch { } }
public UsersDialog(InstaUserShort userShort) : this() { UserProfile = userShort; UsersDialogCommand = UsersDialogCommand.Profile; }
private async void LoadPage() { _ProgressBar.IsIndeterminate = true; var p = PaginationParameters.MaxPagesToLoad(1); var res = await AppCore.InstaApi.GetDirectInboxAsync(p); p.NextId = res.Value.Inbox.OldestCursor; var res2 = await AppCore.InstaApi.GetDirectInboxAsync(p); if (res.Info.Message == "login_required") { //AppCore.InstaApi = null; AppCore.SaveUserInfo(null, null, false); MainPage.MainFrame.GoBack(); return; } //TEST var User = AppCore.InstaApi.GetLoggedUser(); var user = await AppCore.InstaApi.GetUserInfoByUsernameAsync(User.UserName); var items = await AppCore.InstaApi.GetUserStoryFeedAsync(user.Value.Pk); InstaUserShort You = new InstaUserShort() { UserName = "******", ProfilePicture = user.Value.ProfilePicUrl, Pk = user.Value.Pk }; InstaReelFeed MyReel = new InstaReelFeed(); MyReel.User = You; //MyReel.Seen = 0; MyReel.Items = items.Value.Items; //var m = (await AppCore.InstaApi.GetUserTimelineFeedAsync(p)); //var first = m.Value.Medias.LastOrDefault(); //var s = await AppCore.InstaApi.GetMediaCommentsAsync(first.InstaIdentifier.ToString(), p); //var sss = ""; // var ss = await AppCore.InstaApi.GetMediaLikersAsync(first.InstaIdentifier.ToString()); //var sssds = ""; var strs = await AppCore.InstaApi.GetStoryFeedAsync(); if (strs.Value.Items.Exists(x => x.User.Pk == user.Value.Pk)) { //strs.Value.Items.OrderBy(x => x.Seen != 0); var MyRemove = strs.Value.Items.FindIndex(x => x.User.Pk == user.Value.Pk); MyReel.Seen = strs.Value.Items[MyRemove].Seen; MyReel.LatestReelMedia = strs.Value.Items[MyRemove].LatestReelMedia; strs.Value.Items.RemoveAt(MyRemove); } // strs.Value.Items.OrderBy(x => x.Seen_ranked_position != 0); strs.Value.Items.Insert(0, MyReel); StoriesList.ItemsSource = strs.Value.Items; if (HomePageItemssource != null) { HomePageItemssource.CollectionChanged -= HomePageItemssource_CollectionChanged; } HomePageItemssource = new GenerateHomePage <InstaMedia>(100000, (count) => { //return tres[count]; return(new InstaMedia()); }); HomePageItemssource.CollectionChanged += HomePageItemssource_CollectionChanged; //MediasCVS.Source = HomePageItemssource; mylist.ItemsSource = HomePageItemssource; //await HomePageItemssource.LoadMoreItemsAsync(20); //mylist.ItemsSource = res.Value.Medias; //mylist.ItemsSource = res.Value.Medias; _ProgressBar.IsIndeterminate = false; var sv = FindChildOfType <ScrollViewer>(mylist); sv.ViewChanged += Sv_ViewChanged; //await Task.Delay(2000); //DirectFr.Navigate(typeof(DirectsListView)); //MainPage.MainFrame.Navigate(typeof(DirectsListView)); }
public static bool IsMine(this InstaUserShort userShort) => userShort.Pk == Helper.CurrentUser?.Pk;
async void MassLike() { Stat = true; userInfoLog = await api.GetCurrentUserAsync(); EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Масслайкинг запущен")); EventFromMyClass(this, new MyEventMessage( $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Загружаю базу.")); try { foreach (string str in File.ReadAllLines(setting.FileNameBase)) { try { usersID.Add(Convert.ToInt64(str)); usersIDcopy.Add(Convert.ToInt64(str)); } catch { continue; } } } catch (Exception e) { EventFromMyClass(this, new MyEventMessage( $"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] ОШИБКА: {e.Message}")); } EventUpdateGrid(this, new UpdateGridEvent( $"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" + $"Выполняется")); foreach (long id in usersID) { try { if (_source == null || _source.IsCancellationRequested) { break; } if (setting.ChekedSkipSubscriber) { var x = await api.GetCurrentUserFollowersAsync(PaginationParameters.MaxPagesToLoad(10)); var o = new InstaUserShort(); o.Pk = id; if (x.Value.IndexOf(o) != -1) { EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Подписчик с id: {id} пропущен")); usersIDcopy.Remove(id); Thread.Sleep(500); continue; } } int pages = (int)setting.LikeAtUserMax; var userInfo = await api.GetUserInfoByIdAsync(id); Thread.Sleep(100); var media = await api.GetUserMediaAsync( userInfo.Value.Username, PaginationParameters.MaxPagesToLoad(pages % 18 == 0 ? pages : pages + 1)); //Учет загруки страаниц var mediaList = media.Value.ToList(); int random = rnd.Next((int)setting.LikeAtUserMin - 1, (int)setting.LikeAtUserMax); for (int i = 0; i < random; i++) //Учет кол-во лайков на пользователя { if (mediaList.Count > i && setting.LikeUnderPublicMin <= mediaList[i].LikesCount && mediaList[i].LikesCount <= setting.LikeUnderPublicMax) //Учет настройки лайков под публикацией { if (_source == null || _source.IsCancellationRequested) { break; } await api.LikeMediaAsync(mediaList[i].Pk); CountLikes++; CountPause++; EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Поставил лайк пользователю {userInfo.Value.Username}. Кол-во лайков: {CountLikes}")); EventUpdateGrid(this, new UpdateGridEvent( $"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" + $"Выполняется")); if (setting.ChekedDeleteInBaseAfterLike) { usersIDcopy.Remove(id); } Delay(); if (setting.ChekedPause) { if (CountPause >= setting.PauseLimit) { CountPause = 0; EventUpdateGrid(this, new UpdateGridEvent($"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" + $"Пауза")); EventFromMyClass(this, new MyEventMessage( $"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Пауза на " + setting.PauseTime + " минут ")); if (timer != null) { timer.Dispose(); } timer = new Timer(CancelDelay, null, 60000 * (int)setting.PauseTime, Timeout.Infinite); ew.Reset(); ew.WaitOne(); } } } else { EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Недостаточно лайков под постом пользователя {userInfo.Value.Username}. Пропуск")); if (setting.ChekedDeleteInBaseAfterLike) { usersIDcopy.Remove(id); } Thread.Sleep(1000); } } } catch (Exception e) { EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] ОШИБКА : {e.Message}")); continue; } } EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Выполнено")); EventUpdateGrid(this, new UpdateGridEvent( $"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" + $"Завершено")); Stat = false; Save(); }