auth0 / Lock.swift

A Swift & iOS framework to authenticate using Auth0 and with a Native Look & Feel
https://auth0.com/lock
MIT License
260 stars 108 forks source link

Logo doesn’t show properly on iOS Auth0 Login page #540

Closed ketanPRO closed 5 years ago

ketanPRO commented 5 years ago

Description

We are using logo image of 108x58 size for logo on iOS auth0 login page. But it doesn’t work properly on all devices. iphone 8 plus & iphone se it gets stretched & doesntt show properly.

Prerequisites

Environment

Please provide the following:

Reproduction

Detail the steps taken to reproduce this error and note if this issue can be reproduced consistently or if it is intermittent.

Please include:

ApplconLogin_CelebPage@1x ApplconLogin_CelebPage@2x ApplconLogin_CelebPage@3x Simulator Screen Shot - iPhone 8 - 2019-03-18 at 20 33 25

cocojoe commented 5 years ago

Please can you include information the information asked for such as version of Xcode etc

Also please provide:

I quickly imported the largest image you provided and tried it as a @1x @2x @3x ? I didn't experience your result.

My personal advice here is it's much easier to use a vector. If you can export a vector to PDF then your logo will always be universal.

ketanPRO commented 5 years ago

Hi, we are using xcode 10.1

Below is code snippet.

Lock
                .classic()
                .withOptions {
                    $0.closable = true
                    $0.parameters = ["c":strCompanyId]
                    switch initialLoginScreen {
                        case .login: $0.initialScreen = .login
                        case .signup: $0.initialScreen = .signup
                        case .resetPassword: $0.initialScreen = .resetPassword
                    }
                }
                .withStyle {
                    // style.
                    $0.logo = LazyImage(name: "AppIconLogin")
                    $0.title = ""
                    $0.backgroundColor = UIColor.white
                    $0.headerColor = UIColor.white
                    $0.titleColor = UIColor.black
                    $0.secondaryButtonColor = UIColor.black
                    $0.buttonTintColor = UIColor.white

                    $0.tabTextColor = UIColor.black
                    $0.tabTintColor = UIColor(hex6: 0xF00886) //UIColor.black

                    $0.primaryColor = UIColor.black //(hex6: 0xED1D1D)

                }
                .onAuth { credentials in
                    // Let's save our credentials.accessToken value
                    print("Authentication is successful")
                    print(credentials)
                    if let accessToken = credentials.accessToken {
                        Auth0SessionManager.shared.storeTokens(accessToken, refreshToken: credentials.refreshToken)
                    }
                    Auth0SessionManager.shared.retrieveProfile { error in
                        DispatchQueue.main.async {
                            if let strClientToken = Auth0SessionManager.shared.profile?.customClaims?["spotlight"] as? String {
                                    // Login successful
                                //print(userInfoProfile)
                            } else {
                                self.showMissingClientTokenAlert()
                                completion(false)
                            }
                        }
                    }
                }
                .onError(callback: { (error) in
                    // error
                    DispatchQueue.main.async {
                        self.showMissingClientTokenAlert()
                        completion(false)
                    }
                })
                .onCancel(callback: { 
                    // cancelled.
                    DispatchQueue.main.async {
                        completion(false)
                    }
                })
                .present(from: sourceViewController)

Below is the screenshot how Image is configured.

Screenshot 2019-03-19 at 8 05 44 PM

Also Note that, This implementation was working fine with older version of xcode & Lock. We updated our code for latest xcode, swift & Lock library. After that only we are facing this issue.

Unfortunately, We don't have Vector version of Logo.

cocojoe commented 5 years ago

When you say update versions, please add some context. What changed exactly, what version etc Thanks

I tried your images as @1x, @2x, @3x with iPhone 8 with the following snippet. Xcode 10.1

.withStyle {
                        $0.logo = LazyImage(name: "logo")
}

Simulator Screen Shot - iPhone 8 - 2019-03-19 at 22 04 32

ketanPRO commented 5 years ago

After removing $0.title = "" it works fine. so closing issue.