feat(compose): add automatically mentioning Reblogger functionality
Fixes #173
This commit is contained in:
parent
218503a739
commit
fe20fe4254
6 changed files with 16 additions and 0 deletions
|
@ -54,6 +54,7 @@ public class GlobalUserPreferences{
|
|||
public static boolean replyLineAboveHeader;
|
||||
public static boolean swapBookmarkWithBoostAction;
|
||||
public static boolean loadRemoteAccountFollowers;
|
||||
public static boolean mentionRebloggerAutomatically;
|
||||
public static String publishButtonText;
|
||||
public static ThemePreference theme;
|
||||
public static ColorPreference color;
|
||||
|
@ -122,6 +123,7 @@ public class GlobalUserPreferences{
|
|||
confirmBeforeReblog=prefs.getBoolean("confirmBeforeReblog", false);
|
||||
swapBookmarkWithBoostAction=prefs.getBoolean("swapBookmarkWithBoostAction", false);
|
||||
loadRemoteAccountFollowers=prefs.getBoolean("loadRemoteAccountFollowers", true);
|
||||
mentionRebloggerAutomatically=prefs.getBoolean("mentionRebloggerAutomatically", false);
|
||||
publishButtonText=prefs.getString("publishButtonText", "");
|
||||
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
|
||||
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
|
||||
|
@ -181,6 +183,7 @@ public class GlobalUserPreferences{
|
|||
.putBoolean("confirmBeforeReblog", confirmBeforeReblog)
|
||||
.putBoolean("swapBookmarkWithBoostAction", swapBookmarkWithBoostAction)
|
||||
.putBoolean("loadRemoteAccountFollowers", loadRemoteAccountFollowers)
|
||||
.putBoolean("mentionRebloggerAutomatically", mentionRebloggerAutomatically)
|
||||
.putInt("theme", theme.ordinal())
|
||||
.putString("color", color.name())
|
||||
.putString("recentLanguages", gson.toJson(recentLanguages))
|
||||
|
|
|
@ -731,6 +731,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
|||
String ownID=AccountSessionManager.getInstance().getAccount(accountID).self.id;
|
||||
if(!status.account.id.equals(ownID))
|
||||
mentions.add('@'+status.account.acct);
|
||||
if(status.rebloggedBy != null && GlobalUserPreferences.mentionRebloggerAutomatically)
|
||||
mentions.add('@'+status.rebloggedBy.acct);
|
||||
for(Mention mention:status.mentions){
|
||||
if(mention.id.equals(ownID))
|
||||
continue;
|
||||
|
|
|
@ -249,6 +249,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||
GlobalUserPreferences.defaultToUnlistedReplies=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
}));
|
||||
// TODO find a good icon for this setting
|
||||
items.add(new SwitchItem(R.string.mo_mention_reblogger_automatically, R.drawable.ic_fluent_balloon_24_regular, GlobalUserPreferences.mentionRebloggerAutomatically, i -> {
|
||||
GlobalUserPreferences.mentionRebloggerAutomatically=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
}));
|
||||
items.add(new SwitchItem(R.string.mo_disable_reminder_to_add_alt_text, R.drawable.ic_fluent_image_alt_text_24_regular, GlobalUserPreferences.disableAltTextReminder, i->{
|
||||
GlobalUserPreferences.disableAltTextReminder=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
|
|
|
@ -3,6 +3,8 @@ package org.joinmastodon.android.model;
|
|||
import static org.joinmastodon.android.api.MastodonAPIController.gson;
|
||||
import static org.joinmastodon.android.api.MastodonAPIController.gsonWithoutDeserializer;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.gson.JsonDeserializationContext;
|
||||
import com.google.gson.JsonDeserializer;
|
||||
import com.google.gson.JsonElement;
|
||||
|
@ -60,6 +62,8 @@ public class Status extends BaseModel implements DisplayItemsParent, Searchable{
|
|||
public Card card;
|
||||
public String language;
|
||||
public String text;
|
||||
@Nullable
|
||||
public Account rebloggedBy;
|
||||
public boolean localOnly;
|
||||
|
||||
public boolean favourited;
|
||||
|
|
|
@ -132,6 +132,7 @@ public abstract class StatusDisplayItem{
|
|||
|
||||
if(status.reblog!=null){
|
||||
boolean isOwnPost = AccountSessionManager.getInstance().isSelf(fragment.getAccountID(), status.account);
|
||||
statusForContent.rebloggedBy = status.account;
|
||||
String fullText = fragment.getString(R.string.user_boosted, status.account.displayName);
|
||||
String text = GlobalUserPreferences.compactReblogReplyLine && replyLine != null ? status.account.displayName : fullText;
|
||||
items.add(new ReblogOrReplyLineStatusDisplayItem(parentID, fragment, text, status.account.emojis, R.drawable.ic_fluent_arrow_repeat_all_20_filled, isOwnPost ? status.visibility : null, i->{
|
||||
|
|
|
@ -54,4 +54,5 @@
|
|||
<string name="mo_swap_bookmark_with_reblog">Use reblog action instead of bookmark action on notifications</string>
|
||||
<string name="mo_download_latest_nightly_release">Download latest nightly release</string>
|
||||
<string name="mo_load_remote_followers">Load remote profile follows and followers</string>
|
||||
<string name="mo_mention_reblogger_automatically">Automatically mention account who reblogged the post in replies</string>
|
||||
</resources>
|
Loading…
Add table
Reference in a new issue