Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Revert some changes specifically for Iceshrimp.NET
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacocococo committed Aug 21, 2024
1 parent c834199 commit 4078443
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onSuccess(Status result){
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
Expand All @@ -74,7 +74,7 @@ public void onError(ErrorResponse error){
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);
Expand All @@ -86,7 +86,7 @@ public void onError(ErrorResponse error){
return;

String defaultReactionEmojiRaw=instance.configuration.reactions.defaultReaction;
if(!instance.isIceshrimp() || defaultReactionEmojiRaw==null)
if(!instance.isIceshrimpJs() || defaultReactionEmojiRaw==null)
return;

boolean reactionIsCustom=defaultReactionEmojiRaw.startsWith(":");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){

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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ default boolean isInstanceIceshrimp() {
return getInstance().map(Instance::isIceshrimp).orElse(false);
}

default boolean isInstanceIceshrimpJs() {
return getInstance().map(Instance::isIceshrimpJs).orElse(false);
}

default Optional<Instance> getInstance() {
return getSession().getInstance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ private void updateRelationship(){
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void onCreate(Bundle savedInstanceState){
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)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public boolean isIceshrimp() {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private void addEmojiReaction(String emoji, Emoji info) {
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));
}
Expand Down Expand Up @@ -510,7 +510,7 @@ public void onBind(Pair<EmojiReactionsStatusDisplayItem, EmojiReaction> item){
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);
Expand Down Expand Up @@ -552,7 +552,7 @@ public void onBind(Pair<EmojiReactionsStatusDisplayItem, EmojiReaction> item){
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));
}
Expand Down

0 comments on commit 4078443

Please sign in to comment.