From 30fffcd9ca38c5612fe0a2a9de0d0c881ebd7466 Mon Sep 17 00:00:00 2001 From: Levi Bard Date: Wed, 9 May 2018 23:04:00 +0200 Subject: [PATCH] When replying, set default post visibility to the most restrictive of: original post visibility, default visibility preference. (#641) Issue #636 --- .../com/keylesspalace/tusky/ComposeActivity.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 82b0b5b90..61884e96f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -372,17 +372,14 @@ public final class ComposeActivity if (intent != null) { if (startingVisibility == Status.Visibility.UNKNOWN) { + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); + Status.Visibility preferredVisibility = Status.Visibility.byString( + preferences.getString("defaultPostPrivacy", + Status.Visibility.PUBLIC.serverString())); Status.Visibility replyVisibility = Status.Visibility.byNum( intent.getIntExtra(REPLY_VISIBILITY_EXTRA, Status.Visibility.UNKNOWN.getNum())); - if (replyVisibility != Status.Visibility.UNKNOWN) { - startingVisibility = replyVisibility; - } else { - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); - startingVisibility = Status.Visibility.byString( - preferences.getString("defaultPostPrivacy", - Status.Visibility.PUBLIC.serverString())); - } + startingVisibility = Status.Visibility.byNum(Math.max(preferredVisibility.getNum(), replyVisibility.getNum())); } inReplyToId = intent.getStringExtra(IN_REPLY_TO_ID_EXTRA);