Disable sql storage for friends if native contacts access is enabled to prevent loading them from sql at next app start for nothing

This commit is contained in:
Sylvain Berfini 2017-01-17 16:14:31 +01:00
parent 3029c53d74
commit c13be6ef7d
3 changed files with 17 additions and 1 deletions

View file

@ -183,7 +183,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACT_DETAIL);
LinphoneActivity.instance().hideTabBar(false);
}
contact.refresh();
contact.minimalRefresh();
displayContact(inflater, view);
}

View file

@ -175,6 +175,7 @@ public class ContactsManager extends ContentObserver {
public void enableContactsAccess() {
hasContactAccess = true;
LinphonePreferences.instance().disableFriendsStorage();
}
public boolean hasContactsAccess() {
@ -355,6 +356,9 @@ public class ContactsManager extends ContentObserver {
contact.setFriend(friend);
contacts.add(contact);
}
} else {
// Now that we no longer store friends in database that match one in the system, let's remove it
lc.removeFriend(friend);
}
} else {
// No refkey so it's a standalone contact

View file

@ -1467,4 +1467,16 @@ public class LinphonePreferences {
public int getCodeLength(){
return getConfig().getInt("app", "activation_code_length", 0);
}
public void disableFriendsStorage() {
getConfig().setBool("misc", "store_friends", false);
}
public void enableFriendsStorage() {
getConfig().setBool("misc", "store_friends", true);
}
public boolean isFriendsStorageEnabled() {
return getConfig().getBool("misc", "store_friends", true);
}
}