Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Add hide method to react-native-lock-ios #10

Merged
merged 2 commits into from Jan 26, 2016
Merged

Add hide method to react-native-lock-ios #10

merged 2 commits into from Jan 26, 2016

Conversation

brianneisler
Copy link
Contributor

Adds hide method to react-native-lock-ios. Api is same as generic auth0 lock api.

@@ -44,6 +49,19 @@ - (void)configureLockWithClientId:(NSString *)clientId domain:(NSString *)domain
_lock = [A0Lock newLockWithClientId:clientId domain:domain];
}

- (void)hideWithCallback:(A0LockCallback)callback {
if (self.shown) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced we should add this flag, the worst case scenario is that you'll dismiss a VC that is presented from the rootViewController of the window if Lock is not displayed (which should be strange). So I'd rather remove this flag and just dismiss the presented VC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzalaz that scenario was what I was trying to avoid. Wanted the call to be safe to attach to some state change event which may not be dependent upon the lock being shown.

e.g. we have a listener on a firebase variable that detects when an app version value has changed. If the version requires an updated we ensure the login screen is hidden by calling lock.hide() without having to keep track of whether or not it's shown.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I still don't like it and probably is something the app might take care of (trying not to dismiss something is not there) but besides my opinion there is no other argument against it. So let's keep it as it is, just check the other comment and I'll merge it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! FWIW one other issue this has allowed us to work around.

During development of a react-native app, if the lock is open and you hit 'command r' to refresh the app, the lock will persist open (since it lives in the native layer) even though the js app state has been blown away and restarted. We're able to work around this now by calling lock.hide() on init of app to ensure the lock is closed.

@hzalaz
Copy link
Member

hzalaz commented Jan 20, 2016

Thanks for the PR, I've been busy with other stuff so I missed most of the PRs in this repo.

@brianneisler
Copy link
Contributor Author

No problem! Thanks for putting this module together!

hzalaz added a commit that referenced this pull request Jan 26, 2016
Add hide method to react-native-lock-ios
@hzalaz hzalaz merged commit d204ba1 into auth0:master Jan 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants