Example #1
0
        public void LoadFromAppSettings()
        {
            var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
            var composite     = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["_userSessionData"];

            if (composite == null)
            {
                return;
            }
            Username            = (string)composite["Username"];
            Password            = (string)composite["Password"];
            RankToken           = (string)composite["RankToken"];
            CsrfToken           = (string)composite["CsrfToken"];
            FacebookUserId      = (string)composite["FacebookUserId"];
            FacebookAccessToken = (string)composite["FacebookAccessToken"];
            LoggedInUser        = new InstaUser
            {
                IsVerified        = (bool)composite["LoggedInUser.IsVerified"],
                IsPrivate         = (bool)composite["LoggedInUser.IsPrivate"],
                Pk                = (long)composite["LoggedInUser.Pk"],
                ProfilePictureUrl = (string)composite["LoggedInUser.ProfilePictureUrl"],
                ProfilePictureId  = (string)composite["LoggedInUser.ProfilePictureId"],
                Username          = (string)composite["LoggedInUser.Username"],
                FullName          = (string)composite["LoggedInUser.FullName"]
            };
        }
Example #2
0
 /// <summary>
 /// Only use this constructor to make empty placeholder thread.
 /// </summary>
 /// <param name="user"></param>
 /// <param name="api"></param>
 public InstaDirectInboxThreadWrapper(InstaUser user, Instagram api) : this(api)
 {
     Users.Add(user);
     Title = user.Username;
     if (Users.Count == 0)
     {
         Users.Add(new InstaUser());
     }
 }
 public ShopConfirmationSubForm(ref InstaMarketDbContext dbContext, InstaUser shop, ShopAddSubForm parentForm)
 {
     InitializeComponent();
     this.shop       = shop;
     this.dbContext  = dbContext;
     this.parentForm = parentForm;
     shopPictureBox.ImageLocation = shop.ProfilePicture;
     usernameLabel.Text           = shop.UserName;
     fullNameLabel.Text           = shop.FullName == null? "" : shop.FullName;
 }
Example #4
0
        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 InstaUser instaUser)
        {
            UserInfo userInfo = new UserInfo
            {
                Id                = instaUser.Pk,
                UserName          = instaUser.UserName,
                FullName          = instaUser.FullName,
                IsPrivate         = instaUser.IsPrivate,
                HasProfilePicture = instaUser.ProfilePictureId != ApiConstans.UNKNOWN
            };

            return(userInfo);
        }
Example #6
0
 public static InstaUserShort ToUserShort(this InstaUser 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
     });
 }
Example #7
0
 public static InstaUserShortFriendship ToUserShortFriendship(this InstaUser user)
 {
     return(new InstaUserShortFriendship
     {
         IsPrivate = user.IsPrivate,
         IsVerified = user.IsVerified,
         FullName = user.FullName,
         UserName = user.UserName,
         Pk = user.Pk,
         ProfilePictureId = user.ProfilePictureId,
         ProfilePicture = user.ProfilePicture,
         ProfilePicUrl = user.ProfilePicUrl,
         FriendshipStatus = user.FriendshipStatus,
         HasAnonymousProfilePicture = user.HasAnonymousProfilePicture,
         IsBestie = user.IsBestie
     });
 }
Example #8
0
        public async Task Import(UserSettings settings)
        {
            try
            {
                await AuthorizeBot(settings);

                var result = await _instaApi.GetUserFollowersAsync(settings.TargetUsername, PaginationParameters.Empty);

                var followers = result.Value;
                var count     = followers.Count;

                var import = new ImportList()
                {
                    Date       = DateTime.UtcNow,
                    Count      = followers.Count,
                    UserId     = settings.UserId,
                    TargetName = settings.TargetUsername
                };
                _context.ImportLists.Add(import);
                await _context.SaveChangesAsync();

                foreach (var item in followers)
                {
                    var follower = new InstaUser()
                    {
                        ImportId         = import.Id,
                        IsPrivate        = item.IsPrivate,
                        IsVerified       = item.IsVerified,
                        FullName         = item.FullName,
                        Pk               = item.Pk,
                        UserName         = item.UserName,
                        ProfilePicture   = item.ProfilePicture,
                        ProfilePictureId = item.ProfilePictureId
                    };
                    _context.InstaUsers.Add(follower);
                }
                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #9
0
        public async Task <Object> Register([FromBody] AuthUser user)
        {
            var newUser = new IdentityUser()
            {
                UserName = user.name, Email = user.email
            };
            var reg = await this.manager.CreateAsync(newUser, user.password);

            if (!reg.Succeeded)
            {
                return new { id = String.Empty, errors = reg.Errors }
            }
            ;

            var res = await this.signInManager.PasswordSignInAsync(user.name, user.password, false, false);

            if (!res.Succeeded)
            {
                return new { id = String.Empty }
            }
            ;
            try
            {
                var model = new InstaUser()
                {
                    IdentityId = newUser.Id,
                    email      = newUser.Email,
                    name       = newUser.UserName,
                    picPath    = "salah.jpg"
                };

                await context.instaUsers.AddAsync(model);

                await context.SaveChangesAsync();
            }
            catch { return(String.Empty); }
            var ret = await manager.FindByNameAsync(user.name);

            return(new { id = ret.Id });
        }
       public bool SaveAccountDeatils(OAuthTokens tokens, string userId,string Email)
       {
           try
           {
               AccessDetails accessToken = new AccessDetails() { AccessToken = tokens.access_token };
               InstaUser profile = GetUserprofile(accessToken);
               SocialMedia socialDetails = new SocialMedia()
               {
                   UserId = userId,
                   Provider = SocialMediaProviders.Instagram.ToString(),
                   AccessDetails = new AccessDetails { AccessToken = tokens.access_token },
                   ProfilepicUrl = profile.data.profile_picture,
                   SMId = profile.data.id.ToString(),
                   Status = true,
                   UserName = profile.data.username,
<<<<<<< .mine
                   Followers = profile.data.counts.follows

               };
=======
                   Followers = profile.data.Followers,
                   AccSettings = new AccSettings()
                 };
               socialDetails.AccSettings.UserManagement.Add(new UserManagement { Email = Email, userId = userId, Role = "Owner" });