Skip to content
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

AWS AuthUI without Navigation Controller #815

Closed
pershanti opened this issue Jan 19, 2018 · 12 comments
Closed

AWS AuthUI without Navigation Controller #815

pershanti opened this issue Jan 19, 2018 · 12 comments
Labels
cognito Issues related to AWS Cognito feature-request Request a new feature follow up Requires follow up from maintainers

Comments

@pershanti
Copy link

To help us solve your problem better, please answer the following list of questions.

  • What service are you using?
    AWS AuthCore, AWS AuthUI

  • In what version of SDK are you facing the problem?
    2.6.6

  • Is the issue limited to Simulators / Actual Devices?
    No

  • Can your problem be resolved if you bump to a higher version of SDK?
    No

  • Is this problem related to specific iOS version?
    No

  • How are you consuming the SDK? CocoaPods / Carthage / Prebuilt frameworks?
    CocoaPods

  • Can you give us steps to reproduce with a minimal, complete, and verifiable example? Please include any specific network conditions that might be required to reproduce the problem.

The current way to present an AWSAuthUIViewController is:
AWSAuthUIViewController.presentViewController(with: UINavigationController, configuration: AWSAuthUIConfiguration?, completionHandler: AWSAuthUICompletionHandler),

which requires you to be using a Navigation Controller. However, I don't want to embed my login screen in a navigation controller. Is there a way for me to present the AuthUIViewController without?

@lexmakali lexmakali added the Auth label Jan 19, 2018
@rohandubal
Copy link
Contributor

Hello, currently there is no other way to use the AuthUI. It requires using navigation controller.

I will take this as a feature request to the team. Could you elaborate a little more on your use case to help us understand the feature better?

Thanks,
Rohan

@masarusanjp
Copy link

I have same issue.
So I avoid this issue by following code .

let viewController = UIViewController()
let navigationController = UINavigationController(rootViewController: viewController)
// To present empty UINavigationController as modal without animation.
UIApplication.shared.delegate?.window?.rootViewController?.present(navigationController, animated: false, completion: nil)
if !AWSSignInManager.sharedInstance().isLoggedIn {
    AWSAuthUIViewController
        .presentViewController(with: navigationController,
                               configuration: nil,
                               completionHandler: { (provider: AWSSignInProvider, error: Error?) in
                                navigationController.dismiss(animated: false, completion: nil)
                                if error != nil {
                                    print("Error occurred: \(String(describing: error))")
                                } else {
                                    // Sign in successful.
                                }
        })
}

Looking at the current implementation, it seems unnecessary to depend on UINavigationController.

https://github.com/aws/aws-sdk-ios/blob/master/AWSAuthSDK/Sources/AWSAuthUI/AWSAuthUIViewController.m#L43

I hope this dependency is gone in the next version

@lexmakali lexmakali added the feature-request Request a new feature label Feb 6, 2018
@mathieugarcia
Copy link

mathieugarcia commented Feb 12, 2018

Hello!

I second this request. My app uses a custom widget library and rely only occasionally on UIKit widgets. Most 3rd party SDKs we use, that have custom UI's, use UIViewController's, not UINavigationController's.

Thanks for considering this!

Cheers,
Mathieu.

@RushanB
Copy link

RushanB commented Apr 7, 2018

I am having a problem with the keyboard in AWSAuthUIViewController. When clicking on username textfield or password textfield it moves them upwards and out of the view. How can I fix this? I just started experiencing this when I updated to Swift 4.1.

@Greg-McHugh
Copy link

@RushanB I have the same issue. I tested it on different versions of iPhone in the XCode simulator and the issue doesn't happen for iPhone X.
It used to be that the view wouldn't move upward but that the keyboard would (at least partially) block the textfields. This problem appeared recently and I'm unsure as to what can be done about it.

@RushanB
Copy link

RushanB commented Apr 7, 2018

@King-Kira Yes, I remember but that was at least usable. At the moment a user can't even Sign In as they can't see what they are typing.

@Greg-McHugh
Copy link

I know. It's quite frustrating.
I posted a new issue on this Git if you want to comment on it.
#878

@rohandubal
Copy link
Contributor

The issue regarding the keyboard is resolved in the latest release 2.6.17

Thanks,
Rohan

@24601
Copy link

24601 commented Jul 7, 2018

@rohandubal - a use case is any application that uses XCode's Document-based template/patterns, these view controller hierarchies have null NavigationControllers because they are Document based.

We have this issue.

@EthanLozano
Copy link
Contributor

@masarusanjp solution worked for me with the slight annoyance that AWSAuthUIViewController presents itself with an animation and dismisses itself with an animation. So, there is a brief black background when the login view is presenting and dismissing. It would be nice if these animation values were configurable. I also had to call that code in viewDidAppear (rather than viewDidLoad) within my main view controller to avoid getting this: Warning: Attempt to present [UINavigationController] on [] whose view is not in the window hierarchy!

Unless I'm mistaken, the login view relies on having a navigation controller, so it's more a question about who supplies the navigation controller. As written, AWSAuthUIViewController.presentViewController seems to assume the user has a UINavigationController UI. But, the user could also want the login view to be presented within a modal, and it would be nice if the API supported this out of the box. Perhaps the API could have an overloaded presentViewController method that presents the login view within a modal?

@thomers
Copy link

thomers commented Sep 17, 2018

I second this request - if you look at the code in AWSAuthUIViewController, it creates its own UINavigationController and uses the passed navigation controller only to call presentViewController (which is a UIViewController method, anyway!).

@frankmuellr frankmuellr added cognito Issues related to AWS Cognito and removed Auth labels Sep 28, 2018
@rohandubal rohandubal removed their assignment Jul 26, 2019
@royjit royjit added the follow up Requires follow up from maintainers label Sep 23, 2022
@atierian atierian assigned atierian and unassigned atierian Jan 27, 2023
@atierian
Copy link
Member

atierian commented Dec 6, 2023

Thanks for this feature request. We recommend using Amplify Authenticator, which has extensive customization options.

@atierian atierian closed this as completed Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cognito Issues related to AWS Cognito feature-request Request a new feature follow up Requires follow up from maintainers
Projects
None yet
Development

No branches or pull requests