|
|
|
@ -746,8 +746,12 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|
|
|
|
try {
|
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
// Answers
|
|
|
|
|
Map<Long, Long> xAnswer = new HashMap<>();
|
|
|
|
|
Map<Long, Long> xIdentity = new HashMap<>();
|
|
|
|
|
Map<Long, Long> xFolder = new HashMap<>();
|
|
|
|
|
List<EntityRule> rules = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// Answers
|
|
|
|
|
JSONArray janswers = jimport.getJSONArray("answers");
|
|
|
|
|
for (int a = 0; a < janswers.length(); a++) {
|
|
|
|
|
JSONObject janswer = (JSONObject) janswers.get(a);
|
|
|
|
@ -822,7 +826,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|
|
|
|
account.createNotificationChannel(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<Long, Long> xIdentity = new HashMap<>();
|
|
|
|
|
JSONArray jidentities = (JSONArray) jaccount.get("identities");
|
|
|
|
|
for (int i = 0; i < jidentities.length(); i++) {
|
|
|
|
|
JSONObject jidentity = (JSONObject) jidentities.get(i);
|
|
|
|
@ -837,9 +840,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|
|
|
|
Log.i("Imported identity=" + identity.email + " id=" + identity + id + " (" + id + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<Long, Long> xFolder = new HashMap<>();
|
|
|
|
|
List<EntityRule> rules = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
JSONArray jfolders = (JSONArray) jaccount.get("folders");
|
|
|
|
|
for (int f = 0; f < jfolders.length(); f++) {
|
|
|
|
|
JSONObject jfolder = (JSONObject) jfolders.get(f);
|
|
|
|
@ -887,6 +887,23 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|
|
|
|
Log.i("Imported folder=" + folder.name + " id=" + folder.id + " (" + id + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Contacts
|
|
|
|
|
if (jaccount.has("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 contacts=" + jcontacts.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update swipe left/right
|
|
|
|
|
db.account().updateAccount(account);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (EntityRule rule : rules) {
|
|
|
|
|
try {
|
|
|
|
|
JSONObject jaction = new JSONObject(rule.action);
|
|
|
|
@ -917,23 +934,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
|
|
|
|
db.rule().insertRule(rule);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Contacts
|
|
|
|
|
if (jaccount.has("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 contacts=" + jcontacts.length());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update swipe left/right
|
|
|
|
|
db.account().updateAccount(account);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (jimport.has("certificates")) {
|
|
|
|
|
JSONArray jcertificates = jimport.getJSONArray("certificates");
|
|
|
|
|
for (int c = 0; c < jcertificates.length(); c++) {
|
|
|
|
|