Fixed issue when calling coreContext.fetchContacts() again
This commit is contained in:
parent
4d7ce73422
commit
562185057b
2 changed files with 5 additions and 3 deletions
|
@ -202,7 +202,7 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
|||
if (core.globalState == GlobalState.Shutdown || core.globalState == GlobalState.Off) {
|
||||
Log.w("[Contacts Loader] Core is being stopped or already destroyed, abort")
|
||||
} else {
|
||||
Log.i("[Contacts Loader] Friends created")
|
||||
Log.i("[Contacts Loader] ${friends.size} friends created")
|
||||
val contactId = coreContext.contactsManager.contactIdToWatchFor
|
||||
if (contactId.isNotEmpty()) {
|
||||
val friend = friends[contactId]
|
||||
|
@ -224,10 +224,11 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
|||
for (friend in friendsList) {
|
||||
fl.addLocalFriend(friend)
|
||||
}
|
||||
Log.i("[Contacts Loader] Friends added")
|
||||
|
||||
fl.updateSubscriptions()
|
||||
Log.i("[Contacts Loader] Subscription(s) updated")
|
||||
|
||||
Log.i("[Contacts Loader] Friends added & subscription updated")
|
||||
coreContext.contactsManager.fetchFinished()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,7 +456,8 @@ class CoreContext(val context: Context, coreConfig: Config) : LifecycleOwner, Vi
|
|||
fun fetchContacts() {
|
||||
if (PermissionHelper.required(context).hasReadContactsPermission()) {
|
||||
Log.i("[Context] Init contacts loader")
|
||||
LoaderManager.getInstance(this@CoreContext).initLoader(0, null, contactLoader)
|
||||
val manager = LoaderManager.getInstance(this@CoreContext)
|
||||
manager.restartLoader(0, null, contactLoader)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue