示例#1
0
        private async void OnLoginButtonClicked(object sender, EventArgs e)
        {
            var authProvider = new FirebaseAuthProvider(new FirebaseConfig(Constants.WebAPIkey));

            try
            {
                var auth = await authProvider.SignInWithEmailAndPasswordAsync(emailEntry.Text, passwordEntry.Text);

                var content = await auth.GetFreshAuthAsync();

                var serializedcontent = JsonConvert.SerializeObject(content);
                Preferences.Set("MyFirebaseRefreshToken", serializedcontent);
                await Navigation.PushAsync(new DashboardPage());

                Amplitude.InstanceFor(Constants.userId, Constants.userProperties).Track("login");

                // texonomy 이벤트 이름 자체를 어떻게 정의
                // 이벤트 아래에 패러미터 - 구조?
                //
            }
            catch (Exception)
            {
                await Application.Current.MainPage.DisplayAlert("Alert", "Invalid useremail or password", "OK");
            }
        }
示例#2
0
        private void OnLogoutButtonClicked(object sender, EventArgs e)
        {
            Preferences.Remove("MyFirebaseRefreshToken");

            Amplitude.InstanceFor(Constants.userId, Constants.userProperties).Track("logout");

            Application.Current.MainPage = new NavigationPage(new LoginPage());
        }
        public App()
        {
            InitializeComponent();

            Amplitude.Initialize(Constants.api_key);
            Amplitude.InstanceFor(Constants.userId, Constants.userProperties).StartSession();


            Amplitude.InstanceFor(Constants.userId, Constants.userProperties).Track("start");

            MainPage = new NavigationPage(new LoginPage());
        }
示例#4
0
        private async void OnSignUpButtonClicked(object sender, EventArgs e)
        {
            try
            {
                var authProvider = new FirebaseAuthProvider(new FirebaseConfig(Constants.WebAPIkey));
                var auth         = await authProvider.CreateUserWithEmailAndPasswordAsync(emailEntry.Text, passwordEntry.Text);

                string gettoken = auth.FirebaseToken;
                await Application.Current.MainPage.DisplayAlert("Alert", gettoken, "Ok");

                Amplitude.InstanceFor(Constants.userId, Constants.userProperties).Track("sign up");
            }
            catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Alert", ex.Message, "OK");
            }
        }