36 std::future<std::optional<AuthResult>> future,
42 future.wait_for(std::chrono::milliseconds { 100 }) !=
43 std::future_status::ready)
48 XO(
"An action on audio.com is required before you can continue. You can cancel this operation."),
55 future.wait_for(std::chrono::milliseconds { 50 }) !=
56 std::future_status::ready)
62 if (waitResult == WaitForActionDialog::CancelButtonIdentifier())
93 if (oauthService.HasRefreshToken())
95 std::promise<std::optional<AuthResult>> promise;
97 oauthService.ValidateAuth(
98 [&promise](
auto...) { promise.set_value({}); },
true);
107 if (linkResult == LinkAccountDialog::CancelButtonIdentifier())
110 if (linkResult == LinkAccountDialog::AlternativeButtonIdentifier())
113 std::promise<std::optional<AuthResult>> promise;
115 auto authSubscription = oauthService.Subscribe(
116 [&promise](
auto& result)
120 AuthResult { AuthResult::Status::Authorised, {} } :
122 std::string(result.errorMessage) });
136AuthorizationHandler::AuthorizationHandler()
Declare functions to perform UTF-8 to std::wstring conversions.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Holds a msgid for the translation catalog; may also bind format arguments.
void PopSuppressDialogs()
void PushSuppressDialogs()
void OnAuthStateChanged(const AuthStateChangedMessage &message)
bool OpenInDefaultBrowser(const wxString &url)
Open an URL in default browser.
AuthorizationHandler handler
std::optional< AuthResult > WaitForAuth(std::future< std::optional< AuthResult > > future, const AudacityProject *project)
TaggedIdentifier< DialogButtonIdentifierTag > DialogButtonIdentifier
AuthorizationHandler & GetAuthorizationHandler()
OAuthService & GetOAuthService()
Returns the instance of the OAuthService.
AuthResult PerformBlockingAuth(AudacityProject *project, const TranslatableString &alternativeActionLabel)
const ServiceConfig & GetServiceConfig()
Returns the instance of the ServiceConfig.
wxString ToWXString(const std::string &str)
Message that is sent when authorization state changes.
bool authorised
Flag that indicates if user is authorised.
std::string_view errorMessage
Error message returned by the server in case of oauth error.