Git Product home page Git Product logo

Comments (13)

crs2m5smith avatar crs2m5smith commented on May 20, 2024 1

@newky2k I was actually able to resolve this for me. I will post code below. Issue turned out to move the delegate scope with the PageRenderer class and not creating new instance of it on ViewDidAppear
` public class CardIORenderer : PageRenderer
{
private bool bViewAlreadyDisappeared = false;
private CardIOPage cardIOPage;
private CardIOPaymentViewControllerDelegate cardIOPaymentViewControllerDelegate;
public CardIORenderer()
{

    }
    protected override void OnElementChanged(VisualElementChangedEventArgs e)
    {
        base.OnElementChanged(e);
        cardIOPage = e.NewElement as CardIOPage;
    }
    public override void ViewDidAppear(bool animated)
    {
        base.ViewDidAppear(animated);

        if (bViewAlreadyDisappeared) return;

        cardIOPaymentViewControllerDelegate = new CardIOPaymentViewControllerDg(cardIOPage);

        // Create and Show the View Controller
        var paymentViewController = new CardIOPaymentViewController(cardIOPaymentViewControllerDelegate, true);

        paymentViewController.AllowFreelyRotatingCardGuide = false;
        Device.BeginInvokeOnMainThread(() =>
        {
            var window = UIApplication.SharedApplication.KeyWindow;
            var vc = window.RootViewController;
            while (vc.PresentedViewController != null)
            {
                vc = vc.PresentedViewController;
            }
            // Display the card.io interface
            vc.PresentViewController(paymentViewController, true, null);
        });
    }
    public override void ViewDidDisappear(bool animated)
    {
        base.ViewDidDisappear(animated);
        bViewAlreadyDisappeared = true;
    }
}
public class CardIOPaymentViewControllerDg : CardIOPaymentViewControllerDelegate
{
    private CardIOPage cardIOPage;
    private CardIOCard cardIOCard = new CardIOCard();
    public CardIOPaymentViewControllerDg(CardIOPage page)
    {
        cardIOPage = page;   
    }
    public override void UserDidCancelPaymentViewController(CardIOPaymentViewController paymentViewController)
    {
        // do cancel
    }

    public override void UserDidProvideCreditCardInfo(CreditCardInfo card, CardIOPaymentViewController paymentViewController)
    {
        if (card == null)
           // do error
        else
        {
            //do work
        }
    }
}`

from xamarincomponents.

wal33d006 avatar wal33d006 commented on May 20, 2024

@Redth Can you please look into this.
Thanks

from xamarincomponents.

wal33d006 avatar wal33d006 commented on May 20, 2024

@bholmes @mattleibow
Can you guys please look into this as well
I am stuck at this since last week

from xamarincomponents.

bholmes avatar bholmes commented on May 20, 2024

Can you please specify which component is giving the problem. Is this CardIO?

from xamarincomponents.

wal33d006 avatar wal33d006 commented on May 20, 2024

@bholmes Yes

from xamarincomponents.

Redth avatar Redth commented on May 20, 2024

@wal33d006 does the sample work for you? It's working fine for me, I'm unable to reproduce the crash, or the Camera/Done buttons not working.

from xamarincomponents.

jeremymarabel avatar jeremymarabel commented on May 20, 2024

hi @wal33d006 @bholmes ,
I ran into the same issue and found this post. it's a CardIO issue
My app don't crash, but i'm stuck into that screen. It's a bit tricky to reproduce, here are the steps :

_Take a card hard to read (erased numbers or something) or simply hide some numbers with your finger
_Try to scan the credit card (the all square must be green)
_While the component try to scan, click on the cancel button

You should now be stuck in the card scanner.

Hope this can be fixed, thank you in advance

from xamarincomponents.

wal33d006 avatar wal33d006 commented on May 20, 2024

@jeremymarabel
My screen also stucks there
the buttons don't work at all
Sometimes it crashes and sometimes it doesn't

from xamarincomponents.

Redth avatar Redth commented on May 20, 2024

@jeremymarabel and @wal33d006 please try the sample located here: https://github.com/xamarin/XamarinComponents/tree/master/XPlat/CardIO/iOS/samples

I still can't reproduce the issue.

Also, if you can share some code to show how you're using Card.IO that would help. I tried the steps of trying to read a card with missing numbers and pressing cancel when the square was all green. It works fine here :/

from xamarincomponents.

crs2m5smith avatar crs2m5smith commented on May 20, 2024

Has anyone resolved this issue? I am implementing this with Xamarin Forms and ran into same issue with buttons not firing.

from xamarincomponents.

newky2k avatar newky2k commented on May 20, 2024

@crs2m5smith Could you provide a sample project and further details about the version of iOS etc that you are using

from xamarincomponents.

wal33d006 avatar wal33d006 commented on May 20, 2024

@newky2k ^ Check this one.

from xamarincomponents.

Redth avatar Redth commented on May 20, 2024

Thanks for following up 🥇

from xamarincomponents.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.