Example #1
0
 public static void Init(UIKit.UIApplication app, Foundation.NSDictionary launchOptions)
 {
     FacebookApi.IsUsingNative = true;
     fb.CoreKit.ApplicationDelegate.SharedInstance.FinishedLaunching(app, launchOptions);
     FacebookApi.ShowFacebookAuthenticator = (a) => invoker.BeginInvokeOnMainThread(() => Login(a));
     Native.RegisterCallBack("facebook", Callback);
 }
Example #2
0
        public static void Init()
        {
            TwitterApi.IsUsingNative = true;

            TwitterApi.ShowTwitterAuthenticator = (a, fallback) => invoker.BeginInvokeOnMainThread(() => Login(a, fallback));
            Native.RegisterCallBack("twitter", Callback);
        }
Example #3
0
        public static void ShowAuthenticator(UIViewController presentingController, WebAuthenticator authenticator)
        {
            var urls = GetCFBundleURLSchemes();

            if (!urls.Any())
            {
                authenticator.OnError(CFBundleUrlError);
                return;
            }

            //TODO: validate the proper url is in there

            var invoker = new Foundation.NSObject();

            invoker.BeginInvokeOnMainThread(async() => await BeginAuthentication(presentingController, authenticator));
        }
Example #4
0
        public OAuthPasswordApi(string identifier, string clientId, string clientSecret, string serverUrl, string tokenUrl, string refreshUrl) : base(identifier, clientId, clientSecret, tokenUrl, refreshUrl)
        {
            BaseAddress = new Uri(serverUrl);
            Scopes      = new [] { "null" };

#if __IOS__
            CurrentShowAuthenticator = (auth) =>
            {
                var invoker = new Foundation.NSObject();
                invoker.BeginInvokeOnMainThread(() =>
                {
                    var controller = new BasicAuthController(auth);
                    controller.Show();
                });
            };
#endif
        }
Example #5
0
        public static void ShowAuthenticator(WebAuthenticator authenticator)
        {
            var invoker = new Foundation.NSObject();

            invoker.BeginInvokeOnMainThread(() => {
                var window = UIKit.UIApplication.SharedApplication.KeyWindow;
                var root   = window.RootViewController;
                if (root != null)
                {
                    var current = root;
                    while (current.PresentedViewController != null)
                    {
                        current = current.PresentedViewController;
                    }
                    ShowAuthenticator(current, authenticator);
                }
            });
        }
Example #6
0
		public OAuthPasswordApi (string identifier, string clientId, string clientSecret, string serverUrl, string tokenUrl, string refreshUrl) : base (identifier, clientId, clientSecret, tokenUrl, refreshUrl)
		{
			BaseAddress = new Uri (serverUrl);
			Scopes = new [] { "null" };

#if __IOS__
		    CurrentShowAuthenticator = (auth) =>
		    {
				var invoker = new Foundation.NSObject();
				invoker.BeginInvokeOnMainThread(() =>
				{
					var controller = new BasicAuthController(auth);
					controller.Show();
				});
				
            };
#endif
		}
        public static void ShowAuthenticator(UIViewController presentingController, WebAuthenticator authenticator)
        {
            //ios 11 uses sfAuthenticationSession which doesn't require registered URL in info.plist
            if (!UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                var urls = GetCFBundleURLSchemes();
                if (!urls.Any())
                {
                    authenticator.OnError(CFBundleUrlError);
                    return;
                }
                //TODO: validate the proper url is in there
            }

            var invoker = new Foundation.NSObject();

            invoker.BeginInvokeOnMainThread(async() => await BeginAuthentication(presentingController, authenticator));
        }