-
Notifications
You must be signed in to change notification settings - Fork 461
[fix] podspec and making use of UIApplicationDelegate #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix] podspec and making use of UIApplicationDelegate #131
Conversation
|
Hey, thanks for the PR! Could you change the url to point to the GitHub repo (https://github.com/FormidableLabs/react-native-app-auth) instead? We don't have a landing page for this library in our main website, so that would make more sense. |
|
Sure! I came across some other stuff as well that I’d like to add to the PR. Will push more code tomorrow |
…ession and calling on id instance conforming to UIApplicationDelegate in order to get reference to rootViewController
|
@kadikraman Here are some additional changes :)
|
|
Forgot to mention how I propose on can make use of the lib in a given app: @interface AppDelegate()<RNAppAuthAuthorizationFlowManager> {
id <OIDAuthorizationFlowSession> _currentSession;
}
@end
@implementation AppDelegate
-(void)setCurrentAuthorizationFlowSession:(id<OIDAuthorizationFlowSession>)session {
// retain session for further use
_currentSession = session;
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *, id> *)options {
BOOL shouldOpenUrl = [_currentSession resumeAuthorizationFlowWithURL:url];
_currentSession = nil;
return shouldOpenUrl;
}
@end |
|
@hakonk that's brilliant, it's been on my To Do list forever, but I've not had the time, really appreciate it, it's definitely the right way to go. Could you please also update the Example app and the Readme 🙏 |
|
@kadikraman Yep! I'm on it now. I do have a question about the Swift section in the documentation. Is it really a use case for React Native apps where AppDelegate is implemented in Swift? While I guess it's doable, it doesn't really provide much convenience, especially since React Native for iOS is heavily based on Objective-C, Macros etc. |
|
Also, I'm having some issues with building the example project. Those issues are not related to this PR however as it seems they have been there for a while. Fixing the example project, I believe should be a separate PR. What are your thoughts? |
|
Swift: those instructions were added by a contributor. Figured there was no harm in merging them, although we don't officially support it. If it will no longer be valid after this PR, perhaps it's best just to delete them. Example app: agreed, definitely a separate PR. It's frustrating, but I can't reproduce the error at all. The example app works for me both from Xcode and terminal on two separate computers. |
|
I did actually manage to make the example project compile 😄 (see latest Podfile and xcode project changes). Regarding Swift, I could just add to the README that it's untested, but should work in a similar fashion? |
|
@kadikraman I've added a suggestion in the README file concerning Swift usage. |
|
|
||
| ```diff | ||
| + @protocol OIDAuthorizationFlowSession; | ||
| `RNAppAuth` will call on the given app's delegate via `[UIApplication sharedApplication].delegate`. |
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.
First step needs to be to add the imports:
+#import <AppAuth/AppAuth.h>
+#import "RNAppAuthAuthorizationFlowManager.h"|
Just tested your branch on a fresh RN project and it works! 🎉 Just needs a small update to the readme to add the imports to |
|
Glad to hear that! I've added some lines about imports in |
|
@kadikraman What does your release cycle look like, any scheduled releases in the near future? |
|
I want to get this released ASAP, but it will have to be in a I was hoping to include another big feature in |
|
Alright, sounds good. Let me know if you need anything from me. |
I tried running
pod installand ran into an error due to missing url fors.homepage:)