Only show subject feature when encryption disabled

This commit is contained in:
12aw 2024-02-17 12:31:48 +01:00
parent 1df1266f39
commit 8fb5960940
4 changed files with 37 additions and 30 deletions

View file

@ -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"

View file

@ -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());

View file

@ -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());

View file

@ -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) {