Skip to content

feat: added contacts #224

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

Merged
merged 1 commit into from
Jan 24, 2022
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [@nativescript/biometrics](packages/biometrics/README.md)
- [@nativescript/brightness](packages/brightness/README.md)
- [@nativescript/camera](packages/camera/README.md)
- [@nativescript/contacts](packages/contacts/README.md)
- [@nativescript/datetimepicker](packages/datetimepicker/README.md)
- [@nativescript/debug-android](packages/debug-android/README.md)
- [@nativescript/debug-ios](packages/debug-ios/README.md)
Expand Down
11 changes: 6 additions & 5 deletions apps/demo-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
"main": "./src/main.ts",
"dependencies": {
"@nativescript/core": "file:../../node_modules/@nativescript/core",
"@nativescript/biometrics": "file:../../dist/packages/biometrics",
"@nativescript/theme-switcher": "file:../../dist/packages/theme-switcher",
"@nativescript/contacts": "file:../../dist/packages/contacts",
"@nativescript/animated-circle": "file:../../dist/packages/animated-circle",
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
"@nativescript/apple-sign-in": "file:../../dist/packages/apple-sign-in",
"@nativescript/auto-fit-text": "file:../../dist/packages/auto-fit-text",
"@nativescript/background-http": "file:../../dist/packages/background-http",
"@nativescript/biometrics": "file:../../dist/packages/biometrics",
"@nativescript/brightness": "file:../../dist/packages/brightness",
"@nativescript/camera": "file:../../dist/packages/camera",
"@nativescript/datetimepicker": "file:../../dist/packages/datetimepicker",
Expand All @@ -19,6 +20,7 @@
"@nativescript/facebook": "file:../../dist/packages/facebook",
"@nativescript/fingerprint-auth": "file:../../dist/packages/fingerprint-auth",
"@nativescript/geolocation": "file:../../dist/packages/geolocation",
"@nativescript/google-maps": "file:../../dist/packages/google-maps",
"@nativescript/google-signin": "file:../../dist/packages/google-signin",
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
"@nativescript/ios-security": "file:../../dist/packages/ios-security",
Expand All @@ -28,10 +30,9 @@
"@nativescript/picker": "file:../../dist/packages/picker",
"@nativescript/shared-notification-delegate": "file:../../dist/packages/shared-notification-delegate",
"@nativescript/social-share": "file:../../dist/packages/social-share",
"@nativescript/theme-switcher": "file:../../dist/packages/theme-switcher",
"@nativescript/twitter": "file:../../dist/packages/twitter",
"@nativescript/zip": "file:../../dist/packages/zip",
"@nativescript/apple-sign-in": "file:../../dist/packages/apple-sign-in",
"@nativescript/google-maps": "file:../../dist/packages/google-maps"
"@nativescript/zip": "file:../../dist/packages/zip"
},
"devDependencies": {
"@nativescript/android": "~8.1.1",
Expand Down
1 change: 1 addition & 0 deletions apps/demo-angular/src/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const routes: Routes = [
{ path: 'biometrics', loadChildren: () => import('./plugin-demos/biometrics.module').then(m => m.BiometricsModule) },
{ path: 'brightness', loadChildren: () => import('./plugin-demos/brightness.module').then(m => m.BrightnessModule) },
{ path: 'camera', loadChildren: () => import('./plugin-demos/camera.module').then(m => m.CameraModule) },
{ path: 'contacts', loadChildren: () => import('./plugin-demos/contacts.module').then(m => m.ContactsModule) },
{ path: 'datetimepicker', loadChildren: () => import('./plugin-demos/datetimepicker.module').then(m => m.DatetimepickerModule) },
{ path: 'debug-android', loadChildren: () => import('./plugin-demos/debug-android.module').then(m => m.DebugAndroidModule) },
{ path: 'debug-ios', loadChildren: () => import('./plugin-demos/debug-ios.module').then(m => m.DebugIosModule) },
Expand Down
3 changes: 3 additions & 0 deletions apps/demo-angular/src/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export class HomeComponent {
{
name: 'camera'
},
{
name: 'contacts'
},
{
name: 'datetimepicker'
},
Expand Down
8 changes: 8 additions & 0 deletions apps/demo-angular/src/plugin-demos/contacts.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ActionBar title="contacts" class="action-bar"> </ActionBar>
<StackLayout class="p-20">
<ScrollView class="h-full">
<StackLayout>
<Button text="Test contacts" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
</StackLayout>
</ScrollView>
</StackLayout>
19 changes: 19 additions & 0 deletions apps/demo-angular/src/plugin-demos/contacts.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component, NgZone } from '@angular/core';
import { DemoSharedContacts } from '@demo/shared';
import { } from '@nativescript/contacts';

@Component({
selector: 'demo-contacts',
templateUrl: 'contacts.component.html',
})
export class ContactsComponent {

demoShared: DemoSharedContacts;

constructor(private _ngZone: NgZone) {}

ngOnInit() {
this.demoShared = new DemoSharedContacts();
}

}
10 changes: 10 additions & 0 deletions apps/demo-angular/src/plugin-demos/contacts.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
import { ContactsComponent } from './contacts.component';

@NgModule({
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: ContactsComponent }])],
declarations: [ContactsComponent],
schemas: [ NO_ERRORS_SCHEMA]
})
export class ContactsModule {}
9 changes: 5 additions & 4 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"repository": "<fill-your-repository-here>",
"dependencies": {
"@nativescript/core": "file:../../node_modules/@nativescript/core",
"@nativescript/biometrics": "file:../../packages/biometrics",
"@nativescript/contacts": "file:../../packages/contacts",
"@nativescript/animated-circle": "file:../../packages/animated-circle",
"@nativescript/appavailability": "file:../../packages/appavailability",
"@nativescript/apple-sign-in": "file:../../packages/apple-sign-in",
"@nativescript/auto-fit-text": "file:../../packages/auto-fit-text",
"@nativescript/background-http": "file:../../packages/background-http",
"@nativescript/biometrics": "file:../../packages/biometrics",
"@nativescript/brightness": "file:../../packages/brightness",
"@nativescript/camera": "file:../../packages/camera",
"@nativescript/datetimepicker": "file:../../packages/datetimepicker",
Expand All @@ -21,6 +23,7 @@
"@nativescript/facebook": "file:../../packages/facebook",
"@nativescript/fingerprint-auth": "file:../../packages/fingerprint-auth",
"@nativescript/geolocation": "file:../../packages/geolocation",
"@nativescript/google-maps": "file:../../packages/google-maps",
"@nativescript/google-signin": "file:../../packages/google-signin",
"@nativescript/imagepicker": "file:../../packages/imagepicker",
"@nativescript/ios-security": "file:../../packages/ios-security",
Expand All @@ -32,9 +35,7 @@
"@nativescript/social-share": "file:../../packages/social-share",
"@nativescript/theme-switcher": "file:../../packages/theme-switcher",
"@nativescript/twitter": "file:../../packages/twitter",
"@nativescript/zip": "file:../../packages/zip",
"@nativescript/apple-sign-in": "file:../../packages/apple-sign-in",
"@nativescript/google-maps": "file:../../packages/google-maps"
"@nativescript/zip": "file:../../packages/zip"
},
"devDependencies": {
"@nativescript/android": "~8.1.1",
Expand Down
31 changes: 30 additions & 1 deletion apps/demo/src/app.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1,31 @@
@import 'nativescript-theme-core/scss/light';
@import 'nativescript-theme-core/scss/index';
@import 'nativescript-theme-core/scss/index';

Button {
text-transform: none;
height: 54;
android-elevation: 0;
android-dynamic-elevation-offset: 0;
padding: 0;
margin: 0;

&.btn {
padding: 0;
margin: 2 0 2 0;

&.btn-primary {
background-color: rgb(95, 185, 249);
}
}
}
TextField {
border-bottom-width: 1;
border-bottom-color: transparent;
font-size: 17;
placeholder-color: rgb(201, 201, 201);
padding-top: 0;
padding-bottom: 0;
margin-top: 0;
margin-bottom: 0;
height: 29;
}
5 changes: 3 additions & 2 deletions apps/demo/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Application } from '@nativescript/core';
import { LoginManager } from '@nativescript/facebook';
// uncomment to test facebook login
// import { LoginManager } from '@nativescript/facebook';

LoginManager.init();
// LoginManager.init();

Application.run({ moduleName: 'app-root' });
5 changes: 3 additions & 2 deletions apps/demo/src/main-page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@
<StackLayout>
<Button text="animated-circle" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="appavailability" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="apple-sign-in" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="auto-fit-text" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="background-http" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="biometrics" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="brightness" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="camera" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="contacts" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="datetimepicker" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="debug-android" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="debug-ios" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
Expand All @@ -21,6 +23,7 @@
<Button text="facebook" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="fingerprint-auth" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="geolocation" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="google-maps" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="google-signin" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="imagepicker" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="ios-security" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
Expand All @@ -33,8 +36,6 @@
<Button text="theme-switcher" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="twitter" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="zip" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="apple-sign-in" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
<Button text="google-maps" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
</StackLayout>
</ScrollView>
</StackLayout>
Expand Down
12 changes: 12 additions & 0 deletions apps/demo/src/plugin-demos/contacts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Observable, EventData, Page } from '@nativescript/core';
import { DemoSharedContacts } from '@demo/shared';
import { } from '@nativescript/contacts';

export function navigatingTo(args: EventData) {
const page = <Page>args.object;
page.bindingContext = new DemoModel();
}

export class DemoModel extends DemoSharedContacts {

}
20 changes: 20 additions & 0 deletions apps/demo/src/plugin-demos/contacts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
<Page.actionBar>
<ActionBar title="@nativescript/contacts" icon="" class="action-bar">
</ActionBar>
</Page.actionBar>
<GridLayout class="p-20" rows="*,*">
<ScrollView row="0" class="h-full">
<StackLayout>
<Button text="Contacts.getContact" tap="{{ getContact }}" class="btn btn-primary"/>
<TextField hint="Paste contact id here to fetch below..." textChange="{{ contactIdChange }}" padding="5" />
<Button text="Contacts.getContactById" tap="{{ getContactById }}" class="btn btn-primary"/>
<TextField hint="Type contact name to find..." textChange="{{ contactNameChange }}" ios:padding="5" />
<Button text="Contacts.getContactsByName" tap="{{ getContactsByName }}" class="btn btn-primary"/>
<Button text="Contacts.getAllContacts" tap="{{ getAllContacts }}" class="btn btn-primary"/>
</StackLayout>
</ScrollView>
<TextView row="1" text="{{ result }}" editable="true" padding="10" borderWidth="1" borderRadius="4" borderColor="#ccc" fontSize="12" />

</GridLayout>
</Page>
3 changes: 3 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
},
"google-maps": {
"tags": []
},
"contacts": {
"tags": []
}
},
"workspaceLayout": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@types/sprintf-js": "^1.1.0",
"husky": "^5.1.3",
"mkdirp": "^1.0.4",
"nativescript-permissions": "^1.3.12",
"nativescript-vue": "~2.9.0",
"nativescript-vue-template-compiler": "~2.9.0",
"ng-packagr": "^12.0.0",
Expand All @@ -46,7 +47,7 @@
"zone.js": "~0.11.1"
},
"lint-staged": {
"**/*.{js,ts,scss,json,html}": [
"**/*.{js,ts,scss,json,html,xml}": [
"npx prettier --write"
]
}
Expand Down
Loading