From 8fb5960940743427b5ebea283e0e8da14b2125a1 Mon Sep 17 00:00:00 2001 From: 12aw Date: Sat, 17 Feb 2024 12:31:48 +0100 Subject: [PATCH] Only show subject feature when encryption disabled --- git/release/output-metadata.json | 52 +++++++++---------- .../ui/ConversationFragment.java | 2 + .../ui/ConversationsActivity.java | 1 - .../ui/util/ConversationMenuConfigurator.java | 12 +++-- 4 files changed, 37 insertions(+), 30 deletions(-) diff --git a/git/release/output-metadata.json b/git/release/output-metadata.json index 2b45f62495..f48299efc3 100644 --- a/git/release/output-metadata.json +++ b/git/release/output-metadata.json @@ -15,32 +15,6 @@ "versionName": "1.7.8.9", "outputFile": "monocles chat-1.7.8.9-git-universal-release.apk" }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "arm64-v8a" - } - ], - "attributes": [], - "versionCode": 16004, - "versionName": "1.7.8.9", - "outputFile": "monocles chat-1.7.8.9-git-arm64-v8a-release.apk" - }, - { - "type": "ONE_OF_MANY", - "filters": [ - { - "filterType": "ABI", - "value": "x86" - } - ], - "attributes": [], - "versionCode": 16002, - "versionName": "1.7.8.9", - "outputFile": "monocles chat-1.7.8.9-git-x86-release.apk" - }, { "type": "ONE_OF_MANY", "filters": [ @@ -66,6 +40,32 @@ "versionCode": 16001, "versionName": "1.7.8.9", "outputFile": "monocles chat-1.7.8.9-git-armeabi-v7a-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "x86" + } + ], + "attributes": [], + "versionCode": 16002, + "versionName": "1.7.8.9", + "outputFile": "monocles chat-1.7.8.9-git-x86-release.apk" + }, + { + "type": "ONE_OF_MANY", + "filters": [ + { + "filterType": "ABI", + "value": "arm64-v8a" + } + ], + "attributes": [], + "versionCode": 16004, + "versionName": "1.7.8.9", + "outputFile": "monocles chat-1.7.8.9-git-arm64-v8a-release.apk" } ], "elementType": "File" diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index df65cdb5ce..a7ade33ddd 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -798,6 +798,7 @@ public class ConversationFragment extends XmppFragment @Override public void onClick(View v) { + ConversationMenuConfigurator.reloadFeatures(conversation, activity); Object tag = v.getTag(); if (tag instanceof SendButtonAction) { SendButtonAction action = (SendButtonAction) tag; @@ -3977,6 +3978,7 @@ public class ConversationFragment extends XmppFragment this.binding.textinput.setKeyboardListener(null); this.binding.textinputSubject.setKeyboardListener(null); showRecordVoiceButton(); + ConversationMenuConfigurator.reloadFeatures(conversation, activity); final boolean participating = conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating(); if (participating) { this.binding.textinput.setText(this.conversation.getNextMessage()); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 234b347fd1..3372b943a9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -712,7 +712,6 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio EasyLock.checkPassword(this); } super.onCreate(savedInstanceState); - ConversationMenuConfigurator.reloadFeatures(this); OmemoSetting.load(this); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations); setSupportActionBar((Toolbar) binding.toolbar.getRoot()); diff --git a/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java b/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java index 4c0e9a6bbc..fbd414a49d 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java +++ b/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java @@ -49,11 +49,17 @@ public class ConversationMenuConfigurator { private static boolean microphoneAvailable = false; private static boolean locationAvailable = false; private static boolean cameraAvailable = false; + private static boolean attachSubject = false; - public static void reloadFeatures(Context context) { + public static void reloadFeatures(@NonNull Conversation conversation, Context context) { microphoneAvailable = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MICROPHONE); cameraAvailable = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY); locationAvailable = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS) || context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK); + if (conversation.getNextEncryption()== Message.ENCRYPTION_NONE) { + attachSubject = true; + } else { + attachSubject = false; + } } public static void configureQuickShareAttachmentMenu(@NonNull Conversation conversation, Menu menu, boolean hideVoiceAndTakePicture) { @@ -68,7 +74,7 @@ public class ConversationMenuConfigurator { menu.findItem(R.id.attach_record_voice).setVisible(microphoneAvailable); menu.findItem(R.id.attach_take_picture).setVisible(cameraAvailable); menu.findItem(R.id.attach_location).setVisible(locationAvailable); - menu.findItem(R.id.attach_subject).setVisible(true); + menu.findItem(R.id.attach_subject).setVisible(attachSubject); } public static void configureAttachmentMenu(@NonNull Conversation conversation, Menu menu, Boolean Quick_share_attachment_choice, boolean hasAttachments) { @@ -100,7 +106,7 @@ public class ConversationMenuConfigurator { menu.findItem(R.id.attach_record_voice).setVisible(microphoneAvailable); menu.findItem(R.id.attach_take_picture).setVisible(cameraAvailable); menu.findItem(R.id.attach_location).setVisible(locationAvailable); - menu.findItem(R.id.attach_subject).setVisible(true); + menu.findItem(R.id.attach_subject).setVisible(attachSubject); } public static void configureEncryptionMenu(@NonNull Conversation conversation, Menu menu, final XmppActivity activity) {