hide fingerprints in UI if encryption is disabled
This commit is contained in:
		
							parent
							
								
									5137837f6d
								
							
						
					
					
						commit
						83adbb6052
					
				| @ -390,35 +390,39 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd | |||||||
| 		keys.removeAllViews(); | 		keys.removeAllViews(); | ||||||
| 		boolean hasKeys = false; | 		boolean hasKeys = false; | ||||||
| 		LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); | 		LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||||||
| 		for(final String otrFingerprint : contact.getOtrFingerprints()) { | 		if (Config.supportOtr()) { | ||||||
| 			hasKeys = true; | 			for (final String otrFingerprint : contact.getOtrFingerprints()) { | ||||||
| 			View view = inflater.inflate(R.layout.contact_key, keys, false); | 				hasKeys = true; | ||||||
| 			TextView key = (TextView) view.findViewById(R.id.key); | 				View view = inflater.inflate(R.layout.contact_key, keys, false); | ||||||
| 			TextView keyType = (TextView) view.findViewById(R.id.key_type); | 				TextView key = (TextView) view.findViewById(R.id.key); | ||||||
| 			ImageButton removeButton = (ImageButton) view | 				TextView keyType = (TextView) view.findViewById(R.id.key_type); | ||||||
| 				.findViewById(R.id.button_remove); | 				ImageButton removeButton = (ImageButton) view | ||||||
| 			removeButton.setVisibility(View.VISIBLE); | 						.findViewById(R.id.button_remove); | ||||||
| 			keyType.setText("OTR Fingerprint"); | 				removeButton.setVisibility(View.VISIBLE); | ||||||
| 			key.setText(CryptoHelper.prettifyFingerprint(otrFingerprint)); | 				keyType.setText("OTR Fingerprint"); | ||||||
| 			keys.addView(view); | 				key.setText(CryptoHelper.prettifyFingerprint(otrFingerprint)); | ||||||
| 			removeButton.setOnClickListener(new OnClickListener() { | 				keys.addView(view); | ||||||
|  | 				removeButton.setOnClickListener(new OnClickListener() { | ||||||
| 
 | 
 | ||||||
| 				@Override | 					@Override | ||||||
| 				public void onClick(View v) { | 					public void onClick(View v) { | ||||||
| 					confirmToDeleteFingerprint(otrFingerprint); | 						confirmToDeleteFingerprint(otrFingerprint); | ||||||
| 				} | 					} | ||||||
| 			}); | 				}); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		for (final String fingerprint : contact.getAccount().getAxolotlService().getFingerprintsForContact(contact)) { | 		if (Config.supportOmemo()) { | ||||||
| 			boolean highlight = fingerprint.equals(messageFingerprint); | 			for (final String fingerprint : contact.getAccount().getAxolotlService().getFingerprintsForContact(contact)) { | ||||||
| 			hasKeys |= addFingerprintRow(keys, contact.getAccount(), fingerprint, highlight, new OnClickListener() { | 				boolean highlight = fingerprint.equals(messageFingerprint); | ||||||
| 				@Override | 				hasKeys |= addFingerprintRow(keys, contact.getAccount(), fingerprint, highlight, new OnClickListener() { | ||||||
| 				public void onClick(View v) { | 					@Override | ||||||
| 					onOmemoKeyClicked(contact.getAccount(), fingerprint); | 					public void onClick(View v) { | ||||||
| 				} | 						onOmemoKeyClicked(contact.getAccount(), fingerprint); | ||||||
| 			}); | 					} | ||||||
|  | 				}); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 		if (contact.getPgpKeyId() != 0) { | 		if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) { | ||||||
| 			hasKeys = true; | 			hasKeys = true; | ||||||
| 			View view = inflater.inflate(R.layout.contact_key, keys, false); | 			View view = inflater.inflate(R.layout.contact_key, keys, false); | ||||||
| 			TextView key = (TextView) view.findViewById(R.id.key); | 			TextView key = (TextView) view.findViewById(R.id.key); | ||||||
|  | |||||||
| @ -390,8 +390,11 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa | |||||||
| 		} else { | 		} else { | ||||||
| 			switch (conversation.getNextEncryption()) { | 			switch (conversation.getNextEncryption()) { | ||||||
| 				case Message.ENCRYPTION_NONE: | 				case Message.ENCRYPTION_NONE: | ||||||
| 					mEditMessage | 					if (Config.multipleEncryptionChoices()) { | ||||||
| 							.setHint(getString(R.string.send_unencrypted_message)); | 						mEditMessage.setHint(getString(R.string.send_unencrypted_message)); | ||||||
|  | 					} else { | ||||||
|  | 						mEditMessage.setHint(getString(R.string.send_message_to_x,conversation.getName())); | ||||||
|  | 					} | ||||||
| 					break; | 					break; | ||||||
| 				case Message.ENCRYPTION_OTR: | 				case Message.ENCRYPTION_OTR: | ||||||
| 					mEditMessage.setHint(getString(R.string.send_otr_message)); | 					mEditMessage.setHint(getString(R.string.send_otr_message)); | ||||||
|  | |||||||
| @ -523,7 +523,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate | |||||||
| 			} | 			} | ||||||
| 			mamPrefs.setVisible(mAccount.getXmppConnection().getFeatures().mam()); | 			mamPrefs.setVisible(mAccount.getXmppConnection().getFeatures().mam()); | ||||||
| 			Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds(); | 			Set<Integer> otherDevices = mAccount.getAxolotlService().getOwnDeviceIds(); | ||||||
| 			if (otherDevices == null || otherDevices.isEmpty()) { | 			if (otherDevices == null || otherDevices.isEmpty() || Config.supportOmemo()) { | ||||||
| 				clearDevices.setVisible(false); | 				clearDevices.setVisible(false); | ||||||
| 			} | 			} | ||||||
| 			changePresence.setVisible(manuallyChangePresence()); | 			changePresence.setVisible(manuallyChangePresence()); | ||||||
| @ -776,7 +776,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate | |||||||
| 				this.mServerInfoPush.setText(R.string.server_info_unavailable); | 				this.mServerInfoPush.setText(R.string.server_info_unavailable); | ||||||
| 			} | 			} | ||||||
| 			final String otrFingerprint = this.mAccount.getOtrFingerprint(); | 			final String otrFingerprint = this.mAccount.getOtrFingerprint(); | ||||||
| 			if (otrFingerprint != null) { | 			if (otrFingerprint != null && Config.supportOtr()) { | ||||||
| 				this.mOtrFingerprintBox.setVisibility(View.VISIBLE); | 				this.mOtrFingerprintBox.setVisibility(View.VISIBLE); | ||||||
| 				this.mOtrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint)); | 				this.mOtrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint)); | ||||||
| 				this.mOtrFingerprintToClipboardButton | 				this.mOtrFingerprintToClipboardButton | ||||||
| @ -798,10 +798,10 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate | |||||||
| 			} else { | 			} else { | ||||||
| 				this.mOtrFingerprintBox.setVisibility(View.GONE); | 				this.mOtrFingerprintBox.setVisibility(View.GONE); | ||||||
| 			} | 			} | ||||||
| 			final String axolotlFingerprint = this.mAccount.getAxolotlService().getOwnFingerprint(); | 			final String ownAxolotlFingerprint = this.mAccount.getAxolotlService().getOwnFingerprint(); | ||||||
| 			if (axolotlFingerprint != null) { | 			if (ownAxolotlFingerprint != null && Config.supportOmemo()) { | ||||||
| 				this.mAxolotlFingerprintBox.setVisibility(View.VISIBLE); | 				this.mAxolotlFingerprintBox.setVisibility(View.VISIBLE); | ||||||
| 				this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(axolotlFingerprint.substring(2))); | 				this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(ownAxolotlFingerprint.substring(2))); | ||||||
| 				this.mAxolotlFingerprintToClipboardButton | 				this.mAxolotlFingerprintToClipboardButton | ||||||
| 						.setVisibility(View.VISIBLE); | 						.setVisibility(View.VISIBLE); | ||||||
| 				this.mAxolotlFingerprintToClipboardButton | 				this.mAxolotlFingerprintToClipboardButton | ||||||
| @ -810,7 +810,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate | |||||||
| 							@Override | 							@Override | ||||||
| 							public void onClick(final View v) { | 							public void onClick(final View v) { | ||||||
| 
 | 
 | ||||||
| 								if (copyTextToClipboard(axolotlFingerprint.substring(2), R.string.omemo_fingerprint)) { | 								if (copyTextToClipboard(ownAxolotlFingerprint.substring(2), R.string.omemo_fingerprint)) { | ||||||
| 									Toast.makeText( | 									Toast.makeText( | ||||||
| 											EditAccountActivity.this, | 											EditAccountActivity.this, | ||||||
| 											R.string.toast_message_omemo_fingerprint, | 											R.string.toast_message_omemo_fingerprint, | ||||||
| @ -833,17 +833,16 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate | |||||||
| 			} else { | 			} else { | ||||||
| 				this.mAxolotlFingerprintBox.setVisibility(View.GONE); | 				this.mAxolotlFingerprintBox.setVisibility(View.GONE); | ||||||
| 			} | 			} | ||||||
| 			final String ownFingerprint = mAccount.getAxolotlService().getOwnFingerprint(); |  | ||||||
| 			boolean hasKeys = false; | 			boolean hasKeys = false; | ||||||
| 			keys.removeAllViews(); | 			keys.removeAllViews(); | ||||||
| 			for (final String fingerprint : mAccount.getAxolotlService().getFingerprintsForOwnSessions()) { | 			for (final String fingerprint : mAccount.getAxolotlService().getFingerprintsForOwnSessions()) { | ||||||
| 				if (ownFingerprint.equals(fingerprint)) { | 				if (ownAxolotlFingerprint.equals(fingerprint)) { | ||||||
| 					continue; | 					continue; | ||||||
| 				} | 				} | ||||||
| 				boolean highlight = fingerprint.equals(messageFingerprint); | 				boolean highlight = fingerprint.equals(messageFingerprint); | ||||||
| 				hasKeys |= addFingerprintRow(keys, mAccount, fingerprint, highlight, null); | 				hasKeys |= addFingerprintRow(keys, mAccount, fingerprint, highlight, null); | ||||||
| 			} | 			} | ||||||
| 			if (hasKeys) { | 			if (hasKeys && Config.supportOmemo()) { | ||||||
| 				keysCard.setVisibility(View.VISIBLE); | 				keysCard.setVisibility(View.VISIBLE); | ||||||
| 			} else { | 			} else { | ||||||
| 				keysCard.setVisibility(View.GONE); | 				keysCard.setVisibility(View.GONE); | ||||||
|  | |||||||
| @ -81,6 +81,7 @@ | |||||||
| 	<string name="also_end_conversation">End this conversation afterwards</string> | 	<string name="also_end_conversation">End this conversation afterwards</string> | ||||||
| 	<string name="choose_presence">Choose presence to contact</string> | 	<string name="choose_presence">Choose presence to contact</string> | ||||||
| 	<string name="send_unencrypted_message">Send unencrypted message</string> | 	<string name="send_unencrypted_message">Send unencrypted message</string> | ||||||
|  | 	<string name="send_message_to_x">Send message to %s</string> | ||||||
| 	<string name="send_otr_message">Send OTR encrypted message</string> | 	<string name="send_otr_message">Send OTR encrypted message</string> | ||||||
| 	<string name="send_omemo_message">Send OMEMO encrypted message</string> | 	<string name="send_omemo_message">Send OMEMO encrypted message</string> | ||||||
| 	<string name="send_omemo_x509_message">Send v\\OMEMO encrypted message</string> | 	<string name="send_omemo_x509_message">Send v\\OMEMO encrypted message</string> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Daniel Gultsch
						Daniel Gultsch