|
|
@@ -9,23 +9,35 @@ export class ContactBook {
|
|
|
}
|
|
|
|
|
|
public getPrimaryEmailAddress() {
|
|
|
+ return this.getFromEmailAddresses()[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ public getPrimaryPhoneNumber() {
|
|
|
+ return this.getFromPhoneNumbers()[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ public getFromPhoneNumbers() {
|
|
|
+ const result: string[] = [];
|
|
|
for (const item of this.items) {
|
|
|
for (const address of item.canSendFromAddrs) {
|
|
|
- if (address.startsWith('email:')) {
|
|
|
- return address;
|
|
|
+ if (address.startsWith('phone:')) {
|
|
|
+ result.push(address);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
- public getPrimaryPhoneNumber() {
|
|
|
+ public getFromEmailAddresses() {
|
|
|
+ const result: string[] = [];
|
|
|
for (const item of this.items) {
|
|
|
for (const address of item.canSendFromAddrs) {
|
|
|
- if (address.startsWith('phone:')) {
|
|
|
- return address;
|
|
|
+ if (address.startsWith('email:')) {
|
|
|
+ result.push(address);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
|