Closed suztomo closed 3 years ago
I had my friends to test with their Oppo reno a (Android 9) and Garaxy note 8. Both of them reported they cannot fetch birthdays in their contacts.
I started digging into the code that passes "value" field.
The library already has ContactDate.kt
that
ContactDate.toMap
outputs a map for "date" field.
fun DateComponents.toMap(): Map<String, Int> {
val result = mutableMapOf<String, Int>()
if (year != null) result["year"] = year
if (month != null) result["month"] = month
if (day != null) result["day"] = day
return result
}
fun ContactDate.toMap(): Map<String, *> {
return mutableMapOf(
"label" to label,
"date" to date.toMap())
}
sunny_dart's DateComponent can handle incoming map types in ContactDate.fromMap(m)
(contact.dart).
This is fixed in the latest version 0.6.4+1
.
One other issue with android is that it doesn't store dates, but rather arbitrary string fields. So, it's possible that the dates that have been stored will be unparseable. In that case, I now pass back a date map (year, month, day), as well as the original string that was stored. So, if the date map is null, you can consult the String value
field
Thank you.
Thank you for a great library!
I use my Android phone (BlackBerry Priv; Android 6.0.1) to test my app that use flutter_contact 0.6.4. The app cannot get the birthday of people in the "BlackBerry Hub+ Contacts" (version 2.2034.1.8456, the default app pre-installed in the device). It has
null
forContact.dates
.I dug the flutter_contact's source code and found
ContactDate.fromMap
is expecting "date" key (_kdate
) in a map but the map actually holds "value" key (screenshot below).Can this library support such contact? I'm happy to submit a pull request to support this.
Trying to build the example project for Android
I had to add
android.useAndroidX=true
toexample/android/gradle.properties
.