Inheritance: Foundation.NSObject
        public async Task AuthWithGoogleTokenAsync(SignIn signIn, GoogleUser user, Foundation.NSError error)
        {
            try {
                if (error == null)
                {
                    IsAuthenticating = true;

                    var token       = user.Authentication.AccessToken;
                    var authManager = ServiceContainer.Resolve <AuthManager> ();
                    var authRes     = await authManager.SignupWithGoogleAsync(token);

                    // No need to keep the users Google account access around anymore
                    signIn.DisconnectUser();

                    if (authRes != AuthResult.Success)
                    {
                        var email = user.Profile.Email;
                        AuthErrorAlert.Show(this, email, authRes, AuthErrorAlert.Mode.Signup, googleAuth: true);
                    }
                }
                else if (error.Code != -5)     // Cancel error code.
                {
                    new UIAlertView(
                        "WelcomeGoogleErrorTitle".Tr(),
                        "WelcomeGoogleErrorMessage".Tr(),
                        null, "WelcomeGoogleErrorOk".Tr(), null).Show();
                }
            } catch (InvalidOperationException ex) {
                var log = ServiceContainer.Resolve <ILogger> ();
                log.Info(Tag, ex, "Failed to authenticate (G+) the user.");
            } finally {
                IsAuthenticating = false;
            }
        }
        private void HandleAuthResultHandlerSignUp(AuthDataResult data, Foundation.NSError error)
        {
            if (error != null)
            {
                AuthErrorCode errorCode;
                if (IntPtr.Size == 8) // 64 bits devices
                {
                    errorCode = (AuthErrorCode)((long)error.Code);
                }
                else // 32 bits devices
                {
                    errorCode = (AuthErrorCode)((int)error.Code);
                }

                // Posible error codes that CreateUser method could throw
                switch (errorCode)
                {
                case AuthErrorCode.InvalidEmail:
                case AuthErrorCode.EmailAlreadyInUse:
                case AuthErrorCode.OperationNotAllowed:
                case AuthErrorCode.WeakPassword:
                default:
                    signUpResult   = false;
                    hasLoginResult = true;
                    break;
                }
            }
            else
            {
                signUpResult   = true;
                hasLoginResult = true;
            }
            tokenSource.Cancel();
        }
Exemple #3
0
 public NSError(ErrorCode code, Foundation.NSError error) :
     base(new NSString(ErrorDomain),
          new nint((int)code),
          NSDictionary.FromObjectsAndKeys(
              new NSObject[] { error, new NSString(error.LocalizedDescription) },
              new NSObject[] { new NSString("error"), LocalizedDescriptionKey }))
 {
 }
Exemple #4
0
        private Foundation.NSFileAttributes GetAttributesReturnsSymLink(string path, out Foundation.NSError error)
        {
            error = new NSError();

            return(new NSFileAttributes
            {
                Type = NSFileType.SymbolicLink
            });
        }
Exemple #5
0
 private void HandleAuthResultLoginHandler(User user, Foundation.NSError error)
 {
     if (error != null)
     {
         loginResult    = false;
         hasLoginResult = true;
     }
     else
     {
         loginResult    = true;
         hasLoginResult = true;
     }
     tokenSource.Cancel();
 }
        private void HandleAuthResultLoginHandler(AuthDataResult data, Foundation.NSError error)
        {
            if (error != null)
            {
                AuthErrorCode errorCode;
                if (IntPtr.Size == 8) // 64 bits devices
                {
                    errorCode = (AuthErrorCode)((long)error.Code);
                }
                else // 32 bits devices
                {
                    errorCode = (AuthErrorCode)((int)error.Code);
                }

                // Posible error codes that SignIn method with email and password could throw
                // Visit https://firebase.google.com/docs/auth/ios/errors for more information
                switch (errorCode)
                {
                case AuthErrorCode.OperationNotAllowed:
                case AuthErrorCode.InvalidEmail:
                case AuthErrorCode.UserDisabled:
                case AuthErrorCode.WrongPassword:
                default:
                    loginResult    = false;
                    hasLoginResult = true;
                    break;
                }
            }
            else
            {
                // Do your magic to handle authentication result
                loginResult    = true;
                hasLoginResult = true;
            }
            tokenSource.Cancel();
        }
        public override void FinishedRecording(AVCaptureFileOutput captureOutput, Foundation.NSUrl outputFileUrl, Foundation.NSObject[] connections, Foundation.NSError error)
        {
            NSUrl urlCompressed = new NSUrl(System.IO.Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".mov"), false);

            compressVideo(outputFileUrl, urlCompressed);

            /*
             * NSData data = NSData.FromUrl(outputFileUrl);
             * byte[] dataBytes = new byte[data.Length];
             * System.Runtime.InteropServices.Marshal.Copy(data.Bytes, dataBytes, 0, Convert.ToInt32(data.Length));
             * UIApplication.SharedApplication.InvokeOnMainThread(delegate
             *      {
             *              (Element as CustomVideoCamera).SetPhotoResult(outputFileUrl.ToString(), dataBytes, 0, 0);
             *              activityIndicator.StopAnimating ();
             *      });
             */
            //You can use captureOutput and outputFileUrl here..
            //throw new NotImplementedException();
        }
 public static NSObject PropertyListWithData(NSData data, ref NSPropertyListFormat format, out NSError error)
 {
     return(PropertyListWithData(data, NSPropertyListReadOptions.Immutable, ref format, out error));
 }
Exemple #9
0
 public void onLoginManagerRequestTokenHandler(Facebook.LoginKit.LoginManagerLoginResult result, Foundation.NSError error)
 {
     if (result.IsCancelled || this.IsLoggedIn == false)
     {
         this.OnLoginFailed();
     }
     else
     {
         this.OnLoginSucessful();
     }
 }
Exemple #10
0
 public NSFileSystemAttributes GetFileSystemAttributes(string path, out NSError error)
 {
     return(NSFileSystemAttributes.FromDictionary(_GetFileSystemAttributes(path, out error)));
 }
 public void FailedWithError(NSUrlProtocol protocol, NSError error)
 {
     Messaging.void_objc_msgSend_IntPtr_IntPtr(this.Handle, Selector.GetHandle(selUrlProtocolDidFailWithError_), protocol.Handle, error.Handle);
 }
Exemple #12
0
 public NSErrorEventArgs(NSError error)
 {
     Error = error;
 }
Exemple #13
0
        public bool CreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes, out NSError error)
        {
            var dict = attributes == null ? null : attributes.ToDictionary();

            return(CreateDirectory(path, createIntermediates, dict, out error));
        }
Exemple #14
0
        public unsafe static NSData SendSynchronousRequest(NSUrlRequest request, out NSUrlResponse response, out NSError error)
        {
            IntPtr responseStorage = IntPtr.Zero;
            IntPtr errorStorage    = IntPtr.Zero;

            void * resp    = &responseStorage;
            void * errp    = &errorStorage;
            IntPtr rhandle = (IntPtr)resp;
            IntPtr ehandle = (IntPtr)errp;

            var res = Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_IntPtr(
                class_ptr,
                Selector.GetHandle(selSendSynchronousRequestReturningResponseError),
                request.Handle,
                rhandle,
                ehandle);

            if (responseStorage != IntPtr.Zero)
            {
                response = (NSUrlResponse)Runtime.GetNSObject(responseStorage);
            }
            else
            {
                response = null;
            }

            if (errorStorage != IntPtr.Zero)
            {
                error = (NSError)Runtime.GetNSObject(errorStorage);
            }
            else
            {
                error = null;
            }

            return((NSData)Runtime.GetNSObject(res));
        }
Exemple #15
0
 public void OnForgotPasswordError(ForgotPasswordScreenlet screenlet, Foundation.NSError error)
 {
     System.Diagnostics.Debug.WriteLine($"Forgot password failed: {error.Description}");
 }
Exemple #16
0
 public override void LoadFailed(UIWebView webView, Foundation.NSError error)
 {
     LoadFailedCalled = true;
     finished.TrySetException(new NSErrorException(error));
 }
Exemple #17
0
 public void FailedToRegisterForRemoteNotifications(UIKit.UIApplication application, Foundation.NSError error)
 {
     CommonMethods.LogStatic("FailedToRegisterForRemoteNotifications, error: " + error.Description);
 }
 static void HandleWKJavascriptEvaluationResult(Foundation.NSObject result, Foundation.NSError error)
 {
     return;
 }
Exemple #19
0
 public void Error(Twilio.Common.TwilioAccessManager accessManager, Foundation.NSError error)
 {
     Console.WriteLine("access manager error");
 }
        void ISessionDelegate.DidFailRequestForVisitable(Session session, IVisitable visitable, Foundation.NSError error)
        {
            var demoViewController = visitable as DemoViewController;

            if (demoViewController == null)
            {
                return;
            }

            var errorCode = (ErrorCode)(int)error.Code;

            switch (errorCode)
            {
            case ErrorCode.HttpFailure:
                var statusCode = error.UserInfo["statusCode"] as NSNumber;

                switch (statusCode.Int32Value)
                {
                case 401:
                    PresentAuthenticationController();
                    break;

                case 404:
                    demoViewController.PresentError(Error.HTTPNotFoundError);
                    break;

                default:
                    demoViewController.PresentError(new Error(statusCode.Int32Value));
                    break;
                }

                break;

            case ErrorCode.NetworkFailure:
                demoViewController.PresentError(Error.NetworkError);
                break;
            }
        }
Exemple #21
0
 public void DidFailToStartListening(Twilio.Conversations.TwilioConversationsClient conversationsClient, Foundation.NSError error)
 {
     listeningStatusLabel.Text = "Failed to start listening for Invites";
 }
 public static NSObject PropertyListWithStream(NSInputStream stream, ref NSPropertyListFormat format, out NSError error)
 {
     return(PropertyListWithStream(stream, NSPropertyListReadOptions.Immutable, ref format, out error));
 }
            static void HandleWKJavascriptEvaluationResult(Foundation.NSObject result, Foundation.NSError err)
            {
                if (err != null)
                {
                    System.Diagnostics.Debug.WriteLine($"User-Agent API error = {err}");

                    useragent_wkwebview = err.ToString();
                }
                if (result != null)
                {
                    System.Diagnostics.Debug.WriteLine($"User-Agent API result = {result}");

                    useragent_wkwebview = result.ToString();
                }

                System.Diagnostics.Debug.WriteLine($"User-Agent API useragent_wkwebview = {useragent_wkwebview}");

                return;
            }
Exemple #24
0
 public void DidStopListeningForInvites(Twilio.Conversations.TwilioConversationsClient conversationsClient, Foundation.NSError error)
 {
     if (error != null)
     {
         Console.WriteLine("Successfully stopped listening for Conversation invites");
         twilio = null;
     }
     else
     {
         Console.WriteLine($"Stopped listening for Conversation invites (error): {error.Code}");
     }
 }
 public override void RestoreCompletedTransactionsFailedWithError(SKPaymentQueue queue, Foundation.NSError error)
 {
     // Failure, just fire with null
     TransactionsRestored?.Invoke(null);
 }
 public void Error(Twilio.Common.TwilioAccessManager accessManager, Foundation.NSError error)
 {
 }
 public override void DidCompleteWithError(Foundation.NSUrlSession session, Foundation.NSUrlSessionTask task, Foundation.NSError error)
 {
     // Add a breakpoint here if you encounter any errors.
 }
 void GroupsEnumeratorFailed(Foundation.NSError error)
 {
     Console.WriteLine("Enumerator failed!");
 }
 public override void Failed(CLLocationManager manager, Foundation.NSError error)
 {
 }
 public static nint WritePropertyList(NSObject plist, NSOutputStream stream, NSPropertyListFormat format, out NSError error)
 {
     return(WritePropertyList(plist, stream, format, NSPropertyListWriteOptions.Immutable, out error));
 }