mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix emotes not loading properly
This commit is contained in:
parent
0718277271
commit
3dad7e778a
|
@ -11,22 +11,6 @@ namespace twitch {
|
|||
TwitchAccountManager::TwitchAccountManager()
|
||||
{
|
||||
this->anonymousUser.reset(new TwitchAccount(ANONYMOUS_USERNAME, "", "", ""));
|
||||
|
||||
this->currentUsername.connect([this](const auto &newValue, auto) {
|
||||
QString newUsername(QString::fromStdString(newValue));
|
||||
auto user = this->findUserByUsername(newUsername);
|
||||
if (user) {
|
||||
debug::Log("[AccountManager:currentUsernameChanged] User successfully updated to {}",
|
||||
newUsername);
|
||||
this->currentUser = user;
|
||||
} else {
|
||||
debug::Log(
|
||||
"[AccountManager:currentUsernameChanged] User successfully updated to anonymous");
|
||||
this->currentUser = this->anonymousUser;
|
||||
}
|
||||
|
||||
this->userChanged.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
std::shared_ptr<TwitchAccount> TwitchAccountManager::getCurrent()
|
||||
|
@ -125,6 +109,27 @@ void TwitchAccountManager::reloadUsers()
|
|||
}
|
||||
}
|
||||
|
||||
void TwitchAccountManager::load()
|
||||
{
|
||||
this->reloadUsers();
|
||||
|
||||
this->currentUsername.connect([this](const auto &newValue, auto) {
|
||||
QString newUsername(QString::fromStdString(newValue));
|
||||
auto user = this->findUserByUsername(newUsername);
|
||||
if (user) {
|
||||
debug::Log("[AccountManager:currentUsernameChanged] User successfully updated to {}",
|
||||
newUsername);
|
||||
this->currentUser = user;
|
||||
} else {
|
||||
debug::Log(
|
||||
"[AccountManager:currentUsernameChanged] User successfully updated to anonymous");
|
||||
this->currentUser = this->anonymousUser;
|
||||
}
|
||||
|
||||
this->userChanged.invoke();
|
||||
});
|
||||
}
|
||||
|
||||
bool TwitchAccountManager::removeUser(const QString &username)
|
||||
{
|
||||
if (!this->userExists(username)) {
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
bool userExists(const QString &username) const;
|
||||
|
||||
void reloadUsers();
|
||||
void load();
|
||||
|
||||
bool removeUser(const QString &username);
|
||||
|
||||
|
|
|
@ -25,18 +25,7 @@ AccountManager &AccountManager::getInstance()
|
|||
|
||||
void AccountManager::load()
|
||||
{
|
||||
this->Twitch.reloadUsers();
|
||||
|
||||
auto currentUser = this->Twitch.findUserByUsername(
|
||||
QString::fromStdString(this->Twitch.currentUsername.getValue()));
|
||||
|
||||
if (currentUser) {
|
||||
this->Twitch.currentUser = currentUser;
|
||||
} else {
|
||||
this->Twitch.currentUser = this->Twitch.anonymousUser;
|
||||
}
|
||||
|
||||
// this->Twitch.userChanged.invoke();
|
||||
this->Twitch.load();
|
||||
}
|
||||
|
||||
} // namespace singletons
|
||||
|
|
Loading…
Reference in a new issue