From 09c8e9cac3e84d2b2041cb254f65f993ef88bca3 Mon Sep 17 00:00:00 2001 From: James Frost Date: Fri, 1 Oct 2021 19:47:43 +0100 Subject: [PATCH] Allow setting the loading / enabled states of NUXButtonViewController buttons --- WordPressAuthenticator.podspec | 2 +- .../NUX/NUXButtonViewController.swift | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/WordPressAuthenticator.podspec b/WordPressAuthenticator.podspec index 4361035fd..7bd14f806 100644 --- a/WordPressAuthenticator.podspec +++ b/WordPressAuthenticator.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'WordPressAuthenticator' - s.version = '1.42.0' + s.version = '1.42.1-beta.1' s.summary = 'WordPressAuthenticator implements an easy and elegant way to authenticate your WordPress Apps.' s.description = <<-DESC diff --git a/WordPressAuthenticator/NUX/NUXButtonViewController.swift b/WordPressAuthenticator/NUX/NUXButtonViewController.swift index 0884a6951..5fb628e74 100644 --- a/WordPressAuthenticator/NUX/NUXButtonViewController.swift +++ b/WordPressAuthenticator/NUX/NUXButtonViewController.swift @@ -177,6 +177,21 @@ open class NUXButtonViewController: UIViewController { shadowView?.isHidden = true } + public func setTopButtonState(isLoading: Bool, isEnabled: Bool) { + topButton?.showActivityIndicator(isLoading) + topButton?.isEnabled = isEnabled + } + + public func setBottomButtonState(isLoading: Bool, isEnabled: Bool) { + bottomButton?.showActivityIndicator(isLoading) + bottomButton?.isEnabled = isEnabled + } + + public func setTertiaryButtonState(isLoading: Bool, isEnabled: Bool) { + tertiaryButton?.showActivityIndicator(isLoading) + tertiaryButton?.isEnabled = isEnabled + } + // MARK: - Helpers private func buttonConfigFor(socialService: SocialServiceName, onTap callback: @escaping CallBackType) -> NUXButtonConfig {