mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Fixed ContactLoader not notifying app of changes when editing a native friend through another app
This commit is contained in:
parent
2a9ef440b7
commit
e1abcc6dca
2 changed files with 13 additions and 3 deletions
|
|
@ -99,8 +99,10 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
ContactsContract.Data.CONTACT_ID + " ASC"
|
ContactsContract.Data.CONTACT_ID + " ASC"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Update at most once every X (see variable value for actual duration)
|
// WARNING: this doesn't prevent to be called again in onLoadFinished,
|
||||||
loader.setUpdateThrottle(MIN_INTERVAL_TO_WAIT_BEFORE_REFRESH)
|
// it will only have for effect that the notified cursor will be the same as before
|
||||||
|
// instead of a new one with updated content!
|
||||||
|
// loader.setUpdateThrottle(MIN_INTERVAL_TO_WAIT_BEFORE_REFRESH)
|
||||||
|
|
||||||
return loader
|
return loader
|
||||||
}
|
}
|
||||||
|
|
@ -110,8 +112,16 @@ class ContactLoader : LoaderManager.LoaderCallbacks<Cursor> {
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
Log.e("$TAG Cursor is null!")
|
Log.e("$TAG Cursor is null!")
|
||||||
return
|
return
|
||||||
|
} else if (cursor.isClosed) {
|
||||||
|
Log.e("$TAG Cursor is closed!")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i("$TAG Load finished, found ${cursor.count} entries in cursor")
|
Log.i("$TAG Load finished, found ${cursor.count} entries in cursor")
|
||||||
|
if (cursor.isAfterLast) {
|
||||||
|
Log.w("$TAG Cursor position is after last, it was probably already used, nothing to do")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
val core = coreContext.core
|
val core = coreContext.core
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ class ContactViewModel
|
||||||
if (!::friend.isInitialized) return
|
if (!::friend.isInitialized) return
|
||||||
|
|
||||||
val found = coreContext.contactsManager.findContactById(refKey)
|
val found = coreContext.contactsManager.findContactById(refKey)
|
||||||
if (found != null && found != friend) {
|
if (found != null) {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Found contact [${found.name}] matching ref key [$refKey] after contacts have been loaded/updated"
|
"$TAG Found contact [${found.name}] matching ref key [$refKey] after contacts have been loaded/updated"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue