mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-30 09:31:11 +01:00
Added account to local contacts
This commit is contained in:
@@ -509,14 +509,15 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
||||
}
|
||||
jaccount.put("folders", jfolders);
|
||||
|
||||
// Contacts
|
||||
JSONArray jcontacts = new JSONArray();
|
||||
for (EntityContact contact : db.contact().getContacts(account.id))
|
||||
jcontacts.put(contact.toJSON());
|
||||
jaccount.put("contacts", jcontacts);
|
||||
|
||||
jaccounts.put(jaccount);
|
||||
}
|
||||
|
||||
// Contacts
|
||||
JSONArray jcontacts = new JSONArray();
|
||||
for (EntityContact contact : db.contact().getContacts())
|
||||
jcontacts.put(contact.toJSON());
|
||||
|
||||
// Answers
|
||||
JSONArray janswers = new JSONArray();
|
||||
for (EntityAnswer answer : db.answer().getAnswers())
|
||||
@@ -535,7 +536,6 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
||||
|
||||
JSONObject jexport = new JSONObject();
|
||||
jexport.put("accounts", jaccounts);
|
||||
jexport.put("contacts", jcontacts);
|
||||
jexport.put("answers", janswers);
|
||||
jexport.put("settings", jsettings);
|
||||
|
||||
@@ -700,21 +700,22 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
|
||||
Log.i("Imported folder=" + folder.name);
|
||||
}
|
||||
|
||||
// Contacts
|
||||
JSONArray jcontacts = jaccount.getJSONArray("contacts");
|
||||
for (int c = 0; c < jcontacts.length(); c++) {
|
||||
JSONObject jcontact = (JSONObject) jcontacts.get(c);
|
||||
EntityContact contact = EntityContact.fromJSON(jcontact);
|
||||
contact.account = account.id;
|
||||
if (db.contact().getContact(contact.account, contact.type, contact.email) == null) {
|
||||
contact.id = db.contact().insertContact(contact);
|
||||
Log.i("Imported contact=" + contact);
|
||||
}
|
||||
}
|
||||
|
||||
// Update swipe left/right
|
||||
db.account().updateAccount(account);
|
||||
}
|
||||
|
||||
// Contacts
|
||||
JSONArray jcontacts = jimport.getJSONArray("contacts");
|
||||
for (int c = 0; c < jcontacts.length(); c++) {
|
||||
JSONObject jcontact = (JSONObject) jcontacts.get(c);
|
||||
EntityContact contact = EntityContact.fromJSON(jcontact);
|
||||
if (db.contact().getContact(contact.type, contact.email) == null) {
|
||||
contact.id = db.contact().insertContact(contact);
|
||||
Log.i("Imported contact=" + contact);
|
||||
}
|
||||
}
|
||||
|
||||
// Answers
|
||||
JSONArray janswers = jimport.getJSONArray("answers");
|
||||
for (int a = 0; a < janswers.length(); a++) {
|
||||
|
||||
Reference in New Issue
Block a user