コード例 #1
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            FirebaseManager.Configure();

            App.Initialize();

            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            #endif

            GoogleUserInfo userInfo = GoogleUserInfo.ReadFromDevice().Result;

            if (userInfo != null)
            {
                var mainStoryboard   = UIStoryboard.FromName("Main", null);
                var tabBarController = mainStoryboard.InstantiateViewController("tabViewController") as TabBarController;

                var navigationController = tabBarController.ViewControllers[0] as UINavigationController;
                var homeViewController   = navigationController.ViewControllers[0] as HomeViewController;

                homeViewController.ViewModel = new ViewModels.HomeViewModel(userInfo.GivenName);

                // Set the tab bar controller as root
                Window.RootViewController = tabBarController;
            }

            return(true);
        }
コード例 #2
0
        private void OnGoogleLoginButtonClicked(object sender, EventArgs e)
        {
            var googleToken = GoogleOAuthToken.ReadFromDevice().Result;
            var userInfo    = GoogleUserInfo.ReadFromDevice().Result;

            if (googleToken == null || userInfo == null)
            {
                var authenticator  = Auth.GetAuthenticator();
                var viewController = authenticator.GetUI();
                PresentViewController(viewController, true, null);
            }
            else
            {
                PerformSegueToHome(userInfo.GivenName);
            }
        }