support akkoma local visibility
This commit is contained in:
parent
d7feb78197
commit
eb0fcda3cc
|
@ -491,6 +491,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
case UNLISTED -> R.id.vis_unlisted;
|
case UNLISTED -> R.id.vis_unlisted;
|
||||||
case PRIVATE -> R.id.vis_followers;
|
case PRIVATE -> R.id.vis_followers;
|
||||||
case DIRECT -> R.id.vis_private;
|
case DIRECT -> R.id.vis_private;
|
||||||
|
case LOCAL -> R.id.local_only;
|
||||||
}).setChecked(true);
|
}).setChecked(true);
|
||||||
visibilityPopup.getMenu().findItem(R.id.local_only).setChecked(localOnly);
|
visibilityPopup.getMenu().findItem(R.id.local_only).setChecked(localOnly);
|
||||||
|
|
||||||
|
@ -679,6 +680,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
case UNLISTED -> R.drawable.ic_fluent_people_community_20_regular;
|
case UNLISTED -> R.drawable.ic_fluent_people_community_20_regular;
|
||||||
case PRIVATE -> R.drawable.ic_fluent_people_checkmark_20_regular;
|
case PRIVATE -> R.drawable.ic_fluent_people_checkmark_20_regular;
|
||||||
case DIRECT -> R.drawable.ic_fluent_mention_20_regular;
|
case DIRECT -> R.drawable.ic_fluent_mention_20_regular;
|
||||||
|
case LOCAL -> R.drawable.ic_fluent_eye_20_regular;
|
||||||
});
|
});
|
||||||
ImageView moreBtn = view.findViewById(R.id.more);
|
ImageView moreBtn = view.findViewById(R.id.more);
|
||||||
moreBtn.setImageDrawable(visibilityIcon);
|
moreBtn.setImageDrawable(visibilityIcon);
|
||||||
|
@ -697,7 +699,14 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
else view.findViewById(R.id.display_item_text).setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, V.dp(16)));
|
else view.findViewById(R.id.display_item_text).setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, V.dp(16)));
|
||||||
|
|
||||||
replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName));
|
replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName));
|
||||||
replyText.setContentDescription(getString(R.string.in_reply_to, replyTo.account.displayName) + ". " + getString(R.string.post_visibility) + ": " + UiUtils.getVisibilityText(replyTo));
|
int visibilityNameRes = switch (replyTo.visibility) {
|
||||||
|
case PUBLIC -> R.string.visibility_public;
|
||||||
|
case UNLISTED -> R.string.sk_visibility_unlisted;
|
||||||
|
case PRIVATE -> R.string.visibility_followers_only;
|
||||||
|
case DIRECT -> R.string.visibility_private;
|
||||||
|
case LOCAL -> R.string.sk_local_only;
|
||||||
|
};
|
||||||
|
replyText.setContentDescription(getString(R.string.in_reply_to, replyTo.account.displayName) + ". " + getString(R.string.post_visibility) + ": " + getString(visibilityNameRes));
|
||||||
replyText.setOnClickListener(v->{
|
replyText.setOnClickListener(v->{
|
||||||
scrollView.smoothScrollTo(0, 0);
|
scrollView.smoothScrollTo(0, 0);
|
||||||
});
|
});
|
||||||
|
@ -1041,7 +1050,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
}
|
}
|
||||||
req.status=text;
|
req.status=text;
|
||||||
req.localOnly=localOnly;
|
req.localOnly=localOnly;
|
||||||
req.visibility=statusVisibility;
|
req.visibility=localOnly && instance.pleroma != null ? StatusPrivacy.LOCAL : statusVisibility;
|
||||||
req.sensitive=sensitive;
|
req.sensitive=sensitive;
|
||||||
req.language=language;
|
req.language=language;
|
||||||
req.scheduledAt = scheduledAt;
|
req.scheduledAt = scheduledAt;
|
||||||
|
@ -1901,12 +1910,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
// (and we're not replying to ourselves, or not at all)
|
// (and we're not replying to ourselves, or not at all)
|
||||||
if (prefs.postingDefaultVisibility.isLessVisibleThan(statusVisibility) &&
|
if (prefs.postingDefaultVisibility.isLessVisibleThan(statusVisibility) &&
|
||||||
(replyTo == null || !asm.isSelf(accountID, replyTo.account))) {
|
(replyTo == null || !asm.isSelf(accountID, replyTo.account))) {
|
||||||
statusVisibility = switch (prefs.postingDefaultVisibility) {
|
statusVisibility = prefs.postingDefaultVisibility;
|
||||||
case PUBLIC -> StatusPrivacy.PUBLIC;
|
|
||||||
case UNLISTED -> StatusPrivacy.UNLISTED;
|
|
||||||
case PRIVATE -> StatusPrivacy.PRIVATE;
|
|
||||||
case DIRECT -> StatusPrivacy.DIRECT;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1925,6 +1929,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
case UNLISTED -> R.drawable.ic_fluent_people_community_24_regular;
|
case UNLISTED -> R.drawable.ic_fluent_people_community_24_regular;
|
||||||
case PRIVATE -> R.drawable.ic_fluent_people_checkmark_24_regular;
|
case PRIVATE -> R.drawable.ic_fluent_people_checkmark_24_regular;
|
||||||
case DIRECT -> R.drawable.ic_fluent_mention_24_regular;
|
case DIRECT -> R.drawable.ic_fluent_mention_24_regular;
|
||||||
|
case LOCAL -> R.drawable.ic_fluent_eye_24_regular;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
items.add(new TextItem(R.string.sk_settings_auth, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/auth/edit"), R.drawable.ic_fluent_open_24_regular));
|
items.add(new TextItem(R.string.sk_settings_auth, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/auth/edit"), R.drawable.ic_fluent_open_24_regular));
|
||||||
|
|
||||||
items.add(new HeaderItem(instanceName));
|
items.add(new HeaderItem(instanceName));
|
||||||
|
items.add(new TextItem(R.string.log_out, this::confirmLogOut, R.drawable.ic_fluent_sign_out_24_regular));
|
||||||
items.add(new TextItem(R.string.sk_settings_rules, ()->{
|
items.add(new TextItem(R.string.sk_settings_rules, ()->{
|
||||||
Bundle args=new Bundle();
|
Bundle args=new Bundle();
|
||||||
args.putParcelable("instance", Parcels.wrap(instance));
|
args.putParcelable("instance", Parcels.wrap(instance));
|
||||||
|
@ -292,8 +293,10 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
glitchModeItem.enabled = i.checked;
|
glitchModeItem.enabled = i.checked;
|
||||||
if (i.checked) {
|
if (i.checked) {
|
||||||
GlobalUserPreferences.accountsWithLocalOnlySupport.add(accountID);
|
GlobalUserPreferences.accountsWithLocalOnlySupport.add(accountID);
|
||||||
|
if (instance.pleroma == null) GlobalUserPreferences.accountsInGlitchMode.add(accountID);
|
||||||
} else {
|
} else {
|
||||||
GlobalUserPreferences.accountsWithLocalOnlySupport.remove(accountID);
|
GlobalUserPreferences.accountsWithLocalOnlySupport.remove(accountID);
|
||||||
|
GlobalUserPreferences.accountsInGlitchMode.remove(accountID);
|
||||||
}
|
}
|
||||||
if (list.findViewHolderForAdapterPosition(items.indexOf(glitchModeItem)) instanceof SwitchViewHolder svh) svh.rebind();
|
if (list.findViewHolderForAdapterPosition(items.indexOf(glitchModeItem)) instanceof SwitchViewHolder svh) svh.rebind();
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
|
@ -307,6 +310,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
}));
|
}));
|
||||||
glitchModeItem.enabled = GlobalUserPreferences.accountsWithLocalOnlySupport.contains(accountID);
|
glitchModeItem.enabled = GlobalUserPreferences.accountsWithLocalOnlySupport.contains(accountID);
|
||||||
|
items.add(new SmallTextItem(getString(R.string.sk_settings_local_only_explanation)));
|
||||||
|
|
||||||
|
|
||||||
boolean translationAvailable = instance.v2 != null && instance.v2.configuration.translation != null && instance.v2.configuration.translation.enabled;
|
boolean translationAvailable = instance.v2 != null && instance.v2.configuration.translation != null && instance.v2.configuration.translation.enabled;
|
||||||
|
|
|
@ -84,6 +84,8 @@ public class Instance extends BaseModel{
|
||||||
|
|
||||||
public V2 v2;
|
public V2 v2;
|
||||||
|
|
||||||
|
public Pleroma pleroma;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postprocess() throws ObjectValidationException{
|
public void postprocess() throws ObjectValidationException{
|
||||||
super.postprocess();
|
super.postprocess();
|
||||||
|
@ -193,4 +195,9 @@ public class Instance extends BaseModel{
|
||||||
public boolean enabled;
|
public boolean enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Parcel
|
||||||
|
public static class Pleroma extends BaseModel {
|
||||||
|
// metadata etc
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class Status extends BaseModel implements DisplayItemsParent{
|
||||||
reblog.postprocess();
|
reblog.postprocess();
|
||||||
|
|
||||||
spoilerRevealed=GlobalUserPreferences.alwaysExpandContentWarnings || !sensitive;
|
spoilerRevealed=GlobalUserPreferences.alwaysExpandContentWarnings || !sensitive;
|
||||||
|
if (visibility.equals(StatusPrivacy.LOCAL)) localOnly = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,7 +10,9 @@ public enum StatusPrivacy{
|
||||||
@SerializedName("private")
|
@SerializedName("private")
|
||||||
PRIVATE(2),
|
PRIVATE(2),
|
||||||
@SerializedName("direct")
|
@SerializedName("direct")
|
||||||
DIRECT(3);
|
DIRECT(3),
|
||||||
|
@SerializedName("local")
|
||||||
|
LOCAL(4); // akkoma
|
||||||
|
|
||||||
private int privacy;
|
private int privacy;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,8 @@ public class ExtendedFooterStatusDisplayItem extends StatusDisplayItem{
|
||||||
case PUBLIC -> R.drawable.ic_fluent_earth_20_regular;
|
case PUBLIC -> R.drawable.ic_fluent_earth_20_regular;
|
||||||
case UNLISTED -> R.drawable.ic_fluent_people_community_20_regular;
|
case UNLISTED -> R.drawable.ic_fluent_people_community_20_regular;
|
||||||
case PRIVATE -> R.drawable.ic_fluent_people_checkmark_20_regular;
|
case PRIVATE -> R.drawable.ic_fluent_people_checkmark_20_regular;
|
||||||
case DIRECT -> R.drawable.ic_fluent_mention_24_regular;
|
case DIRECT -> R.drawable.ic_fluent_mention_20_regular;
|
||||||
|
case LOCAL -> R.drawable.ic_fluent_eye_20_regular;
|
||||||
});
|
});
|
||||||
|
|
||||||
visibility.setContentDescription(UiUtils.getVisibilityText(s));
|
visibility.setContentDescription(UiUtils.getVisibilityText(s));
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="20dp" android:height="20dp" android:viewportWidth="20" android:viewportHeight="20">
|
||||||
|
<path android:pathData="M3.26 11.602C3.942 8.327 6.793 6 10 6c3.206 0 6.057 2.327 6.74 5.602 0.057 0.27 0.322 0.444 0.593 0.387 0.27-0.056 0.443-0.32 0.387-0.591C16.943 7.673 13.693 5 10 5c-3.693 0-6.943 2.673-7.72 6.398-0.056 0.27 0.117 0.535 0.388 0.591 0.27 0.057 0.535-0.117 0.591-0.387zM10 8c-1.933 0-3.5 1.567-3.5 3.5S8.067 15 10 15s3.5-1.567 3.5-3.5S11.933 8 10 8zm-2.5 3.5C7.5 10.12 8.62 9 10 9s2.5 1.12 2.5 2.5S11.38 14 10 14s-2.5-1.12-2.5-2.5z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||||
|
</vector>
|
Loading…
Reference in New Issue