Load mod badge information from the FFZ API instead of assuming the URL.

This lets us load all sizes of the emote if they are available.

Channel with all versions of the mod badge: https://api.frankerfacez.com/v1/room/pajlada
Channel with only one version of the mod badge: https://api.frankerfacez.com/v1/room/apa420
Channel with no mod badge: https://api.frankerfacez.com/v1/room/forsen
This commit is contained in:
Rasmus Karlsson
2019-09-07 13:48:30 +02:00
committed by fourtf
parent 4ec10e720c
commit 256a65a12e
10 changed files with 123 additions and 113 deletions
+10
View File
@@ -349,6 +349,9 @@ void Image::actuallyLoad()
if (!shared)
return Failure;
if (shared->customOnSuccess_)
return shared->customOnSuccess_(shared, result);
auto data = result.getData();
// const cast since we are only reading from it
@@ -393,4 +396,11 @@ bool Image::operator!=(const Image &other) const
return !this->operator==(other);
}
ImagePtr Image::setCustomOnSuccess(
std::function<Outcome(ImagePtr, NetworkResult)> customOnSuccess)
{
this->customOnSuccess_ = customOnSuccess;
return shared_from_this();
}
} // namespace chatterino