Skip to content

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 8dbd5c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 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 @@ -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 @@ -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 8dbd5c6

Please sign in to comment.