Skip to content
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
6 changes: 1 addition & 5 deletions ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
"launchShowDuration": 0
}
},
"cordova": {},
"server": {
"url": "http://localhost:8100",
"cleartext": true
}
"cordova": {}
}
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"@angular/platform-browser-dynamic": "^9.1.10",
"@angular/router": "^9.1.10",
"@capacitor-community/contacts": "0.0.3",
"@capacitor/android": "^2.1.2",
"@capacitor/core": "^2.1.2",
"@capacitor/ios": "^2.1.2",
"@capacitor/android": "^2.4.4",
"@capacitor/core": "^2.4.4",
"@capacitor/ios": "^2.4.4",
"@ionic-native/core": "^5.26.0",
"@ionic-native/splash-screen": "^5.26.0",
"@ionic-native/status-bar": "^5.26.0",
Expand Down
6 changes: 3 additions & 3 deletions src/app/home/home.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
Fetch Contacts
</ion-button>
</div>
<ion-item *ngFor="let contact of contacts | async" >
<ion-item *ngFor="let contact of contact$ | async" >
<ion-icon color="primary" slot="start" name="beer"></ion-icon>
<ion-label class="ion-text-wrap">
<ion-text color="dark">
<h3>{{contact.displayName}}</h3>
</ion-text>
<ion-text color="medium">
<p>{{contact.phoneNumbers}}</p>
<p><span *ngFor="let phone of contact.phoneNumbers">{{ phone.label }}: {{ phone.number }}; </span></p>
</ion-text>
<ion-text color="medium">
<p>{{contact.emails}}</p>
<p><span *ngFor="let email of contact.emails">{{ email.label }}: {{ email.address }}; </span></p>
</ion-text>
</ion-label>
</ion-item>
Expand Down
22 changes: 6 additions & 16 deletions src/app/home/home.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component } from '@angular/core';
import { Plugins } from '@capacitor/core';
import { Observable, of } from 'rxjs';
import { PhoneContact } from '../phone-contact';
import { Contact } from '@capacitor-community/contacts'

const { Contacts } = Plugins;

@Component({
Expand All @@ -10,16 +11,8 @@ const { Contacts } = Plugins;
styleUrls: ['home.page.scss'],
})

// export interface PhoneContact {
// contactId: string;
// lookupKey: string;
// displayName: string;
// phoneNumbers: [string];
// emails: [string];
// }

export class HomePage {
contacts: Observable<PhoneContact[]>;
contact$: Observable<Contact[]>;
constructor() {}

async getPermissions(): Promise<void> {
Expand All @@ -28,11 +21,8 @@ export class HomePage {

async getContacts(): Promise<void> {
console.log('tesbutton clicked');
Contacts.getContacts().then(result => {
console.log('result is:' , result);
const phoneContacts: [PhoneContact] = result.contacts;
this.contacts = of(phoneContacts);

});
const result = await Contacts.getContacts();
console.log(result);
this.contact$ = of(result.contacts);
}
}