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 all commits
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> |
| **`nick`** | <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> |
| **`nick`** | <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["nick"] = 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 nameNick = contactInput.nameNick {
newContact.nickname = nameNick
}

// 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 nameNick: 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.nameNick = nameObject["nick"] 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;
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;
nick?: string | null;
}

export interface OrganizationInput {
Expand Down