Deltachat-android: add contacts from the system address book to internal contact database

Created on 26 Sep 2018  路  10Comments  路  Source: deltachat/deltachat-android

each time the contact list is opened, the system address book should be read and all names+email addresses should be added using dc_add_address_book() resp. DcContext.addAddressBook().

this should be done in a thread, currently, currently, it is not needed to remove addresses added; the contact list is more a text-completion tool than an fully-functional address book.

the old code is here: https://github.com/deltachat/deltachat-android/blob/master/MessengerProj/src/main/java/com/b44t/messenger/ContactsActivity.java#L196

All 10 comments

Will look into that one next week. :+1:

great - maybe we can also have little a/v next week.
have a nice weekend in between :)

@r10s sounds great, lets chat on Monday regarding date / time. And also a nice weekend for you. :)

Added the requested changes.

great :)

as mentioned, however, there is a funny screen appearing under some circumstances (see attached image).

  • the screen appear to me for some seconds the first time the contacts are read.
  • on subsequent opening of the contact list, it flashes only shortly
  • when access to the contact are denied, it appears permanently together with a the text "Delta Chat needs access to your contacts in order to display them" plus a button "Show contacts".

i think, this screen can be removed at all. there is no need at all to show that contacts are being loaded, not even a special refresh-list is required as DC_EVENT_CONTACTS_CHANGED will be emitted when dc_add_address_book() adds sth. (i am about to add this to the core, currently, should be there tomorrow)

image

Okay, I will adjust this today. @r10s would you ping me if the core update is ready? Thanks. :)

@Boehrsi updated, DcContext.addAddressBook() results in a DC_EVENT_CONTACTS_CHANGED event which is already handled in the activity.

Great will integrate this now :).

Adjusted the loading in regards to the updated core and removed the "loading screen". If the user grants the permission the address book is loaded + delta contacts and if not, just the available delta contacts are loaded from the core. The user is ask for permission when entering the contact screen.

great - also that the permission can be denied and the app just uses the internal contacts then.

i think this issue can be closed :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

webratte picture webratte  路  4Comments

AndreasLattmann picture AndreasLattmann  路  4Comments

adbenitez picture adbenitez  路  4Comments

Almtesh picture Almtesh  路  4Comments

r10s picture r10s  路  4Comments