Пример #1
0
		static OAuthApi ()
		{
			//Setup default ShowAuthenticator
			#if __IOS__
			OAuthApi.ShowAuthenticator = (authenticator) => {
				var invoker = new Foundation.NSObject ();
				invoker.BeginInvokeOnMainThread (() => {
					var vc = new iOS.WebAuthenticatorViewController (authenticator);
					var window = UIKit.UIApplication.SharedApplication.KeyWindow;
					var root = window.RootViewController;
					if (root != null) {
						var current = root;
						while (current.PresentedViewController != null) {
							current = current.PresentedViewController;
						}
						current.PresentViewControllerAsync (new UIKit.UINavigationController (vc), true);
					}
				});
			};

			#elif __ANDROID__
			OAuthApi.ShowAuthenticator = (authenticator) =>
			{
				var context = Android.App.Application.Context;
				var i = new global::Android.Content.Intent(context, typeof(WebAuthenticatorActivity));
				var state = new WebAuthenticatorActivity.State
				{
					Authenticator = authenticator,
				};
				i.SetFlags(Android.Content.ActivityFlags.NewTask);
				i.PutExtra("StateKey", WebAuthenticatorActivity.StateRepo.Add(state));
				context.StartActivity(i);
			};
			#elif __OSX__
			OAuthApi.ShowAuthenticator = (authenticator) =>
			{
				var invoker = new Foundation.NSObject();
				invoker.BeginInvokeOnMainThread(() =>
				{
					var vc = new SimpleAuth.Mac.WebAuthenticatorWebView(authenticator);
					SimpleAuth.Mac.WebAuthenticatorWebView.ShowWebivew(vc);
				});
			};

            #elif WINDOWS_UWP
			OAuthApi.ShowAuthenticator = async (authenticator) =>
			{
				await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
				{
					var vc = new SimpleAuth.UWP.WebAuthenticatorWebView(authenticator);
					await vc.ShowAsync();
				});
			};

			#endif
		}
Пример #2
0
		protected OAuthApi(string identifier, string clientId, string clientSecret, HttpMessageHandler handler = null) : base(identifier, handler)
		{
			this.ClientId = clientId;
			this.ClientSecret = clientSecret;
#if __IOS__
			Api.ShowAuthenticator = (authenticator) =>
			{
				var invoker = new Foundation.NSObject();
				invoker.BeginInvokeOnMainThread(() =>
				{
					var vc = new iOS.WebAuthenticator(authenticator);
					var window = UIKit.UIApplication.SharedApplication.KeyWindow;
					var root = window.RootViewController;
					if (root != null)
					{
						var current = root;
						while (current.PresentedViewController != null)
						{
							current = current.PresentedViewController;
						}
						current.PresentViewControllerAsync(new UIKit.UINavigationController(vc), true);
					}
				});
			};

#elif __ANDROID__
			Api.ShowAuthenticator = (authenticator) =>
			{
				var context = Android.App.Application.Context;
				var i = new global::Android.Content.Intent(context, typeof(WebAuthenticatorActivity));
				var state = new WebAuthenticatorActivity.State
				{
					Authenticator = authenticator,
				};
				i.SetFlags(Android.Content.ActivityFlags.NewTask);
				i.PutExtra("StateKey", WebAuthenticatorActivity.StateRepo.Add(state));
				context.StartActivity(i);
			};
#elif __OSX__
			Api.ShowAuthenticator = (authenticator) =>
			{
				var invoker = new Foundation.NSObject();
				invoker.BeginInvokeOnMainThread(() =>
				{
					var vc = new SimpleAuth.Mac.WebAuthenticator(authenticator);
					SimpleAuth.Mac.WebAuthenticator.ShowWebivew(vc);
				});
			};
#endif


		}
Пример #3
0
 public override void InvokeOnMainThread(ObjCRuntime.Selector sel, Foundation.NSObject obj)
 {
 }
 partial void TapTransformation(Foundation.NSObject sender)
 {
     LoadImage();
 }
Пример #5
0
 public static override void SetDefaultPlaceholder(Foundation.NSObject placeholder, Foundation.NSObject marker, Foundation.NSString binding)
 {
 }
Пример #6
0
 public virtual override void SetValueForUndefinedKey(Foundation.NSObject value, Foundation.NSString undefinedKey)
 {
 }
Пример #7
0
 public virtual override Foundation.NSObject PerformSelector(ObjCRuntime.Selector aSelector, Foundation.NSObject object1, Foundation.NSObject object2)
 {
     throw new NotImplementedException();
 }
Пример #8
0
 public virtual override void RemoveObserver(Foundation.NSObject observer, Foundation.NSString keyPath)
 {
 }
Пример #9
0
 public override void AddObserver(Foundation.NSObject observer, string keyPath, Foundation.NSKeyValueObservingOptions options, IntPtr context)
 {
 }
Пример #10
0
 public virtual override void PerformSelector(ObjCRuntime.Selector selector, Foundation.NSObject withObject, double delay)
 {
 }
Пример #11
0
 public virtual override nint IndexOfItem(Foundation.NSObject obj)
 {
     throw new NotImplementedException();
 }
Пример #12
0
 public virtual override nint IndexOfItem(Foundation.NSObject target, ObjCRuntime.Selector actionSelector)
 {
     throw new NotImplementedException();
 }
Пример #13
0
 public static override Foundation.NSObject CreateElement(Foundation.NSString role, CoreGraphics.CGRect frame, Foundation.NSString label, Foundation.NSObject parent)
 {
     throw new NotImplementedException();
 }
Пример #14
0
 partial void ShowAlert(Foundation.NSObject sender)
 {
     // Display the given alert
     AlertUser();
 }
Пример #15
0
 partial void AlertSelectionChanged(Foundation.NSObject sender)
 {
     // Change the alert title
     SetAlertTitle();
 }
 public static void SafeInvokeOnMainThread(this Foundation.NSObject nsObject, Action action, Action <Exception> failureAction = null)
 {
     nsObject.InvokeOnMainThread(() => SafeInvoke(((Exception error) => LogUtils.Error(error)), failureAction, action));
 }
Пример #17
0
 public override void Bind(Foundation.NSString binding, Foundation.NSObject observable, string keyPath, Foundation.NSDictionary options)
 {
 }
Пример #18
0
 public virtual override void PerformSelector(ObjCRuntime.Selector selector, Foundation.NSObject withObject, double afterDelay, Foundation.NSString[] nsRunLoopModes)
 {
 }
Пример #19
0
 public static override void CancelPreviousPerformRequest(Foundation.NSObject aTarget)
 {
 }
Пример #20
0
 public virtual override void PerformSelector(ObjCRuntime.Selector selector, Foundation.NSThread onThread, Foundation.NSObject withObject, bool waitUntilDone, Foundation.NSString[] nsRunLoopModes)
 {
 }
Пример #21
0
 public static override void CancelPreviousPerformRequest(Foundation.NSObject aTarget, ObjCRuntime.Selector selector, Foundation.NSObject argument)
 {
 }
Пример #22
0
 public override void RemoveObserver(Foundation.NSObject observer, string keyPath, IntPtr context)
 {
 }
Пример #23
0
 public virtual override void CommitEditing(Foundation.NSObject objDelegate, ObjCRuntime.Selector didCommitSelector, IntPtr contextInfo)
 {
 }
Пример #24
0
 public override void RemoveObserver(Foundation.NSObject observer, string keyPath)
 {
 }
Пример #25
0
 public static override Foundation.NSObject GetDefaultPlaceholder(Foundation.NSObject marker, Foundation.NSString binding)
 {
     throw new NotImplementedException();
 }
Пример #26
0
 public virtual override void SetValueForKeyPath(Foundation.NSObject value, Foundation.NSString keyPath)
 {
 }
Пример #27
0
 public virtual override bool IsEqual(Foundation.NSObject anObject)
 {
     throw new NotImplementedException();
 }
Пример #28
0
 public override void SetNativeField(string name, Foundation.NSObject value)
 {
 }
 public void DeleteTags (IList<string> keys)
 {
    Foundation.NSObject[] objs = new Foundation.NSObject[keys.Count];
    for (int i = 0; i < keys.Count; i++)
    {
       objs [i] = (Foundation.NSString)keys[i];
    }
    iOS.OneSignal.DeleteTags (objs);
 }
Пример #30
0
 public virtual override bool Equals(Foundation.NSObject obj)
 {
     throw new NotImplementedException();
 }
Пример #31
0
 public virtual override void ObserveValue(Foundation.NSString keyPath, Foundation.NSObject ofObject, Foundation.NSDictionary change, IntPtr context)
 {
 }
Пример #32
0
 public virtual override void ObjectDidEndEditing(Foundation.NSObject editor)
 {
 }
Пример #33
0
 partial void onSimple(Foundation.NSObject sender)
 {
     this.PerformSegue("Simple", this);
 }