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 }
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 }
public override void InvokeOnMainThread(ObjCRuntime.Selector sel, Foundation.NSObject obj) { }
partial void TapTransformation(Foundation.NSObject sender) { LoadImage(); }
public static override void SetDefaultPlaceholder(Foundation.NSObject placeholder, Foundation.NSObject marker, Foundation.NSString binding) { }
public virtual override void SetValueForUndefinedKey(Foundation.NSObject value, Foundation.NSString undefinedKey) { }
public virtual override Foundation.NSObject PerformSelector(ObjCRuntime.Selector aSelector, Foundation.NSObject object1, Foundation.NSObject object2) { throw new NotImplementedException(); }
public virtual override void RemoveObserver(Foundation.NSObject observer, Foundation.NSString keyPath) { }
public override void AddObserver(Foundation.NSObject observer, string keyPath, Foundation.NSKeyValueObservingOptions options, IntPtr context) { }
public virtual override void PerformSelector(ObjCRuntime.Selector selector, Foundation.NSObject withObject, double delay) { }
public virtual override nint IndexOfItem(Foundation.NSObject obj) { throw new NotImplementedException(); }
public virtual override nint IndexOfItem(Foundation.NSObject target, ObjCRuntime.Selector actionSelector) { throw new NotImplementedException(); }
public static override Foundation.NSObject CreateElement(Foundation.NSString role, CoreGraphics.CGRect frame, Foundation.NSString label, Foundation.NSObject parent) { throw new NotImplementedException(); }
partial void ShowAlert(Foundation.NSObject sender) { // Display the given alert AlertUser(); }
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)); }
public override void Bind(Foundation.NSString binding, Foundation.NSObject observable, string keyPath, Foundation.NSDictionary options) { }
public virtual override void PerformSelector(ObjCRuntime.Selector selector, Foundation.NSObject withObject, double afterDelay, Foundation.NSString[] nsRunLoopModes) { }
public static override void CancelPreviousPerformRequest(Foundation.NSObject aTarget) { }
public virtual override void PerformSelector(ObjCRuntime.Selector selector, Foundation.NSThread onThread, Foundation.NSObject withObject, bool waitUntilDone, Foundation.NSString[] nsRunLoopModes) { }
public static override void CancelPreviousPerformRequest(Foundation.NSObject aTarget, ObjCRuntime.Selector selector, Foundation.NSObject argument) { }
public override void RemoveObserver(Foundation.NSObject observer, string keyPath, IntPtr context) { }
public virtual override void CommitEditing(Foundation.NSObject objDelegate, ObjCRuntime.Selector didCommitSelector, IntPtr contextInfo) { }
public override void RemoveObserver(Foundation.NSObject observer, string keyPath) { }
public static override Foundation.NSObject GetDefaultPlaceholder(Foundation.NSObject marker, Foundation.NSString binding) { throw new NotImplementedException(); }
public virtual override void SetValueForKeyPath(Foundation.NSObject value, Foundation.NSString keyPath) { }
public virtual override bool IsEqual(Foundation.NSObject anObject) { throw new NotImplementedException(); }
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); }
public virtual override bool Equals(Foundation.NSObject obj) { throw new NotImplementedException(); }
public virtual override void ObserveValue(Foundation.NSString keyPath, Foundation.NSObject ofObject, Foundation.NSDictionary change, IntPtr context) { }
public virtual override void ObjectDidEndEditing(Foundation.NSObject editor) { }
partial void onSimple(Foundation.NSObject sender) { this.PerformSegue("Simple", this); }