diff --git a/ios/App/App/capacitor.config.json b/ios/App/App/capacitor.config.json index dd64f0f..f5adb18 100644 --- a/ios/App/App/capacitor.config.json +++ b/ios/App/App/capacitor.config.json @@ -9,9 +9,5 @@ "launchShowDuration": 0 } }, - "cordova": {}, - "server": { - "url": "http://localhost:8100", - "cleartext": true - } + "cordova": {} } diff --git a/package-lock.json b/package-lock.json index 69c28c7..66330d9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2816,9 +2816,9 @@ } }, "@capacitor/android": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-2.1.2.tgz", - "integrity": "sha512-V24ZwerrFFWkcLYxhoofhg3Hv4BxH76EFr2zeVJOJkiY9yffey0VMjaE10QPyFrSIshbDtEsYwm2gxUc4wxgjA==" + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-2.4.4.tgz", + "integrity": "sha512-0ueuW7R6PUCSI/bRdVlyM156JtvdJWhIInptC/yIdz/FjdvX8G8Rcb7lVoRk15eVUapqSQZ/S09F8JajaGnJjA==" }, "@capacitor/cli": { "version": "2.1.2", @@ -3015,17 +3015,17 @@ } }, "@capacitor/core": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-2.1.2.tgz", - "integrity": "sha512-oi+n23h9cJ/yaeMIlrnoeCV5p7pv2XWdT+cXzwh9j72LV+Y/oSGcNgFWGEAR/B1UVlv6LnLLQSs9CUXhNlh+Nw==", + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-2.4.4.tgz", + "integrity": "sha512-Cc+g2MjHAaAlIotkQUdaZT/A5taGOXBjPK3ehSdezXX/lztp2zaBHFmO87cx0huasiFelFjwzQwY+Rh6soMNdg==", "requires": { "tslib": "^1.9.0" } }, "@capacitor/ios": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-2.1.2.tgz", - "integrity": "sha512-WVLZl/QQfb8YAhHth0gKS6zlwOXL1du2ZoJIDxXt1m0/xHufo4Ch+OUzvQyLaySX7J1bB08yrlZG2HKXzEcefw==" + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-2.4.4.tgz", + "integrity": "sha512-dQQeJ5xD4sGzakCg9wtFdzRNkwkDuUBl1EK8ilg8DAvh6iYzwWZ6Z0lYLJoA4Nq5Y1WmXDwYoVaTAZ19Lwqm2A==" }, "@ionic-native/core": { "version": "5.26.0", diff --git a/package.json b/package.json index c8f2729..7a67809 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/app/home/home.page.html b/src/app/home/home.page.html index 91946de..1d93ef7 100644 --- a/src/app/home/home.page.html +++ b/src/app/home/home.page.html @@ -22,17 +22,17 @@ Fetch Contacts - +

{{contact.displayName}}

-

{{contact.phoneNumbers}}

+

{{ phone.label }}: {{ phone.number }};

-

{{contact.emails}}

+

{{ email.label }}: {{ email.address }};

diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index d7ac891..5511bc4 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -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({ @@ -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; + contact$: Observable; constructor() {} async getPermissions(): Promise { @@ -28,11 +21,8 @@ export class HomePage { async getContacts(): Promise { 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); } }