Allow notifications for all fields

This commit is contained in:
J-Jamet
2018-03-20 15:04:44 +01:00
parent 62f6f02467
commit ae00fd5782
2 changed files with 15 additions and 6 deletions

View File

@@ -147,7 +147,7 @@ public class EntryActivity extends LockingHideActivity {
// If notifications enabled in settings
// Don't if application timeout
if (firstLaunchOfActivity && !App.isShutdown() && isClipboardNotificationsEnable(getApplicationContext())) {
if (mEntry.getPassword().length() > 0) {
if (mEntry.getUsername().length() > 0 || mEntry.getPassword().length() > 0 || mEntry.containsExtraFields()) {
// username already copied, waiting for user's action before copy password.
Intent intent = new Intent(this, NotificationCopyingService.class);
intent.setAction(NotificationCopyingService.ACTION_NEW_NOTIFICATION);
@@ -163,11 +163,12 @@ public class EntryActivity extends LockingHideActivity {
mEntry.getUsername(),
getResources()));
// Add password to notifications
notificationFields.add(
new NotificationField(
NotificationField.NotificationFieldId.PASSWORD,
mEntry.getPassword(),
getResources()));
if (mEntry.getPassword().length() > 0)
notificationFields.add(
new NotificationField(
NotificationField.NotificationFieldId.PASSWORD,
mEntry.getPassword(),
getResources()));
// Add extra fields
if (mEntry.allowExtraFields()) {
try {

View File

@@ -163,6 +163,14 @@ public abstract class PwEntry extends PwNode implements Cloneable {
return new HashMap<>();
}
/**
* If entry contains extra fields
* @return true if there is extra fields
*/
public boolean containsExtraFields() {
return !getExtraProtectedFields().keySet().isEmpty();
}
/**
* Add an extra field to the list
* @param label Label of field, must be unique