Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nickname to name projection on iOS. #121

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,15 @@ pickContact(options: PickContactOptions) => Promise<PickContactResult>

#### NamePayload

| Prop | Type |
| ------------- | --------------------------- |
| **`display`** | <code>string \| null</code> |
| **`given`** | <code>string \| null</code> |
| **`middle`** | <code>string \| null</code> |
| **`family`** | <code>string \| null</code> |
| **`prefix`** | <code>string \| null</code> |
| **`suffix`** | <code>string \| null</code> |
| Prop | Type |
| --------------- | --------------------------- |
| **`display`** | <code>string \| null</code> |
| **`given`** | <code>string \| null</code> |
| **`middle`** | <code>string \| null</code> |
| **`family`** | <code>string \| null</code> |
| **`prefix`** | <code>string \| null</code> |
| **`suffix`** | <code>string \| null</code> |
| **`nickname`** | <code>string \| null</code> |


#### OrganizationPayload
Expand Down Expand Up @@ -270,13 +271,14 @@ pickContact(options: PickContactOptions) => Promise<PickContactResult>

#### NameInput

| Prop | Type |
| ------------ | --------------------------- |
| **`given`** | <code>string \| null</code> |
| **`middle`** | <code>string \| null</code> |
| **`family`** | <code>string \| null</code> |
| **`prefix`** | <code>string \| null</code> |
| **`suffix`** | <code>string \| null</code> |
| Prop | Type |
| -------------- | --------------------------- |
| **`given`** | <code>string \| null</code> |
| **`middle`** | <code>string \| null</code> |
| **`family`** | <code>string \| null</code> |
| **`prefix`** | <code>string \| null</code> |
| **`suffix`** | <code>string \| null</code> |
| **`nickname`** | <code>string \| null</code> |


#### OrganizationInput
Expand Down
1 change: 1 addition & 0 deletions ios/Plugin/ContactPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class ContactPayload {
self.name["family"] = contact.familyName
self.name["prefix"] = contact.namePrefix
self.name["suffix"] = contact.nameSuffix
self.name["nickname"] = contact.nickname
}

// Organization
Expand Down
3 changes: 3 additions & 0 deletions ios/Plugin/Contacts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public class Contacts: NSObject {
if let nameSuffix = contactInput.nameSuffix {
newContact.nameSuffix = nameSuffix
}
if let nameNickname = contactInput.nameNickname {
newContact.nickname = nameNickname
}

// Organization
if let organizationName = contactInput.organizationName {
Expand Down
2 changes: 2 additions & 0 deletions ios/Plugin/CreateContactInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class CreateContactInput {
public var nameFamily: String?
public var namePrefix: String?
public var nameSuffix: String?
public var nameNickname: String?

// Organization
public var organizationName: String?
Expand Down Expand Up @@ -44,6 +45,7 @@ public class CreateContactInput {
self.nameFamily = nameObject["family"] as? String
self.namePrefix = nameObject["prefix"] as? String
self.nameSuffix = nameObject["suffix"] as? String
self.nameNickname = nameObject["nickname"] as? String
}

// Organization
Expand Down
1 change: 1 addition & 0 deletions ios/Plugin/GetContactsProjectionInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class GetContactsProjectionInput {
projection.append(CNContactFamilyNameKey as CNKeyDescriptor)
projection.append(CNContactNamePrefixKey as CNKeyDescriptor)
projection.append(CNContactNameSuffixKey as CNKeyDescriptor)
projection.append(CNContactNicknameKey as CNKeyDescriptor)
}

// Organization
Expand Down
2 changes: 2 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface NamePayload {
family: string | null;
prefix: string | null;
suffix: string | null;
nickname: string | null;
Copy link
Member

@tafelnl tafelnl Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency it might make sense to use nick instead. As we're also not using displayName instead of display for example

Suggested change
nickname: string | null;
nick: string | null;

}

export interface OrganizationPayload {
Expand Down Expand Up @@ -240,6 +241,7 @@ export interface NameInput {
family?: string | null;
prefix?: string | null;
suffix?: string | null;
nickname?: string | null;
}

export interface OrganizationInput {
Expand Down