-
Notifications
You must be signed in to change notification settings - Fork 76
Add hide method to react-native-lock-ios #10
Conversation
@@ -44,6 +49,19 @@ - (void)configureLockWithClientId:(NSString *)clientId domain:(NSString *)domain | |||
_lock = [A0Lock newLockWithClientId:clientId domain:domain]; | |||
} | |||
|
|||
- (void)hideWithCallback:(A0LockCallback)callback { | |||
if (self.shown) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Thanks for the PR, I've been busy with other stuff so I missed most of the PRs in this repo. |
No problem! Thanks for putting this module together! |
Add hide method to react-native-lock-ios
Adds hide method to react-native-lock-ios. Api is same as generic auth0 lock api.