Audacity 3.2.0
|
Service for providing information about the user profile. More...
#include <UserService.h>
Public Member Functions | |
void | UpdateUserData () |
Request the service to update the data. More... | |
void | ClearUserData () |
Reset the user profile data. More... | |
wxString | GetUserSlug () const |
"Slug" used to construct shareable URLs More... | |
wxString | GetDisplayName () const |
Get the user name to display in the dialog. More... | |
wxString | GetAvatarPath () const |
Gets a path to the avatar. More... | |
Public Member Functions inherited from Observer::Publisher< UserDataChanged > | |
Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={}) | |
Constructor supporting type-erased custom allocation/deletion. More... | |
Publisher (Publisher &&)=default | |
Publisher & | operator= (Publisher &&)=default |
Subscription | Subscribe (Callback callback) |
Connect a callback to the Publisher; later-connected are called earlier. More... | |
Subscription | Subscribe (Object &obj, Return(Object::*callback)(Args...)) |
Overload of Subscribe takes an object and pointer-to-member-function. More... | |
Private Member Functions | |
void | DownloadAvatar (std::string_view url) |
Additional Inherited Members | |
Public Types inherited from Observer::Publisher< UserDataChanged > | |
using | message_type = UserDataChanged |
using | CallbackReturn = std::conditional_t< true, void, bool > |
using | Callback = std::function< CallbackReturn(const UserDataChanged &) > |
Type of functions that can be connected to the Publisher. More... | |
Static Public Attributes inherited from Observer::Publisher< UserDataChanged > | |
static constexpr bool | notifies_all |
Protected Member Functions inherited from Observer::Publisher< UserDataChanged > | |
CallbackReturn | Publish (const UserDataChanged &message) |
Send a message to connected callbacks. More... | |
Service for providing information about the user profile.
Definition at line 26 of file UserService.h.
void cloud::audiocom::UserService::ClearUserData | ( | ) |
Reset the user profile data.
Definition at line 120 of file UserService.cpp.
References cloud::audiocom::anonymous_namespace{UserService.cpp}::avatarEtag, BasicUI::CallAfter(), cloud::audiocom::anonymous_namespace{UserService.cpp}::displayName, audacity::BasicSettings::Flush(), GetUserSlug(), gPrefs, Observer::Publisher< UserDataChanged >::Publish(), cloud::audiocom::anonymous_namespace{UserService.cpp}::userName, and Setting< T >::Write().
|
private |
Definition at line 145 of file UserService.cpp.
References cloud::audiocom::anonymous_namespace{UserService.cpp}::avatarEtag, BasicUI::CallAfter(), audacity::BasicSettings::Flush(), anonymous_namespace{FrameStatistics.cpp}::GetInstance(), gPrefs, audacity::network_manager::common_headers::IfNoneMatch, cloud::audiocom::anonymous_namespace{UserService.cpp}::MakeAvatarPath(), Observer::Publisher< UserDataChanged >::Publish(), Setting< T >::Read(), audacity::ToUTF8(), and Setting< T >::Write().
Referenced by UpdateUserData().
wxString cloud::audiocom::UserService::GetAvatarPath | ( | ) | const |
Gets a path to the avatar.
Definition at line 237 of file UserService.cpp.
References cloud::audiocom::anonymous_namespace{UserService.cpp}::MakeAvatarPath().
wxString cloud::audiocom::UserService::GetDisplayName | ( | ) | const |
Get the user name to display in the dialog.
Definition at line 227 of file UserService.cpp.
References cloud::audiocom::anonymous_namespace{UserService.cpp}::displayName, and Setting< T >::Read().
wxString cloud::audiocom::UserService::GetUserSlug | ( | ) | const |
"Slug" used to construct shareable URLs
Definition at line 232 of file UserService.cpp.
References Setting< T >::Read(), and cloud::audiocom::anonymous_namespace{UserService.cpp}::userName.
Referenced by ClearUserData().
void cloud::audiocom::UserService::UpdateUserData | ( | ) |
Request the service to update the data.
Definition at line 61 of file UserService.cpp.
References audacity::network_manager::common_headers::Accept, audacity::network_manager::common_content_types::ApplicationJson, audacity::network_manager::common_headers::Authorization, BasicUI::CallAfter(), cloud::audiocom::anonymous_namespace{UserService.cpp}::displayName, DownloadAvatar(), audacity::BasicSettings::Flush(), anonymous_namespace{FrameStatistics.cpp}::GetInstance(), cloud::audiocom::GetOAuthService(), cloud::audiocom::GetServiceConfig(), gPrefs, Observer::Publisher< UserDataChanged >::Publish(), audacity::network_manager::Request::setHeader(), audacity::ToWXString(), cloud::audiocom::anonymous_namespace{UserService.cpp}::userName, and Setting< T >::Write().