Ejemplo n.º 1
0
        private void WoDefaultClient_OnPageEventFinished(WebView view, string url)
        {
            try
            {
                swipeRefreshLayout.Refreshing = false;

                HybridController.EvaluateJavascript("$('.header-container').hide();");
                HybridController.EvaluateJavascript("$('.footer-wrapper').hide();");
                HybridController.EvaluateJavascript("$('.content-container').css('margin-top', '0');");
                HybridController.EvaluateJavascript("$('.wo_about_wrapper_parent').css('top', '0');");

                if (IMethods.CheckConnectivity())
                {
                    if (HybirdView.Visibility != ViewStates.Visible)
                    {
                        HybirdView.Visibility = ViewStates.Visible;
                        News_Empty.Visibility = ViewStates.Gone;
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Ejemplo n.º 2
0
 private void WoDefaultClient_OnPageEventFinished(WebView view, string url)
 {
     try
     {
         if (IMethods.CheckConnectivity())
         {
             if (HybirdView.Visibility != ViewStates.Visible)
             {
                 HybirdView.Visibility = ViewStates.Visible;
                 News_Empty.Visibility = ViewStates.Gone;
             }
         }
     }
     catch (Exception e)
     {
         Crashes.TrackError(e);
     }
 }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);

                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.LocalWebView_layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.LocalWebView_layout);
                }


                var Type = Intent.GetStringExtra("Type") ?? "Data not available";
                if (Type != "Data not available" && !string.IsNullOrEmpty(Type))
                {
                    PageType = Type;
                }

                var dataId = Intent.GetStringExtra("Id") ?? "Data not available";
                if (dataId != "Data not available" && !string.IsNullOrEmpty(dataId))
                {
                    Id = dataId;
                }


                var dataTitle = Intent.GetStringExtra("Title") ?? "Data not available";
                if (dataTitle != "Data not available" && !string.IsNullOrEmpty(dataTitle))
                {
                    TitlePage = dataTitle;
                }

                var ToolBar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (ToolBar != null)
                {
                    ToolBar.Title = TitlePage;

                    SetSupportActionBar(ToolBar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                }

                HybirdView         = FindViewById <WebView>(Resource.Id.LocalWebView);
                swipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.swipeRefreshLayout);

                News_Empty     = (LinearLayout)FindViewById(Resource.Id.News_LinerEmpty);
                News_Icon      = (TextView)FindViewById(Resource.Id.News_icon);
                Txt_News_Empty = (TextView)FindViewById(Resource.Id.Txt_LabelEmpty);
                Txt_News_start = (TextView)FindViewById(Resource.Id.Txt_LabelStart);
                Btn_Reload     = (Button)FindViewById(Resource.Id.reloadPage_Button);
                IMethods.Set_TextViewIcon("2", News_Icon, "\uf119");
                News_Empty.Visibility = ViewStates.Gone;

                swipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight,
                                                           Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight,
                                                           Android.Resource.Color.HoloRedLight);
                swipeRefreshLayout.Refreshing = true;
                swipeRefreshLayout.Enabled    = true;

                //Set WebView and Load url to be rendered on WebView
                HyberdPostViewer_Load();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Ejemplo n.º 4
0
        public void HyberdPostViewer_Load()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    HybirdView.Visibility = ViewStates.Gone;
                    News_Empty.Visibility = ViewStates.Visible;

                    swipeRefreshLayout.Refreshing = false;

                    Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News);
                    Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection);
                }
                else
                {
                    HybirdView.Visibility = ViewStates.Visible;
                    News_Empty.Visibility = ViewStates.Gone;

                    HybridController = new HybirdViewController(this, HybirdView);

                    switch (PageType)
                    {
                    case "User":
                    case "MyProfile":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed + Id;
                        break;

                    case "Saved Post":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed_SavedPost;
                        break;

                    case "Page":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed_Page + Id;
                        break;

                    case "Group":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed_Group + Id;
                        break;

                    case "Hashtag":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed_Hashtag + Id;
                        break;

                    case "Post":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed_Post + Id;
                        break;

                    case "Viewed":
                    case "Article":
                        Url = Id;
                        break;

                    case "Event":
                        Url = Current.URLS.UrlInstance.API_Get_News_Feed_Event + Id;
                        break;

                    default:
                        Url = Id;
                        break;
                    }

                    if (Settings.ClearCachSystem)
                    {
                        HybridController.HybirdView.ClearCache(true);
                    }

                    switch (Settings.Lang)
                    {
                    case "en":
                        HybridController.LoadUrl(Url + "&lang=english");
                        break;

                    case "ar":
                        HybridController.LoadUrl(Url + "&lang=arabic");
                        Settings.FlowDirection_RightToLeft = true;
                        break;

                    case "de":
                        HybridController.LoadUrl(Url + "&lang=german");
                        break;

                    case "el":
                        HybridController.LoadUrl(Url + "&lang=greek");
                        break;

                    case "es":
                        HybridController.LoadUrl(Url + "&lang=spanish");
                        break;

                    case "fr":
                        HybridController.LoadUrl(Url + "&lang=french");
                        break;

                    case "it":
                        HybridController.LoadUrl(Url + "&lang=italian");
                        break;

                    case "ja":
                        HybridController.LoadUrl(Url + "&lang=japanese");
                        break;

                    case "nl":
                        HybridController.LoadUrl(Url + "&lang=dutch");
                        break;

                    case "pt":
                        HybridController.LoadUrl(Url + "&lang=portuguese");
                        break;

                    case "ro":
                        HybridController.LoadUrl(Url + "&lang=romanian");
                        break;

                    case "ru":
                        HybridController.LoadUrl(Url + "&lang=russian");
                        break;

                    case "sq":
                        HybridController.LoadUrl(Url + "&lang=albanian");
                        break;

                    case "sr":
                        HybridController.LoadUrl(Url + "&lang=serbian");
                        break;

                    case "tr":
                        HybridController.LoadUrl(Url + "&lang=turkish");
                        break;

                    default:
                        HybridController.LoadUrl(Url);
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                HyberdPostViewer_Load();
            }
        }
        private async void RegisterButtonOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    if (!string.IsNullOrEmpty(UsernameEditext.Text) || !string.IsNullOrEmpty(PasswordEditext.Text) ||
                        !string.IsNullOrEmpty(PasswordRepeatEditext.Text) || !string.IsNullOrEmpty(EmailEditext.Text))
                    {
                        Settings st = new Settings();

                        Current.CurrentInstance.SetWebsiteURL(st.WebsiteUrl, st.ServerKey);

                        var check = IMethods.Fun_String.IsEmailValid(EmailEditext.Text);
                        if (!check)
                        {
                            IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                     GetText(Resource.String.Lbl_VerificationFailed),
                                                                     GetText(Resource.String.Lbl_IsEmailValid), GetText(Resource.String.Lbl_Ok));
                        }
                        else
                        {
                            if (PasswordRepeatEditext.Text == PasswordEditext.Text)
                            {
                                progressBar.Visibility = ViewStates.Visible;

                                var settingsResult = await Current.GetWoWonder_Settings(st, "WoWonder_Native_Android");

                                if (settingsResult != null)
                                {
                                    string PushID = "";
                                    try
                                    {
                                        PushID = settingsResult["push_id_2"].ToString();
                                    }
                                    catch (Exception e)
                                    {
                                        Console.WriteLine(e);
                                    }
                                    if (OneSignalNotification.OneSignalAPP_ID == "")
                                    {
                                        OneSignalNotification.OneSignalAPP_ID = PushID;
                                        if (Settings.ShowNotification)
                                        {
                                            OneSignalNotification.RegisterNotificationDevice();
                                        }
                                    }

                                    var(Api_status, Respond) =
                                        await Client.Global.Get_Create_Account(UsernameEditext.Text,
                                                                               PasswordEditext.Text, PasswordRepeatEditext.Text, EmailEditext.Text, UserDetails.Device_ID);

                                    if (Respond.Api_status == 220)
                                    {
                                        var obj = new IMethods.DialogPopup(this);

                                        var x = await obj.ShowDialog("Success",
                                                                     "Registration successful! We have sent you an email, Please check your inbox/spam to verify your email.");

                                        //var data = "";
                                        StartActivity(new Intent(this, typeof(First_Activity)));
                                    }
                                    else if (Api_status == 200)
                                    {
                                        if (Respond is Creat_Account_Object result)
                                        {
                                            WoWonder_API.Client.WebsiteUrl       = st.WebsiteUrl;
                                            Current.CurrentInstance.ServerKey    = st.ServerKey;
                                            Current.CurrentInstance.Access_token = result.access_token;

                                            UserDetails.Username     = UsernameEditext.Text;
                                            UserDetails.Full_name    = UsernameEditext.Text;
                                            UserDetails.Password     = PasswordEditext.Text;
                                            UserDetails.access_token = result.access_token;
                                            UserDetails.User_id      = result.user_id;
                                            UserDetails.Status       = "Active";
                                            UserDetails.Cookie       = result.access_token;
                                            UserDetails.Email        = EmailEditext.Text;

                                            //Insert user data to database
                                            var user = new DataTables.LoginTB
                                            {
                                                UserID       = UserDetails.User_id,
                                                access_token = UserDetails.access_token,
                                                Cookie       = UserDetails.Cookie,
                                                Username     = UsernameEditext.Text,
                                                Password     = PasswordEditext.Text,
                                                Status       = "Active",
                                                Lang         = "",
                                                Device_ID    = UserDetails.Device_ID,
                                            };

                                            Classes.DataUserLoginList.Add(user);

                                            var dbDatabase = new SqLiteDatabase();
                                            dbDatabase.InsertRow(user);
                                            dbDatabase.Dispose();

                                            if (Settings.Show_WalkTroutPage)
                                            {
                                                StartActivity(new Intent(this, typeof(AppIntroWalkTroutPage)));
                                            }
                                            else
                                            {
                                                StartActivity(new Intent(this, typeof(Tabbed_Main_Activity)));

                                                //Get data profile
                                                var data = API_Request.Get_MyProfileData_Api(this).ConfigureAwait(false);
                                            }
                                        }

                                        progressBar.Visibility = ViewStates.Invisible;
                                        Finish();
                                    }
                                    else if (Api_status == 400)
                                    {
                                        var error = Respond as Error_Object;
                                        if (error != null)
                                        {
                                            var errortext = error._errors.Error_text;

                                            var errorid = error._errors.Error_id;

                                            if (errorid == "3")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_3),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "4")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_4),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "5")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_something_went_wrong),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "6")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_6),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "7")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_7),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "8")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_8),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "9")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_9),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "10")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_10),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else if (errorid == "11")
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security),
                                                                                         GetText(Resource.String.Lbl_ErrorRegister_11),
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                            else
                                            {
                                                IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                         GetText(Resource.String.Lbl_Security), errortext,
                                                                                         GetText(Resource.String.Lbl_Ok));
                                            }
                                        }

                                        progressBar.Visibility = ViewStates.Invisible;
                                    }
                                    else if (Api_status == 404)
                                    {
                                        //var Error = Respond.ToString();
                                        progressBar.Visibility = ViewStates.Invisible;
                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Security),
                                                                                 GetText(Resource.String.Lbl_Error_Login), GetText(Resource.String.Lbl_Ok));
                                    }
                                }
                            }
                            else
                            {
                                progressBar.Visibility = ViewStates.Invisible;

                                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                         GetText(Resource.String.Lbl_Error_Register_password),
                                                                         GetText(Resource.String.Lbl_Ok));
                            }
                        }
                    }
                    else
                    {
                        progressBar.Visibility = ViewStates.Invisible;

                        IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                 GetText(Resource.String.Lbl_Please_enter_your_data), GetText(Resource.String.Lbl_Ok));
                    }
                }
                else
                {
                    progressBar.Visibility = ViewStates.Invisible;
                    //IMethods.DialogPopup.Hide_Loading_Dialog(this);
                    IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                             GetText(Resource.String.Lbl_CheckYourInternetConnection), GetText(Resource.String.Lbl_Ok));
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
                progressBar.Visibility = ViewStates.Invisible;
                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), exception.Message,
                                                         GetText(Resource.String.Lbl_Ok));
            }
        }
Ejemplo n.º 6
0
        private void WoDefaultClient_OnPageEventFinished(WebView view, string url)
        {
            try
            {
                swipeRefreshLayout.Refreshing = false;

                Is_RunApi = true;

                //Get My Data
                var data = API_Request.Get_MyProfileData_Api(Activity).ConfigureAwait(false);

                var dbDatabase = new SqLiteDatabase();
                dbDatabase.Get_MyProfile_CredentialList();
                dbDatabase.Dispose();

                var cat = new CategoriesController();
                cat.Get_Categories_Communities();

                if (IMethods.CheckConnectivity())
                {
                    if (Settings.EnableCachSystem)
                    {
                        HybridController.EvaluateJavascript(!LoadCach
                            ? "(function() { return ('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>'); })();"
                            : "Wo_GetNewPosts();");
                    }

                    if (LoadCach)
                    {
                        switch (Settings.Lang)
                        {
                        case "en":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ar":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie);
                            Settings.FlowDirection_RightToLeft = true;
                            break;

                        case "de":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "el":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "es":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "fr":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "it":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ja":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "nl":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "pt":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ro":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ru":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "sq":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "sr":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "tr":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        default:
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie);
                            break;
                        }
                    }

                    if (HybirdView.Visibility != ViewStates.Visible)
                    {
                        HybirdView.Visibility = ViewStates.Visible;
                        News_Empty.Visibility = ViewStates.Gone;
                    }

                    LoadCach = false;
                }

                //Refresh Web Timer
                Timer timer = new Timer();
                if (!timer.Enabled)
                {
                    timer.Interval = Settings.RefreshWebSeconds;
                    timer.Elapsed += TimerOnElapsed;
                    timer.Enabled  = true;
                    timer.Start();
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Ejemplo n.º 7
0
        public async void GetStory_Api()
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                }
                else
                {
                    var(apiStatus, respond) = await Client.Story.Get_Stories();

                    if (apiStatus == 200)
                    {
                        if (respond is Get_Stories_Object result)
                        {
                            if (result.stories.Length > 0)
                            {
                                Classes.StoryList = new Dictionary <List <Get_Stories_Object.Story>, string>(); // Key ListData , Value : user_id
                                Classes.StoryList.Clear();


                                foreach (var story in result.stories)
                                {
                                    List <Get_Stories_Object.Story> listOfStories = new List <Get_Stories_Object.Story>();
                                    var checkUser = StoryAdapter.mStorylList.FirstOrDefault(a => a.user_id == story.user_id);
                                    if (checkUser != null)
                                    {
                                        if (Classes.StoryList == null)
                                        {
                                            continue;
                                        }

                                        var checkUserExits = Classes.StoryList.FirstOrDefault(a => a.Value == checkUser.user_id);
                                        if (checkUserExits.Value == null)
                                        {
                                            var ch = checkUserExits.Key.FirstOrDefault(a => a.id == checkUser.id);
                                            if (ch == null)
                                            {
                                                listOfStories.Add(story);
                                                Classes.StoryList.Add(listOfStories, story.user_id);
                                            }
                                        }
                                        else
                                        {
                                            foreach (var item in Classes.StoryList.Keys.ToList())
                                            {
                                                string userId = item.FirstOrDefault(a => a.user_id == checkUser.user_id)?.user_id;
                                                if (checkUserExits.Value == userId)
                                                {
                                                    var ch = item.FirstOrDefault(a => a.id == story.id);
                                                    if (ch == null)
                                                    {
                                                        item.Add(story);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        StoryAdapter.Add(story);

                                        listOfStories.Clear();

                                        if (Classes.StoryList == null)
                                        {
                                            continue;
                                        }

                                        var checkUserExits = Classes.StoryList.FirstOrDefault(a => a.Value == story.user_id);
                                        if (checkUserExits.Value == null)
                                        {
                                            listOfStories.Add(story);
                                            Classes.StoryList.Add(listOfStories, story.user_id);
                                        }
                                    }
                                }

                                this.Activity.RunOnUiThread(() =>
                                {
                                    StoryAdapter.BindEnd();
                                });
                            }
                        }
                    }
                    else if (apiStatus == 400)
                    {
                        if (respond is Error_Object error)
                        {
                            var errortext = error._errors.Error_text;
                            //Toast.MakeText(this.Context, errortext, ToastLength.Short).Show();

                            if (errortext.Contains("Invalid or expired access_token"))
                            {
                                API_Request.Logout(Activity);
                            }
                        }
                    }
                    else if (apiStatus == 404)
                    {
                        var error = respond.ToString();
                        //Toast.MakeText(this.Context, error, ToastLength.Short).Show();
                    }
                }

                Get_Notifications();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Ejemplo n.º 8
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                var view = MyContextWrapper.GetContentView(Context, Settings.Lang, Resource.Layout.Tab_News_Feed_Layout);
                if (view == null)
                {
                    view = inflater.Inflate(Resource.Layout.Tab_News_Feed_Layout, container, false);
                }

                coordinatorLayout  = (CoordinatorLayout)view.FindViewById(Resource.Id.coordinator_Layout);
                StoryRecylerView   = (RecyclerView)view.FindViewById(Resource.Id.Recyler);
                HybirdView         = (WebView)view.FindViewById(Resource.Id.hybirdview);
                swipeRefreshLayout = (SwipeRefreshLayout)view.FindViewById(Resource.Id.swipeRefreshLayout);
                swipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight,
                                                           Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight,
                                                           Android.Resource.Color.HoloRedLight);
                swipeRefreshLayout.Refreshing = true;
                swipeRefreshLayout.Enabled    = true;

                ScrollView = (NestedScrollView)view.FindViewById(Resource.Id.scroll_View);

                Stories_Layout = (LinearLayout)view.FindViewById(Resource.Id.StoriesLayout);

                News_Empty     = (LinearLayout)view.FindViewById(Resource.Id.News_LinerEmpty);
                News_Icon      = (TextView)view.FindViewById(Resource.Id.News_icon);
                Txt_News_Empty = (TextView)view.FindViewById(Resource.Id.Txt_LabelEmpty);
                Txt_News_start = (TextView)view.FindViewById(Resource.Id.Txt_LabelStart);
                Btn_Reload     = (Button)view.FindViewById(Resource.Id.reloadPage_Button);
                IMethods.Set_TextViewIcon("2", News_Icon, "\uf119");
                News_Empty.Visibility = ViewStates.Gone;

                StoryRecylerView.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Horizontal,
                                                                          false));
                StoryAdapter = new StoryAdapter(Activity);
                StoryRecylerView.SetAdapter(StoryAdapter);
                StoryRecylerView.NestedScrollingEnabled = false;

                if (!Settings.SetTabOnButton)
                {
                    var parasms = (CoordinatorLayout.LayoutParams)swipeRefreshLayout.LayoutParameters;
                    parasms.Gravity = (int)GravityFlags.Top;

                    // Check if we're running on Android 5.0 or higher
                    if ((int)Build.VERSION.SdkInt < 23)
                    {
                        parasms.TopMargin = 100;
                    }
                    else
                    {
                        parasms.TopMargin = 225;
                    }

                    swipeRefreshLayout.LayoutParameters = parasms;
                }

                HybridController = new HybirdViewController(Activity, HybirdView);

                //Set WebView and Load url to be rendered on WebView
                if (!IMethods.CheckConnectivity())
                {
                    if (Settings.EnableCachSystem)
                    {
                        if (File.Exists(IMethods.IPath.FolderDiskPost + "news_feed.html"))
                        {
                            LoadCach = true;
                            HybridController.HybirdView.Settings.CacheMode = CacheModes.CacheElseNetwork;
                            var html = File.ReadAllText(IMethods.IPath.FolderDiskPost + "news_feed.html");
                            //HybridController.HybirdView.LoadData(html, "text/html", null);
                            HybridController.HybirdView.LoadDataWithBaseURL(WoWonder_API.Client.WebsiteUrl, html, "text/html", "utf-8", null);
                        }
                        else
                        {
                            HybirdView.Visibility         = ViewStates.Gone;
                            News_Empty.Visibility         = ViewStates.Visible;
                            swipeRefreshLayout.Refreshing = false;

                            Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News);
                            Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection);
                        }
                    }
                    else
                    {
                        HybirdView.Visibility         = ViewStates.Gone;
                        News_Empty.Visibility         = ViewStates.Visible;
                        swipeRefreshLayout.Refreshing = false;

                        Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News);
                        Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection);
                    }
                }
                else
                {
                    if (Settings.ClearCachSystem)
                    {
                        HybridController.HybirdView.ClearCache(true);
                    }

                    HybirdView.Visibility = ViewStates.Visible;
                    News_Empty.Visibility = ViewStates.Gone;

                    if (Settings.LoadCachedHybirdViewOnFirstLoad)
                    {
                        if (File.Exists(IMethods.IPath.FolderDiskPost + "news_feed.html"))
                        {
                            LoadCach = true;
                            var html = File.ReadAllText(IMethods.IPath.FolderDiskPost + "news_feed.html");
                            //HybridController.HybirdView.LoadData(html, "text/html", null);
                            HybridController.HybirdView.LoadDataWithBaseURL(WoWonder_API.Client.WebsiteUrl + "/get_news_feed", html, "text/html", "utf-8", null);
                        }
                        else
                        {
                            switch (Settings.Lang)
                            {
                            case "en":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "ar":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie);
                                Settings.FlowDirection_RightToLeft = true;
                                break;

                            case "de":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "el":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "es":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "fr":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "it":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "ja":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "nl":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "pt":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "ro":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "ru":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "sq":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "sr":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            case "tr":
                                HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie);
                                break;

                            default:
                                HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie);
                                break;
                            }
                        }
                    }
                    else
                    {
                        switch (Settings.Lang)
                        {
                        case "en":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ar":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie);
                            Settings.FlowDirection_RightToLeft = true;
                            break;

                        case "de":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "el":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "es":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "fr":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "it":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ja":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "nl":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "pt":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ro":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "ru":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "sq":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "sr":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        case "tr":
                            HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie);
                            break;

                        default:
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie);
                            break;
                        }
                    }
                }

                if (Settings.Show_Story)
                {
                    Stories_Layout.Visibility = ViewStates.Visible;
                    GetStory_Api();
                }
                else
                {
                    Stories_Layout.Visibility = ViewStates.Gone;
                    Get_Notifications();
                }

                return(view);
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
                return(null);
            }
        }
Ejemplo n.º 9
0
        //Event Refresh Data Page
        private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e)
        {
            try
            {
                if (IMethods.CheckConnectivity())
                {
                    if (Settings.Show_Story)
                    {
                        StoryAdapter.Clear();
                        Stories_Layout.Visibility = ViewStates.Visible;
                        GetStory_Api();
                    }
                    else
                    {
                        Stories_Layout.Visibility = ViewStates.Gone;
                        Get_Notifications();
                    }

                    switch (Settings.Lang)
                    {
                    case "en":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=english" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ar":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=arabic" + "&type=set_c&c=" + UserDetails.Cookie);
                        Settings.FlowDirection_RightToLeft = true;
                        break;

                    case "de":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=german" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "el":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=greek" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "es":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=spanish" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "fr":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=french" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "it":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=italian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ja":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=japanese" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "nl":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=dutch" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "pt":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=portuguese" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ro":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=romanian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "ru":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=russian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "sq":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=albanian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "sr":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=serbian" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    case "tr":
                        HybridController.LoadUrl(WoWonder_API.Client.WebsiteUrl + "/app_api.php?application=phone" + "&lang=turkish" + "&type=set_c&c=" + UserDetails.Cookie);
                        break;

                    default:
                        HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Cookie + UserDetails.Cookie);
                        break;
                    }
                }
                else
                {
                    Toast.MakeText(Activity, Activity.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                }
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Ejemplo n.º 10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                if ((int)Build.VERSION.SdkInt >= 23)
                {
                    Window.AddFlags(WindowManagerFlags.LayoutNoLimits);
                    Window.AddFlags(WindowManagerFlags.TranslucentNavigation);
                }

                base.OnCreate(savedInstanceState);

                IMethods.IApp.FullScreenApp(this);
                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.EventView_Layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.EventView_Layout);
                }

                News_Empty     = (LinearLayout)FindViewById(Resource.Id.News_LinerEmpty);
                News_Icon      = (TextView)FindViewById(Resource.Id.News_icon);
                Txt_News_Empty = (TextView)FindViewById(Resource.Id.Txt_LabelEmpty);
                Txt_News_start = (TextView)FindViewById(Resource.Id.Txt_LabelStart);
                Btn_Reload     = (Button)FindViewById(Resource.Id.reloadPage_Button);
                IMethods.Set_TextViewIcon("2", News_Icon, "\uf119");
                News_Empty.Visibility = ViewStates.Gone;

                Txt_Name       = FindViewById <TextView>(Resource.Id.tvName_ptwo);
                IconGoing      = FindViewById <TextView>(Resource.Id.IconGoing);
                Txt_Going      = FindViewById <TextView>(Resource.Id.GoingTextview);
                IconInterested = FindViewById <TextView>(Resource.Id.IconInterested);
                Txt_Interested = FindViewById <TextView>(Resource.Id.InterestedTextview);
                Txt_StartDate  = FindViewById <TextView>(Resource.Id.txtStartDate);
                Txt_EndDate    = FindViewById <TextView>(Resource.Id.txtEndDate);

                IconLocation    = FindViewById <TextView>(Resource.Id.IconLocation);
                Txt_Location    = FindViewById <TextView>(Resource.Id.LocationTextview);
                Txt_Description = FindViewById <TextView>(Resource.Id.tv_aboutdescUser);

                HybirdView = (WebView)FindViewById(Resource.Id.hybirdview);

                ImageEventCover = FindViewById <ImageViewAsync>(Resource.Id.EventCover);
                IconBack        = FindViewById <ImageView>(Resource.Id.back);

                Btn_Go        = FindViewById <Button>(Resource.Id.ButtonGoing);
                Btn_Intersted = FindViewById <Button>(Resource.Id.ButtonIntersted);

                FloatingActionButtonView = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButtonView);

                IMethods.Set_TextViewIcon("1", IconGoing, IonIcons_Fonts.IosPeople);
                IMethods.Set_TextViewIcon("1", IconInterested, IonIcons_Fonts.AndroidStar);
                IMethods.Set_TextViewIcon("1", IconLocation, IonIcons_Fonts.Location);

                var mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
                mapFragment.GetMapAsync(this);

                //Set to event id to load the news feed
                HybridController = new HybirdViewController(this, HybirdView, null);

                Get_Data_Event();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Ejemplo n.º 11
0
        private void Get_Data_Event()
        {
            try
            {
                _Event_Data = JsonConvert.DeserializeObject <Get_Events_Object.Event>(Intent.GetStringExtra("EventView"));
                if (_Event_Data != null)
                {
                    var CoverSplit     = _Event_Data.cover.Split('/').Last();
                    var getImage_Cover =
                        IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskEvent, CoverSplit);
                    if (getImage_Cover != "File Dont Exists")
                    {
                        ImageServiceLoader.Load_Image(ImageEventCover, "ImagePlacholder.jpg", getImage_Cover);
                    }
                    else
                    {
                        IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskEvent,
                                                                      _Event_Data.cover);
                        ImageServiceLoader.Load_Image(ImageEventCover, "ImagePlacholder.jpg", _Event_Data.cover);
                    }

                    Txt_Name.Text = _Event_Data.name;

                    Txt_Going.Text      = _Event_Data.going_count + " " + GetText(Resource.String.Lbl_GoingPeople);
                    Txt_Interested.Text = _Event_Data.interested_count + " " +
                                          GetText(Resource.String.Lbl_InterestedPeople);
                    Txt_Location.Text = _Event_Data.location;

                    Txt_StartDate.Text = _Event_Data.start_date;
                    Txt_EndDate.Text   = _Event_Data.end_date;

                    var Description =
                        IMethods.Fun_String.DecodeString(
                            IMethods.Fun_String.DecodeStringWithEnter(_Event_Data.description));

                    var readMoreOption = new ReadMoreOption.Builder(this)
                                         .TextLength(250)
                                         .MoreLabel(GetText(Resource.String.Lbl_ReadMore))
                                         .LessLabel(GetText(Resource.String.Lbl_ReadLess))
                                         .MoreLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LessLabelColor(Color.ParseColor(Settings.MainColor))
                                         .LabelUnderLine(true)
                                         .Build();
                    readMoreOption.AddReadMoreTo(Txt_Description, Description);

                    if (_Event_Data.is_going)
                    {
                        Btn_Go.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        Btn_Go.SetTextColor(Color.ParseColor("#ffffff"));
                        Btn_Go.Text = GetText(Resource.String.Lbl_Going);
                        Btn_Go.Tag  = "true";
                    }
                    else
                    {
                        Btn_Go.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        Btn_Go.SetTextColor(Color.ParseColor(Settings.MainColor));
                        Btn_Go.Text = GetText(Resource.String.Lbl_Go);
                        Btn_Go.Tag  = "false";
                    }

                    if (_Event_Data.is_interested)
                    {
                        Btn_Intersted.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed);
                        Btn_Intersted.SetTextColor(Color.ParseColor("#ffffff"));
                        Btn_Intersted.Text = GetText(Resource.String.Lbl_Interested);
                        Btn_Intersted.Tag  = "true";
                    }
                    else
                    {
                        Btn_Intersted.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends);
                        Btn_Intersted.SetTextColor(Color.ParseColor(Settings.MainColor));
                        Btn_Intersted.Text = GetText(Resource.String.Lbl_Interested);
                        Btn_Intersted.Tag  = "false";
                    }

                    //Set WebView and Load url to be rendered on WebView
                    if (!IMethods.CheckConnectivity())
                    {
                        HybirdView.Visibility = ViewStates.Gone;
                        News_Empty.Visibility = ViewStates.Visible;

                        Txt_News_Empty.Text = GetText(Resource.String.Lbl_Empty_News);
                        Txt_News_start.Text = GetText(Resource.String.Lbl_CheckYourInternetConnection);
                    }
                    else
                    {
                        HybirdView.Visibility = ViewStates.Visible;
                        News_Empty.Visibility = ViewStates.Gone;

                        if (Settings.ClearCachSystem)
                        {
                            HybridController.HybirdView.ClearCache(true);
                        }

                        if (Settings.FlowDirection_RightToLeft)
                        {
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Event + _Event_Data.id +
                                                     "&lang=arabic");
                        }
                        else
                        {
                            HybridController.LoadUrl(Current.URLS.UrlInstance.API_Get_News_Feed_Event + _Event_Data.id);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }
Ejemplo n.º 12
0
        //Click Button Login
        private async void BtnLoginOnClick(object sender, EventArgs eventArgs)
        {
            try
            {
                if (!IMethods.CheckConnectivity())
                {
                    IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                             GetText(Resource.String.Lbl_CheckYourInternetConnection), GetText(Resource.String.Lbl_Ok));
                }
                else
                {
                    if (!string.IsNullOrEmpty(mEditTextEmail.Text) || !string.IsNullOrEmpty(mEditTextPassword.Text))
                    {
                        Current.CurrentInstance.SetWebsiteURL(st.WebsiteUrl, st.ServerKey);

                        progressBar.Visibility       = ViewStates.Visible;
                        mButtonViewSignIn.Visibility = ViewStates.Gone;

                        var settingsResult = await Current.GetWoWonder_Settings(st, "WoWonder_Native_Android");

                        if (settingsResult != null)
                        {
                            string PushID = "";
                            try
                            {
                                PushID = settingsResult["push_id_2"].ToString();
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e);
                            }
                            if (OneSignalNotification.OneSignalAPP_ID == "")
                            {
                                OneSignalNotification.OneSignalAPP_ID = PushID;
                                if (Settings.ShowNotification)
                                {
                                    OneSignalNotification.RegisterNotificationDevice();
                                }
                            }

                            var(Api_status, Respond) = await Client.Global.Get_Auth(st, mEditTextEmail.Text, mEditTextPassword.Text, "UTC", UserDetails.Device_ID);

                            if (Api_status == 200)
                            {
                                if (Respond is Auth_Object auth)
                                {
                                    WoWonder_API.Client.WebsiteUrl       = st.WebsiteUrl;
                                    Current.CurrentInstance.ServerKey    = st.ServerKey;
                                    Current.CurrentInstance.Access_token = auth.access_token;

                                    UserDetails.Username     = mEditTextEmail.Text;
                                    UserDetails.Full_name    = mEditTextEmail.Text;
                                    UserDetails.Password     = mEditTextPassword.Text;
                                    UserDetails.access_token = auth.access_token;
                                    UserDetails.User_id      = auth.user_id;
                                    UserDetails.Status       = "Active";
                                    UserDetails.Cookie       = auth.access_token;
                                    UserDetails.Email        = mEditTextEmail.Text;

                                    //Insert user data to database
                                    var user = new DataTables.LoginTB
                                    {
                                        UserID       = UserDetails.User_id,
                                        access_token = UserDetails.access_token,
                                        Cookie       = UserDetails.Cookie,
                                        Username     = mEditTextEmail.Text,
                                        Password     = mEditTextPassword.Text,
                                        Status       = "Active",
                                        Lang         = "",
                                        Device_ID    = UserDetails.Device_ID,
                                    };
                                    Classes.DataUserLoginList.Add(user);

                                    var dbDatabase = new SqLiteDatabase();
                                    dbDatabase.InsertRow(user);
                                    dbDatabase.Dispose();

                                    if (Settings.Show_WalkTroutPage)
                                    {
                                        StartActivity(new Intent(this, typeof(AppIntroWalkTroutPage)));
                                    }
                                    else
                                    {
                                        StartActivity(new Intent(this, typeof(Tabbed_Main_Activity)));

                                        //Get data profile
                                        var data = API_Request.Get_MyProfileData_Api(this).ConfigureAwait(false);
                                    }

                                    progressBar.Visibility       = ViewStates.Gone;
                                    mButtonViewSignIn.Visibility = ViewStates.Visible;
                                    Finish();
                                }
                            }
                            else if (Api_status == 400)
                            {
                                var error = Respond as Error_Object;
                                if (error != null)
                                {
                                    var errortext = error._errors.Error_text;
                                    var errorid   = error._errors.Error_id;
                                    if (errorid == "3")
                                    {
                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Security),
                                                                                 GetText(Resource.String.Lbl_ErrorLogin_3), GetText(Resource.String.Lbl_Ok));
                                    }
                                    else if (errorid == "4")
                                    {
                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Security),
                                                                                 GetText(Resource.String.Lbl_ErrorLogin_4), GetText(Resource.String.Lbl_Ok));
                                    }
                                    else if (errorid == "5")
                                    {
                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Security),
                                                                                 GetText(Resource.String.Lbl_ErrorLogin_5), GetText(Resource.String.Lbl_Ok));
                                    }
                                    else
                                    {
                                        IMethods.DialogPopup.InvokeAndShowDialog(this,
                                                                                 GetText(Resource.String.Lbl_Security), errortext,
                                                                                 GetText(Resource.String.Lbl_Ok));
                                    }
                                }

                                progressBar.Visibility       = ViewStates.Gone;
                                mButtonViewSignIn.Visibility = ViewStates.Visible;
                            }
                            else if (Api_status == 404)
                            {
                                //var Error = Respond.ToString();
                                progressBar.Visibility       = ViewStates.Gone;
                                mButtonViewSignIn.Visibility = ViewStates.Visible;
                                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                         GetText(Resource.String.Lbl_Error_Login), GetText(Resource.String.Lbl_Ok));
                            }
                        }
                    }
                    else
                    {
                        progressBar.Visibility       = ViewStates.Gone;
                        mButtonViewSignIn.Visibility = ViewStates.Visible;
                        IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security),
                                                                 GetText(Resource.String.Lbl_Please_enter_your_data), GetText(Resource.String.Lbl_Ok));
                    }
                }
            }
            catch (Exception exception)
            {
                progressBar.Visibility       = ViewStates.Gone;
                mButtonViewSignIn.Visibility = ViewStates.Visible;
                IMethods.DialogPopup.InvokeAndShowDialog(this, GetText(Resource.String.Lbl_Security), exception.Message,
                                                         GetText(Resource.String.Lbl_Ok));
                Crashes.TrackError(exception);
            }
        }