File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -105,9 +105,22 @@ class SettingsScreenManager extends ChangeNotifier {
105
105
return ;
106
106
}
107
107
108
+ contacts = await _filterAlreadyImportedContacts (contacts);
109
+
110
+ if (contacts.length == 0 ) {
111
+ _snackbarService.showSnackbarWithMessage (context, noContactsFoundMsg);
112
+ return ;
113
+ }
114
+
108
115
_handleAddingBirthdaysToContacts (context, contacts);
109
116
}
110
117
118
+ Future <List <Contact >> _filterAlreadyImportedContacts (List <Contact > contacts) async {
119
+ List <String > namesOfPeopleWithBirthdays = await _storageService.getAllBirthdays ();
120
+ List <Contact > filtered = contacts.where ((contact) => ! namesOfPeopleWithBirthdays.contains (contact.displayName)).toList ();
121
+ return filtered;
122
+ }
123
+
111
124
void addContactToCalendar (UserBirthday contact) {
112
125
_bcContactsService.addContactToCalendar (contact);
113
126
}
You can’t perform that action at this time.
0 commit comments