Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Default view based on camera permissions? #99

Closed
drn opened this issue Mar 18, 2015 · 9 comments
Closed

Default view based on camera permissions? #99

drn opened this issue Mar 18, 2015 · 9 comments

Comments

@drn
Copy link

drn commented Mar 18, 2015

Hey everyone,

When presenting the CardIOPaymentViewController without camera permissions, the default view is still the camera scanning view. Since camera permissions are denied, an empty gray view is displayed. It would make sense that the default view by default should be the manual input if the AVCaptureDevice authorization status is denied. Could this be implemented?

In addition, when the camera permissions are presented and subsequently denied, it would make sense that the SDK automatically transitioned to the manual input view.

I may be misremembering but I seem to recall with previous versions, the permission-based view switching used to be included in the SDK. Has that changed with more recent versions? In case this helps, we're testing this against iOS 8.2 with the latest CardIO version 5.0.3.

Thanks!
Darren

@drn drn changed the title Camera Permission Default View Default view based on camera permissions Mar 18, 2015
@drn drn changed the title Default view based on camera permissions Default view based on camera permissions? Mar 18, 2015
@marcferna
Copy link

+1

@josharian
Copy link
Member

Seems reasonable. If either of you wants to tackle this, the source is available at https://github.com/card-io/card.io-iOS-source. And if not, I'm sure @dgoldman-ebay will get to it soon enough.

@dgoldman-pdx
Copy link
Member

I may be misremembering but I seem to recall with previous versions, the permission-based view switching used to be included in the SDK. Has that changed with more recent versions?

After iOS 8 introduced camera permissions, we had to make a change (version 3.8.7, 16 Sep 2014) to prevent a crash if the user denied permission. Otherwise we haven't dealt with camera permissions.

@drn's above suggestions seem reasonable to me.

Although I do have a small nagging concern that when a user is initially presented with the permissions alert, they might reflexively choose No. In which case on future launches of card.io they'll never know what they're missing! 😺

Not sure how to deal with that small concern, other than perhaps providing a surrogate camera screen with some text telling them what they're missing and how they could go to the Settings app to fix it. But for users who consciously chose to distrust your app re the camera, that sort of extra screen would just get annoying.

Anyhow, I think we should let these suggestions sit here for at least few days to see who else 👍s or 👎s them.

dgoldman-pdx pushed a commit to card-io/card.io-iOS-source that referenced this issue Mar 28, 2015
@dgoldman-pdx
Copy link
Member

@drn Satisfying your first request turns out to be pretty easy. (See card-io/card.io-iOS-source@ceb248f if you're curious.)

In addition, when the camera permissions are presented and subsequently denied, it would make sense that the SDK automatically transitioned to the manual input view.

This turns out to be a bit trickier. It would involve some semi-convoluted code changes, as far as I've been able to think, which doesn't strike me as a good tradeoff.

Although, hmm...

Well, let me return to this after the weekend.

@drn
Copy link
Author

drn commented Apr 9, 2015

@dgoldman-ebay Apologies for the delayed response! Cleaning out my inbox now - must have missed the email when it came in.

Thanks for making that code change. I think that it'll be a nicer user experience. The auto-switching based on camera permission choice was a secondary nice-to-have, but not implementing it based on your comments in the code is definitely understandable. Much appreciated!

@drn drn closed this as completed Apr 9, 2015
@vijayviswas
Copy link

Hi All,
I have the same issue iniOS8+. I used below code so that I won't see blank scan view if user clicks "Don't allow".

AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if(authStatus == AVAuthorizationStatusAuthorized)
{
// start card-io
}
else if(authStatus == AVAuthorizationStatusNotDetermined)
{

    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted)
    {
        if(granted)
        {
            //Start card-io
        }

    }];
}
else if (authStatus == AVAuthorizationStatusRestricted)
{
   //Alert
}
else
{
   // Alert camera denied
}

@dgoldman-pdx
Copy link
Member

@vijayviswas yes, that code looks quite reasonable - assuming that you don't want to still use card.io in its manual-entry mode.

@dgoldman-pdx
Copy link
Member

@drn this fix is now released. 😺

@drn
Copy link
Author

drn commented Apr 15, 2015

thank you @dgoldman-ebay !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants