37 std::future<std::optional<AuthResult>> future,
43 future.wait_for(std::chrono::milliseconds { 100 }) !=
44 std::future_status::ready)
49 XO(
"An action on audio.com is required before you can continue. You can cancel this operation."),
56 future.wait_for(std::chrono::milliseconds { 50 }) !=
57 std::future_status::ready)
63 if (waitResult == WaitForActionDialog::CancelButtonIdentifier())
95 if (oauthService.HasRefreshToken())
97 std::promise<std::optional<AuthResult>> promise;
99 oauthService.ValidateAuth(
100 [&promise](
auto...) { promise.set_value({}); }, trace,
true);
109 if (linkResult == LinkAccountDialog::CancelButtonIdentifier())
112 if (linkResult == LinkAccountDialog::AlternativeButtonIdentifier())
115 std::promise<std::optional<AuthResult>> promise;
117 auto authSubscription = oauthService.Subscribe(
118 [&promise](
auto& result)
122 AuthResult { AuthResult::Status::Authorised, {} } :
124 std::string(result.errorMessage) });
137AuthorizationHandler::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...
static bool SignIn(wxWindow *parent, Mode mode=Mode::SignIn)
Holds a msgid for the translation catalog; may also bind format arguments.
void PopSuppressDialogs()
void PushSuppressDialogs()
void OnAuthStateChanged(const AuthStateChangedMessage &message)
AuthorizationHandler handler
std::optional< AuthResult > WaitForAuth(std::future< std::optional< AuthResult > > future, const AudacityProject *project)
TaggedIdentifier< DialogButtonIdentifierTag > DialogButtonIdentifier
AuthorizationHandler & GetAuthorizationHandler()
AuthResult PerformBlockingAuth(AudacityProject *project, AudiocomTrace trace, const TranslatableString &alternativeActionLabel)
OAuthService & GetOAuthService()
Returns the instance of the OAuthService.
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.