Skip to content

Commit

Permalink
chore: changes for saving apple info to appstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
eyatsenkoperpetio committed Dec 7, 2023
1 parent 39ff6b3 commit 9f000cb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions Core/Core/Providers/SocialAuth/AppleAuthProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,15 @@ public final class AppleAuthProvider: NSObject, ASAuthorizationControllerDelegat
let pncf = PersonNameComponentsFormatter()

var name = storage?.appleSignFullName ?? ""
if let fullName = credentials.fullName {
name = pncf.string(from: fullName)
}

let email = credentials.email ?? storage?.appleSignEmail ?? ""

if !name.isEmpty {
if let components = credentials.fullName, !pncf.string(from: components).isEmpty {
name = pncf.string(from: components)
storage?.appleSignFullName = name
}

if storage?.appleSignEmail == nil, !email.isEmpty {
storage?.appleSignEmail = email
var email = storage?.appleSignEmail ?? ""
if let appleEmail = credentials.email, !appleEmail.isEmpty {
email = appleEmail
storage?.appleSignEmail = appleEmail
}

guard let data = credentials.identityToken,
Expand Down

0 comments on commit 9f000cb

Please sign in to comment.