use saved default status visibility
This commit is contained in:
parent
60d4e4d396
commit
abe28179ec
|
@ -244,8 +244,6 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
charLimit=instance.configuration.statuses.maxCharacters;
|
charLimit=instance.configuration.statuses.maxCharacters;
|
||||||
else
|
else
|
||||||
charLimit=500;
|
charLimit=500;
|
||||||
|
|
||||||
loadDefaultStatusVisibility(savedInstanceState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -400,6 +398,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
statusVisibility=editingStatus.visibility;
|
statusVisibility=editingStatus.visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadDefaultStatusVisibility(savedInstanceState);
|
||||||
updateVisibilityIcon();
|
updateVisibilityIcon();
|
||||||
|
|
||||||
autocompleteViewController=new ComposeAutocompleteViewController(getActivity(), accountID);
|
autocompleteViewController=new ComposeAutocompleteViewController(getActivity(), accountID);
|
||||||
|
@ -1450,34 +1449,23 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
statusVisibility = (StatusPrivacy) savedInstanceState.getSerializable("visibility");
|
statusVisibility = (StatusPrivacy) savedInstanceState.getSerializable("visibility");
|
||||||
}
|
}
|
||||||
|
|
||||||
new GetPreferences()
|
Preferences prefs = AccountSessionManager.getInstance().getAccount(accountID).preferences;
|
||||||
.setCallback(new Callback<>(){
|
if (prefs != null) {
|
||||||
@Override
|
// Only override the reply visibility if our preference is more private
|
||||||
public void onSuccess(Preferences result){
|
if (prefs.postingDefaultVisibility.isLessVisibleThan(statusVisibility)) {
|
||||||
// Only override the reply visibility if our preference is more private
|
statusVisibility = switch (prefs.postingDefaultVisibility) {
|
||||||
if (result.postingDefaultVisibility.isLessVisibleThan(statusVisibility)) {
|
case PUBLIC -> StatusPrivacy.PUBLIC;
|
||||||
statusVisibility = switch (result.postingDefaultVisibility) {
|
case UNLISTED -> StatusPrivacy.UNLISTED;
|
||||||
case PUBLIC -> StatusPrivacy.PUBLIC;
|
case PRIVATE -> StatusPrivacy.PRIVATE;
|
||||||
case UNLISTED -> StatusPrivacy.UNLISTED;
|
case DIRECT -> StatusPrivacy.DIRECT;
|
||||||
case PRIVATE -> StatusPrivacy.PRIVATE;
|
};
|
||||||
case DIRECT -> StatusPrivacy.DIRECT;
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// A saved privacy setting from a previous compose session wins over all
|
// A saved privacy setting from a previous compose session wins over all
|
||||||
if(savedInstanceState !=null){
|
if(savedInstanceState !=null){
|
||||||
statusVisibility = (StatusPrivacy) savedInstanceState.getSerializable("visibility");
|
statusVisibility = (StatusPrivacy) savedInstanceState.getSerializable("visibility");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
updateVisibilityIcon ();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(ErrorResponse error){
|
|
||||||
Log.w(TAG, "Unable to get user preferences to set default post privacy");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.exec(accountID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVisibilityIcon(){
|
private void updateVisibilityIcon(){
|
||||||
|
|
Loading…
Reference in New Issue