Add a message if you're trying to type without being logged in
Fix #484
This commit is contained in:
@@ -137,6 +137,17 @@ void TwitchAccountManager::load()
|
||||
});
|
||||
}
|
||||
|
||||
bool TwitchAccountManager::isLoggedIn() const
|
||||
{
|
||||
if (!this->currentUser) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Once `TwitchAccount` class has a way to check, we should also return false if the credentials
|
||||
// are incorrect
|
||||
return !this->currentUser->isAnon();
|
||||
}
|
||||
|
||||
bool TwitchAccountManager::removeUser(TwitchAccount *account)
|
||||
{
|
||||
const auto &accs = this->accounts.getVector();
|
||||
|
||||
@@ -47,6 +47,8 @@ public:
|
||||
void reloadUsers();
|
||||
void load();
|
||||
|
||||
bool isLoggedIn() const;
|
||||
|
||||
pajlada::Settings::Setting<std::string> currentUsername = {"/accounts/current", ""};
|
||||
pajlada::Signals::NoArgSignal currentUserChanged;
|
||||
pajlada::Signals::NoArgSignal userListUpdated;
|
||||
|
||||
@@ -142,6 +142,15 @@ void TwitchChannel::sendMessage(const QString &message)
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
if (!app->accounts->twitch.isLoggedIn()) {
|
||||
// XXX: It would be nice if we could add a link here somehow that opened the "account
|
||||
// manager" dialog
|
||||
this->addMessage(
|
||||
messages::Message::createSystemMessage("You need to log in to send messages. You can "
|
||||
"link your Twitch account in the settings."));
|
||||
return;
|
||||
}
|
||||
|
||||
debug::Log("[TwitchChannel:{}] Send message: {}", this->name, message);
|
||||
|
||||
// Do last message processing
|
||||
|
||||
Reference in New Issue
Block a user