mirror of https://github.com/M66B/FairEmail.git
Prevent importing duplicate saved searches
This commit is contained in:
parent
df05998a60
commit
20858227fc
|
@ -1118,8 +1118,18 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|||
for (int s = 0; s < jsearches.length(); s++) {
|
||||
JSONObject jsearch = (JSONObject) jsearches.get(s);
|
||||
EntitySearch search = EntitySearch.fromJSON(jsearch);
|
||||
search.id = null;
|
||||
db.search().insertSearch(search);
|
||||
|
||||
boolean found = false;
|
||||
for (EntitySearch other : db.search().getSearches())
|
||||
if (other.equals(search)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
search.id = null;
|
||||
db.search().insertSearch(search);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,8 @@ public class EntitySearch {
|
|||
public boolean equals(Object obj) {
|
||||
if (obj instanceof EntitySearch) {
|
||||
EntitySearch other = (EntitySearch) obj;
|
||||
return (this.id.equals(other.id) &&
|
||||
return (Objects.equals(this.account_uuid, other.account_uuid) &&
|
||||
Objects.equals(this.folder_name, other.folder_name) &&
|
||||
this.name.equals(other.name) &&
|
||||
Objects.equals(this.order, other.order) &&
|
||||
Objects.equals(this.color, other.color) &&
|
||||
|
|
Loading…
Reference in New Issue