Exemple #1
0
    public void FaceBookLogin()
    {
        GetMethods.GetUserId(email, (id) => {
            if (id != "0")             // The user exits in the data base

            // Verify if an Update is necessary.
            {
                UpdateMethods.UpdateUsersDatabase(id, userName, age, AppManeger.instance.userGender.ToString(), (result) => {
                    Debug.Log(string.Format("Update {0}", result));
                });

                string fileName = string.Format("Prefs_{0}", AppManeger.instance.userID);

                //GetMethods.GetUserPrefs(id, (prefsResult) => {PrefsResult(prefsResult);}); // Check if the user are in the Prefs Database

                if (SaveLoadData.FileExits(fileName))                 // If exit

                {
                    SaveLoadData.Load(fileName, SaveLoadData.DataType.UserPrefs); // load from device
                    GoToCheersPanel();                                            // Means the user has everyting setted;
                }
                else
                {
                    GetMethods.GetUserPrefs(id, (prefsResult) => { PrefsResult(prefsResult); });                   // Check if the user are in the Prefs Database
                }
            }
            else                // User don't exit in the data base

            {
                PostMethods.InsertUserIntoUsersDatabase(userName, age, email, gender, (result) => {
                    InsertUserResult(result);
                });
            }
        });
    }
Exemple #2
0
    public void Continue()
    {
        Debug.Log("Continue was pressed");
        managePanelChanges.GoToCheersPanel();

        AppManeger.isLoadingData = true;
        string id        = AppManeger.instance.userID;
        string smoke     = AppManeger.instance.isSmoke.ToString();
        string minAge    = AppManeger.instance.wantAge [0].ToString();
        string maxAge    = AppManeger.instance.wantAge [1].ToString();
        string habit     = AppManeger.instance.yourHabit.ToString();
        string wantMan   = "false";
        string wantWoman = "false";

        if (AppManeger.instance.wantToMeet.Contains(AppManeger.Gender.Male))
        {
            wantMan = "true";
        }
        if (AppManeger.instance.wantToMeet.Contains(AppManeger.Gender.Female))
        {
            wantWoman = "true";
        }

        PostMethods.InsertUserIntoUsersPrefsDatabase(id, smoke, minAge, maxAge, habit, wantMan, wantWoman, (result) => {
            AppManeger.isLoadingData = false;
            Debug.Log(result);
        });
    }
    public void MoveGlassToLeft()
    {
        PostMethods.InsertCheersIntoMatchsDatabase(AppManeger.instance.userID, choosenId, "false", (result) => {
            Debug.Log(result);
        });

        moveGlassAnimartor.SetTrigger("goLeft");          // trigger animation to left

        StartCoroutine("FindMoreCheers");
    }
    public void MoveGlassToRight()
    {
        PostMethods.InsertCheersIntoMatchsDatabase(AppManeger.instance.userID, choosenId, "true", (result) => {
            Debug.Log(result);
        });

        moveGlassAnimartor.SetTrigger("goRight");        // trigger animation to right
        fixGlassAnimator.SetBool("rotate", true);        //trigger rotation on the fix glass

        StartCoroutine("FindMoreCheers");
    }
Exemple #5
0
 public void Setup()
 {
     _client = new RestClient
     {
         BaseUrl = new Uri(Constants.API_BASE_URL)
     };
     _client.AddDefaultHeader(Constants.G_TOKEN_NAME, Constants.G_TOKEN_VALUE);
     _client.Authenticator = new HttpBasicAuthenticator(Constants.AUTHORIZATION_NAME, Constants.AUTHORIZATION_PASSWORD);
     _gen  = new GeneralMethods();
     _post = new PostMethods(_client);
     _get  = new GetMethods(_client);
     _del  = new DeleteMethods(_client);
 }
Exemple #6
0
        private static IEnumerable <QuestionInformation> ParseQuestions(this IEnumerable <Question> questions)
        {
            List <QuestionInformation> qi = new List <QuestionInformation>();
            QuestionInformation        q;

            int[] rank = new int[questions.Count()];
            foreach (var item in questions)
            {
                q            = new QuestionInformation();
                q.Question   = item;
                q.TotalWords = PostMethods.GetTotalWords(item.Body);
                q.Errors     = PostMethods.CheckSpelling(item.Body);
                qi.Add(q);
            }
            return(qi);
        }
Exemple #7
0
        public string SendPost(PostMethods method, string[] args)
        {
            WebRequest request = WebRequest.Create(Server);

            request.Method      = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            byte[] Data = Encoding.GetEncoding(1251).GetBytes("method=" + method.ToString() + ParseArgs(args));
            request.ContentLength = Data.Length;
            Stream siteStream = request.GetRequestStream();

            siteStream.Write(Data, 0, Data.Length);
            siteStream.Close();
            HttpWebResponse result = (HttpWebResponse)request.GetResponse(); //tl;dr HttpWebResponse contains status code
            string          responseString;

            using (Stream stream = result.GetResponseStream())//dispose tl;dr
            {
                StreamReader reader = new StreamReader(stream, Encoding.UTF8);
                responseString = reader.ReadToEnd();
            }
            responseString += $"\nStatus Code : {result.StatusCode} / {result.StatusDescription}";
            return(responseString);
        }
Exemple #8
0
 public Status hidePost(int post_id, int user_id, String datetime)
 {
     return(PostMethods.hidePost(post_id, user_id, datetime));
 }
Exemple #9
0
 public Status getPostShares(int post_id, String datetime, int offset)
 {
     return(PostMethods.getPostShares(post_id, datetime, offset));
 }
Exemple #10
0
 public Status getPostLikes(int post_id, String datetime, int offset)
 {
     return(PostMethods.OnGettingPostLikes(post_id, datetime, offset));
 }
Exemple #11
0
 public Status getProfilePosts(int user_id, String datetime, int incomingUserId, int offset)
 {
     return(PostMethods.OnGettingProfilePosts(user_id, incomingUserId, datetime, offset));
 }
Exemple #12
0
 public Status getProfileInfo(int profile_user_id, int current_user_id)
 {
     return(PostMethods.onGettingProfileInfo(profile_user_id, current_user_id));
 }
Exemple #13
0
 public Status savePost(int post_id, int user_id, String datetime, String description)
 {
     return(PostMethods.savePost(post_id, user_id, datetime, description));
 }
Exemple #14
0
 public Status getPostById(int post_id, int user_id)
 {
     return(PostMethods.getPostById(post_id, user_id));
 }
Exemple #15
0
 public Status removeLike(int like_id, int post_id)
 {
     return(PostMethods.onDeletingLike(like_id, post_id));
 }
Exemple #16
0
 public Status removeHidePost(int post_hidden_id)
 {
     return(PostMethods.removeHidePost(post_hidden_id));
 }
Exemple #17
0
 public Status addNewPost([FromBody] Post post)
 {
     return(PostMethods.onInsertingNewPost(post));
 }
Exemple #18
0
 public Status GetFriendPosts2(int User_id, String datetime, int offset, int type)
 {
     return(PostMethods.onRequestingPosts2(User_id, datetime, offset, type));
 }
Exemple #19
0
 public Boolean updatePost([FromBody] PostUpdateData updatePost)
 {
     return(PostMethods.updatePost(updatePost));
 }
Exemple #20
0
 public Status removeSavedPost(int saved_post_id)
 {
     return(PostMethods.removeSavedPost(saved_post_id));
 }
Exemple #21
0
 public Status getSavedPosts(int user_id, String datetime, int offset)
 {
     return(PostMethods.getSavedPosts(user_id, datetime, offset));
 }
Exemple #22
0
 public Status deletePost(int post_id)
 {
     return(PostMethods.deletePost(post_id));
 }
Exemple #23
0
 public Status dislikePost(int User_id, int Post_id, String Datetime)
 {
     return(PostMethods.onDisLike(User_id, Post_id, Datetime));
 }
Exemple #24
0
 public Status removeDisLike(int dis_like_id, int post_id)
 {
     return(PostMethods.onDeletingDisLike(dis_like_id, post_id));
 }
Exemple #25
0
 public Status shareAPost([FromBody] Post post)
 {
     return(PostMethods.onSharingPost(post));
 }
Exemple #26
0
 public Status reportPost(int post_id, int user_id, int report_type, String report_datetime)
 {
     return(PostMethods.reportPost(post_id, user_id, report_type, report_datetime));
 }