MCPcopy Create free account
hub / github.com/audacity/audacity / UpdateUserData

Method UpdateUserData

modules/sharing/mod-cloud-audiocom/ui/UserPanel.cpp:108–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void UserPanel::UpdateUserData()
109{
110 Freeze();
111
112 auto layoutUpdater = finally(
113 [this]()
114 {
115 mLinkButton->Fit();
116
117 Layout();
118 Thaw();
119
120 auto parent = GetParent();
121
122 if (parent != nullptr)
123 parent->Refresh();
124 else
125 Refresh();
126 });
127
128 auto& oauthService = GetOAuthService();
129
130 if (!oauthService.HasRefreshToken())
131 {
132 SetAnonymousState();
133 return;
134 }
135
136 if (!oauthService.HasAccessToken())
137 oauthService.ValidateAuth({}, mAudiocomTrace, true);
138
139 auto& userService = GetUserService();
140
141 if (userService.GetUserSlug().empty())
142 {
143 SetAnonymousState();
144 return;
145 }
146
147 wxString displayName = userService.GetDisplayName();
148
149 if (displayName.empty())
150 {
151 displayName = userService.GetUserSlug();
152 }
153
154 mUserName->SetLabel(displayName);
155 mUserImage->wxPanel::SetLabel(displayName); // for screen readers
156
157 const auto avatarPath = userService.GetAvatarPath();
158
159 if (!avatarPath.empty())
160 mUserImage->SetBitmap(avatarPath);
161 else
162 mUserImage->SetBitmap(theTheme.Bitmap(bmpAnonymousUser));
163
164 mLinkButton->SetLabel(XXO("&Sign Out").Translation());
165 mLinkButton->Show();

Callers 1

HandleCloudLoginMethod · 0.45

Calls 15

finallyFunction · 0.85
GetParentFunction · 0.85
HasRefreshTokenMethod · 0.80
HasAccessTokenMethod · 0.80
ValidateAuthMethod · 0.80
GetUserSlugMethod · 0.80
GetDisplayNameMethod · 0.80
GetAvatarPathMethod · 0.80
TranslationMethod · 0.80
FitMethod · 0.45
RefreshMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected