notifications: fix profile name
This patch uses recently added VCardUtils to parse data to profile
to get profile name.
Change-Id: Ie438aa2d353ed55fc66f1bb7418eceda5e1b97d6
diff --git a/Ring/jamiNotificationExtension/NotificationService.swift b/Ring/jamiNotificationExtension/NotificationService.swift
index 98f9ccb..4fa51b5 100644
--- a/Ring/jamiNotificationExtension/NotificationService.swift
+++ b/Ring/jamiNotificationExtension/NotificationService.swift
@@ -443,9 +443,8 @@
if !FileManager.default.fileExists(atPath: profilePath) { return nil }
guard let data = FileManager.default.contents(atPath: profilePath),
- let vCards = try? CNContactVCardSerialization.contacts(with: data),
- let vCard = vCards.first else { return nil }
- return vCard.familyName.isEmpty ? vCard.givenName : vCard.familyName
+ let profile = VCardUtils.parseToProfile(data: data) else { return nil }
+ return profile.alias
}
}