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 | GetUserId () const |
Gets user id. 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 audacity::cloud::audiocom::UserService::ClearUserData | ( | ) |
Reset the user profile data.
Definition at line 125 of file UserService.cpp.
References audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::avatarEtag, BasicUI::CallAfter(), audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::displayName, audacity::BasicSettings::Flush(), GetUserSlug(), gPrefs, Observer::Publisher< UserDataChanged >::Publish(), audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userId, audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userName, and Setting< T >::Write().
|
private |
Definition at line 151 of file UserService.cpp.
References audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::avatarEtag, BasicUI::CallAfter(), audacity::network_manager::NetworkManager::doGet(), audacity::BasicSettings::Flush(), audacity::network_manager::NetworkManager::GetInstance(), gPrefs, audacity::network_manager::common_headers::IfNoneMatch, audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::MakeAvatarPath(), Observer::Publisher< UserDataChanged >::Publish(), Setting< T >::Read(), audacity::ToUTF8(), and Setting< T >::Write().
Referenced by UpdateUserData().
wxString audacity::cloud::audiocom::UserService::GetAvatarPath | ( | ) | const |
Gets a path to the avatar.
Definition at line 248 of file UserService.cpp.
References audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::MakeAvatarPath().
wxString audacity::cloud::audiocom::UserService::GetDisplayName | ( | ) | const |
Get the user name to display in the dialog.
Definition at line 238 of file UserService.cpp.
References audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::displayName, and Setting< T >::Read().
wxString audacity::cloud::audiocom::UserService::GetUserId | ( | ) | const |
Gets user id.
Definition at line 233 of file UserService.cpp.
References Setting< T >::Read(), and audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userId.
wxString audacity::cloud::audiocom::UserService::GetUserSlug | ( | ) | const |
"Slug" used to construct shareable URLs
Definition at line 243 of file UserService.cpp.
References Setting< T >::Read(), and audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userName.
Referenced by ClearUserData().
void audacity::cloud::audiocom::UserService::UpdateUserData | ( | ) |
Request the service to update the data.
Definition at line 62 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(), audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::displayName, audacity::network_manager::NetworkManager::doGet(), DownloadAvatar(), audacity::BasicSettings::Flush(), audacity::network_manager::NetworkManager::GetInstance(), audacity::cloud::audiocom::GetOAuthService(), audacity::cloud::audiocom::GetServiceConfig(), gPrefs, Observer::Publisher< UserDataChanged >::Publish(), audacity::network_manager::Request::setHeader(), audacity::ToWXString(), audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userId, audacity::cloud::audiocom::anonymous_namespace{UserService.cpp}::userName, and Setting< T >::Write().