Revert some changes specifically for Iceshrimp.NET

This commit is contained in:
Jacocococo 2024-08-21 22:15:55 +02:00
parent c834199ee4
commit 407844378f
7 changed files with 17 additions and 9 deletions

View File

@ -64,7 +64,7 @@ public class StatusInteractionController{
result.favouritesCount = Math.max(0, status.favouritesCount + (favorited ? 1 : -1));
cb.accept(result);
if(updateCounters) E.post(new StatusCountersUpdatedEvent(result));
if(instance.isIceshrimp()) E.post(new EmojiReactionsUpdatedEvent(status.id, result.reactions, false, null));
if(instance.isIceshrimpJs()) E.post(new EmojiReactionsUpdatedEvent(status.id, result.reactions, false, null));
}
@Override
@ -74,7 +74,7 @@ public class StatusInteractionController{
status.favourited=!favorited;
cb.accept(status);
if(updateCounters) E.post(new StatusCountersUpdatedEvent(status));
if(instance.isIceshrimp()) E.post(new EmojiReactionsUpdatedEvent(status.id, status.reactions, false, null));
if(instance.isIceshrimpJs()) E.post(new EmojiReactionsUpdatedEvent(status.id, status.reactions, false, null));
}
})
.exec(accountID);
@ -86,7 +86,7 @@ public class StatusInteractionController{
return;
String defaultReactionEmojiRaw=instance.configuration.reactions.defaultReaction;
if(!instance.isIceshrimp() || defaultReactionEmojiRaw==null)
if(!instance.isIceshrimpJs() || defaultReactionEmojiRaw==null)
return;
boolean reactionIsCustom=defaultReactionEmojiRaw.startsWith(":");

View File

@ -830,7 +830,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
publishButton=wrap.findViewById(R.id.publish_btn);
languageButton=wrap.findViewById(R.id.language_btn);
if(instance.isIceshrimp())
if(instance.isIceshrimpJs())
languageButton.setVisibility(View.GONE);
else {
languageButton.setOnClickListener(v->showLanguageAlert());

View File

@ -26,6 +26,10 @@ public interface HasAccountID {
return getInstance().map(Instance::isIceshrimp).orElse(false);
}
default boolean isInstanceIceshrimpJs() {
return getInstance().map(Instance::isIceshrimpJs).orElse(false);
}
default Optional<Instance> getInstance() {
return getSession().getInstance();
}

View File

@ -1020,7 +1020,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
else hidePrivateNote();
invalidateOptionsMenu();
actionButton.setVisibility(View.VISIBLE);
notifyButton.setVisibility(relationship.following && !isInstanceIceshrimp() ? View.VISIBLE : View.GONE);
notifyButton.setVisibility(relationship.following && !isInstanceIceshrimpJs() ? View.VISIBLE : View.GONE);
UiUtils.setRelationshipToActionButtonM3(relationship, actionButton);
actionProgress.setIndeterminateTintList(actionButton.getTextColors());
notifyProgress.setIndeterminateTintList(notifyButton.getTextColors());

View File

@ -61,7 +61,7 @@ public class SettingsBehaviorFragment extends BaseSettingsFragment<Void> impleme
showRepliesItem=new CheckableListItem<>(R.string.sk_settings_show_replies, 0, CheckableListItem.Style.SWITCH, lp.showReplies, R.drawable.ic_fluent_arrow_reply_24_regular, i->toggleCheckableItem(showRepliesItem))
));
if(!isInstanceIceshrimp()) items.add(
if(!isInstanceIceshrimpJs()) items.add(
0,
languageItem=new ListItem<>(getString(R.string.default_post_language), postLanguage!=null ? postLanguage.getDisplayName(getContext()) : null, R.drawable.ic_fluent_local_language_24_regular, this::onDefaultLanguageClick)
);

View File

@ -156,6 +156,10 @@ public class Instance extends BaseModel{
return version.contains("compatible; Iceshrimp");
}
public boolean isIceshrimpJs() {
return version.contains("compatible; Iceshrimp "); // Iceshrimp.NET will not have a space immediately after
}
public boolean hasFeature(Feature feature) {
Optional<List<String>> pleromaFeatures = Optional.ofNullable(pleroma)
.map(p -> p.metadata)

View File

@ -295,7 +295,7 @@ public class EmojiReactionsStatusDisplayItem extends StatusDisplayItem {
finalExisting.add(me);
adapter.notifyItemChanged(item.status.reactions.indexOf(finalExisting));
}
if(instance.isIceshrimp() && status!=null){
if(instance.isIceshrimpJs() && status!=null){
item.parentFragment.onFavoriteChanged(status, getItemID());
E.post(new StatusCountersUpdatedEvent(status));
}
@ -510,7 +510,7 @@ public class EmojiReactionsStatusDisplayItem extends StatusDisplayItem {
btn.setCompoundDrawablesRelative(item.first.placeholder, null, null, null);
}
btn.setSelected(reaction.me);
if(parent.parentFragment.isInstanceIceshrimp() && reaction.name.contains("@")){
if(parent.parentFragment.isInstanceIceshrimpJs() && reaction.name.contains("@")){
btn.setEnabled(false);
btn.setClickable(false);
btn.setLongClickable(true);
@ -552,7 +552,7 @@ public class EmojiReactionsStatusDisplayItem extends StatusDisplayItem {
if(instance.configuration!=null && instance.configuration.reactions!=null && instance.configuration.reactions.maxReactions!=0){
adapter.parentHolder.updateMeReactionCount(deleting);
}
if(instance.isIceshrimp() && status!=null){
if(instance.isIceshrimpJs() && status!=null){
parent.parentFragment.onFavoriteChanged(status, adapter.parentHolder.getItemID());
E.post(new StatusCountersUpdatedEvent(status));
}