Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 61ca53d

Browse files
committed
Add SIWA button
1 parent f46a338 commit 61ca53d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

WordPressAuthenticator/Signin/LoginPrologueSignupMethodViewController.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
1212

1313
open var emailTapped: (() -> Void)?
1414
open var googleTapped: (() -> Void)?
15+
open var appleTapped: (() -> Void)?
1516

1617
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
1718
super.prepare(for: segue, sender: sender)
@@ -68,11 +69,27 @@ class LoginPrologueSignupMethodViewController: NUXViewController {
6869
self?.present(safariViewController, animated: true, completion: nil)
6970
}
7071
buttonViewController.stackView?.insertArrangedSubview(termsButton, at: 0)
72+
73+
if WordPressAuthenticator.shared.configuration.enableSignInWithApple {
74+
#if XCODE11
75+
if #available(iOS 13.0, *) {
76+
let appleButton = WPStyleGuide.appleLoginButton()
77+
appleButton.addTarget(self, action: #selector(handleAppleButtonTapped), for: .touchDown)
78+
buttonViewController.stackView?.insertArrangedSubview(appleButton, at: 1)
79+
}
80+
#endif
81+
}
82+
7183
buttonViewController.backgroundColor = WordPressAuthenticator.shared.style.viewControllerBackgroundColor
7284
}
7385

7486
@IBAction func dismissTapped() {
7587
WordPressAuthenticator.track(.signupCancelled)
7688
dismiss(animated: true)
7789
}
90+
91+
@objc func handleAppleButtonTapped() {
92+
dismiss(animated: true)
93+
appleTapped?()
94+
}
7895
}

0 commit comments

Comments
 (0)