Merge pull request #948 from mkljczk/gts-emoji-fix

Fetch custom emojis with auth token
This commit is contained in:
Gregory K 2024-12-07 15:44:58 +03:00 committed by GitHub
commit f4ca4ffc3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -363,7 +363,7 @@ public class AccountSessionManager{
}
private void updateInstanceEmojis(Instance instance, String domain){
new GetCustomEmojis()
GetCustomEmojis getCustomEmojisRequest=(GetCustomEmojis)new GetCustomEmojis()
.setCallback(new Callback<>(){
@Override
public void onSuccess(List<Emoji> result){
@ -378,8 +378,12 @@ public class AccountSessionManager{
public void onError(ErrorResponse error){
}
})
.execNoAuth(domain);
});
sessions.values().stream().filter(session->session.domain.equals(domain)).findFirst().ifPresentOrElse(
(session)->getCustomEmojisRequest.exec(domain, session.token),
()->getCustomEmojisRequest.execNoAuth(domain)
);
}
private void readInstanceInfo(SQLiteDatabase db, Set<String> domains){