Skip to content

Commit

Permalink
import contact websites
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Dec 22, 2022
1 parent a6e8b6e commit a2c6081
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/Service/GoogleContactsAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public function getContactList(string $userId): Generator {
'photos',
'relations',
'residences',
'urls',
]),
'pageSize' => 100,
];
Expand Down Expand Up @@ -231,6 +232,22 @@ public function importContacts(string $userId, ?string $uri, int $key, ?string $
}
}

// websites
if (isset($c['urls']) && is_array($c['urls'])) {
foreach ($c['urls'] as $url) {
if (isset($url['value'])) {
$params = [
'value' => 'uri',
];
if (isset($url['formattedType']) || isset($url['type'])) {
$params['type'] = $url['formattedType'] ?? $url['type'];
}
$prop = $vCard->createProperty('URL', $url['value'], $params);
$vCard->add($prop);
}
}
}

// group/label
if (isset($c['memberships']) && is_array($c['memberships'])) {
$contactGroupNames = [];
Expand Down

0 comments on commit a2c6081

Please sign in to comment.