More fixes

This commit is contained in:
Grishka 2022-04-08 01:49:08 +03:00
parent c6ea406a61
commit d063eb32d2
3 changed files with 25 additions and 21 deletions

View File

@ -10,7 +10,7 @@ android {
applicationId "org.joinmastodon.android" applicationId "org.joinmastodon.android"
minSdk 23 minSdk 23
targetSdk 31 targetSdk 31
versionCode 21 versionCode 22
versionName "0.1" versionName "0.1"
} }

View File

@ -96,7 +96,7 @@ public class AccountSessionManager{
sessions.put(session.getID(), session); sessions.put(session.getID(), session);
lastActiveAccountID=session.getID(); lastActiveAccountID=session.getID();
writeAccountsFile(); writeAccountsFile();
maybeUpdateLocalInfo(); updateInstanceEmojis(instance, instance.uri);
if(PushSubscriptionManager.arePushNotificationsAvailable()){ if(PushSubscriptionManager.arePushNotificationsAvailable()){
session.getPushSubscriptionManager().registerAccountForPush(); session.getPushSubscriptionManager().registerAccountForPush();
} }
@ -268,26 +268,30 @@ public class AccountSessionManager{
@Override @Override
public void onSuccess(Instance instance){ public void onSuccess(Instance instance){
instances.put(domain, instance); instances.put(domain, instance);
new GetCustomEmojis() updateInstanceEmojis(instance, domain);
.setCallback(new Callback<>(){ }
@Override
public void onSuccess(List<Emoji> result){
InstanceInfoStorageWrapper emojis=new InstanceInfoStorageWrapper();
emojis.lastUpdated=System.currentTimeMillis();
emojis.emojis=result;
emojis.instance=instance;
customEmojis.put(domain, groupCustomEmojis(emojis));
instancesLastUpdated.put(domain, emojis.lastUpdated);
MastodonAPIController.runInBackground(()->writeInstanceInfoFile(emojis, domain));
E.post(new EmojiUpdatedEvent(domain));
}
@Override @Override
public void onError(ErrorResponse error){ public void onError(ErrorResponse error){
} }
}) })
.execNoAuth(domain); .execNoAuth(domain);
}
private void updateInstanceEmojis(Instance instance, String domain){
new GetCustomEmojis()
.setCallback(new Callback<>(){
@Override
public void onSuccess(List<Emoji> result){
InstanceInfoStorageWrapper emojis=new InstanceInfoStorageWrapper();
emojis.lastUpdated=System.currentTimeMillis();
emojis.emojis=result;
emojis.instance=instance;
customEmojis.put(domain, groupCustomEmojis(emojis));
instancesLastUpdated.put(domain, emojis.lastUpdated);
MastodonAPIController.runInBackground(()->writeInstanceInfoFile(emojis, domain));
E.post(new EmojiUpdatedEvent(domain));
} }
@Override @Override

View File

@ -107,7 +107,7 @@ public abstract class StatusDisplayItem{
if(statusForContent.poll!=null){ if(statusForContent.poll!=null){
buildPollItems(parentID, fragment, statusForContent.poll, items); buildPollItems(parentID, fragment, statusForContent.poll, items);
} }
if(statusForContent.card!=null && statusForContent.mediaAttachments.isEmpty()){ if(statusForContent.card!=null && statusForContent.mediaAttachments.isEmpty() && TextUtils.isEmpty(statusForContent.spoilerText)){
items.add(new LinkCardStatusDisplayItem(parentID, fragment, statusForContent)); items.add(new LinkCardStatusDisplayItem(parentID, fragment, statusForContent));
} }
if(addFooter){ if(addFooter){