abhayastudios / nativescript-contacts-lite Goto Github PK
View Code? Open in Web Editor NEWThis nativescript-contacts-lite plugin provides pretty fast read-only access to the iOS and Android contact directory.
License: MIT License
This nativescript-contacts-lite plugin provides pretty fast read-only access to the iOS and Android contact directory.
License: MIT License
Hi Jonothan Solomon,
I am using this plugin, In Android, it works fine, whereas in IOS also for the first time I am getting all the contacts.
But the catch is, in IOS if I go to phone settings and disable the permission for contacts and come back to app, since I do not have the permission, ideally it should go to the error block of promise, but it doesn't go.
Sample Code (Which does not work in IOS)
Contacts.getContacts(this.desiredFields).then( (result: Array<ContactLiteObject>) => { this.result = result; } }, e => { this.emitRes(); console.dir(e); } );
But, If I want to filter contacts based on search term in the code, and now in the app settings if I disable the contacts permission, then, it goes inside the error block of the promise, which takes care of showing the error.
Sample Code (Which works in IOS)
Contacts.getContacts(this.desiredFields, 'Kate', true).then( (result: Array<ContactLiteObject>) => { this.result = result; } }, e => { this.emitRes(); console.dir(e); } );
Desired Result:
Irrespective of search term, I should get the contacts If permission is enabled and if permission is disabled, it should go inside error block of promise (So, that i can show to the user that "You do not have access"). Any quick help is much appreciated. Thanks.
If I have 500 contacts, I get 1000 contacts (500 from my gmail account and 500 from my MI account), but in my contacts, while saving any contact, I haven't specified any account name. Any quick help will be appreciated. Thanks.
Hi, i tried using your plugin with webpack but it fails on android.
To reproduce:
Create a sample app based on default angular template:
Add the webpack plugin + nativescript-contacts-lite + worker loader
Add some codes using the web worker
Run the bundled project
npm run start-android-bundle
Gradle fails at :asbg:generateBindings
Warning: there already is an extend called com.tns.FragmentClass.
Warning: The static binding generator will generate extend from:vendor.js implementation
:asbg:generateBindings
Exception in thread "main" java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
File:/Users/mevindhunnooa/Documents/workspace/my-app-name/platforms/android/src/main/java/com/tns/FragmentClass.java Class: com.tns.FragmentClass
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:68)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:15)
:asbg:generateBindings FAILED
FAILURE: Build failed with an exception.
According to #778, This occurs because the plugin loads the tns modules which are already in the vendor.ts. I even tried using android@next version but it still fails. Here is a sample project with minimalistic code to reproduce https://github.com/mevinDhun/nativescript-webpack-error-app
Is there any way to fix this?
Thanks
Hi Jonothan Solomon,
Hope you are good in this Covid-19
I am using this plugin in a ModalView , as i Click on the button to load the Modal , the permission is asked after the modal is loaded & then Permission error page comes as it ask for permission after the page loads .
So basically it doesn't update permission on the runtime to the App, even after permission is granted by the User.
Please fix this issue.
Regards,
Priyansh Mishra
Hello,
I am trying to build my app on a Mac for Android and I am getting the following error:
A problem occurred evaluating root project 'nativescript_contacts_lite'.
> Failed to apply plugin [class 'org.gradle.api.plugins.BasePlugin']
> Could not create service of type OutputFilesRepository using ExecutionGradleServices.createOutputFilesRepository().
Here is my package.json:
{
"nativescript": {
"id": "io.app.company",
"tns-ios": {
"version": "6.5.3"
},
"tns-android": {
"version": "6.5.3"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"@nativescript/theme": "~2.3.0",
"@nstudio/nativescript-camera-plus": "3.0.7",
"@nstudio/nativescript-loading-indicator": "3.0.2",
"moment": "^2.26.0",
"nativescript-appversion": "1.4.4",
"nativescript-carousel": "^6.1.1",
"nativescript-contacts-lite": "0.2.7",
"nativescript-custom-bottomsheet": "^1.0.6",
"nativescript-imagecropper": "^3.0.0",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-masked-text-field": "4.0.3",
"nativescript-permissions": "1.3.8",
"nativescript-plugin-firebase": "10.5.0",
"nativescript-ui-listview": "^8.1.2",
"tns-core-modules": "~6.4.0"
},
"devDependencies": {
"nativescript-dev-webpack": "1.5.1",
"tns-platform-declarations": "6.5.15",
"typescript": "~3.5.3"
},
"gitHead": "",
"readme": "NativeScript Application"
}
Any idea what could be causing this?
Thank you
Good night. How can I find contacts that start with a letter? thanks.
I would like to have CONTACT_STATUS_TIMESTAMP => 'contact_status_ts' for my app as I have to sync the contacts for my app. and I cannot sync all contacts every time. So I need to have some timestamp which can tell me the latest update timestamp and I can filter the updated contacts according to that.
Some contacts have a type field returning the following
type: '0'
instead of 'mobile', 'home', 'isdn' and so forth.
Spent endless hours trying to figure out why getContactsWorker stopped working. Only the worker. GetContacts continued to work fine.
It turns out it was this:
"eslint": "^6.8.0"
and/or this:
"eslint-plugin-promise": "^4.2.1",
I removed the two from packages.json and now it works fine.
Any idea why?
Hi,
I developped an app on Android using nativescript-contacts-lite.
The problem is when I run the same code on iOS simulator it crashes. The simulator has contacts and is running on iOS 12. Note that there is not any pop up asking for permission before the crash. It just crashes!
I tried both getContactsWorker (that worked on Android) and getContacts, and no matter what are the fields. The problem is that there is no error in the NativeScript Console so I don't know how to debug it.
Any idea?
Best regards,
This plugin doesn't seem to be compatible with nativescript-dev-webpack.
I get errors such as
unexpected token (contacts) =>
I researched and found out that nativescript-dev-webpack does not support es6 features, but I was not able to find a work around for this. Is there any way to use babel maybe or something to compile this plugin's code first? Or maybe the plugin can be updated to compile to es5?
Helo i get error
ERROR in app.android.js from UglifyJs
Unexpected token: name (contacts) [app.android.js:17451,4]
Preparing project...
Project successfully prepared (Android)
Successfully transferred app.css.
Successfully transferred app.js.
Refreshing application...
Successfully synced application org.nativescript.application on device efd668639 804.
ActivityManager: Start proc 15784:org.nativescript.application/u0a243 for activi ty org.nativescript.application/com.tns.NativeScriptActivity caller=null
JS: 'NativeScript-Vue has "Vue.config.silent" set to true, to see output logs se t it to false.'
JS: 'Loading contacts...'
JS: 'Woo Hoo, I have the power!'
JS: ==== object dump start ====
JS: ==== object dump end ====
Script
var Contacts = require("nativescript-contacts-lite");
var permissions = require( "nativescript-permissions" );
export default{
mounted: function(){
let desiredFields = ['display_name','phone'];
let searchTerm = 'Jon';
permissions.requestPermission(android.Manifest.permission.READ_CONTACTS, "I need these permissions because I'm cool")
.then(function() {
console.log("Woo Hoo, I have the power!");
})
.catch(function() {
console.log("Uh oh, no permissions - plan B time!");
});
console.log('Loading contacts...');
let timer = new Date().getTime();
Contacts.getContacts(desiredFields,searchTerm).then((result) => {
console.dir(result);
}, (e) => { console.dir(e); });
}
}
package.json
{
"name": "belajar5",
"version": "1.0.0",
"description": "A native application built with NativeScript-Vue",
"author": "levi",
"license": "MIT",
"scripts": {
"build": "webpack --env.tnsAction build",
"build:android": "npm run build -- --env.android",
"build:ios": "npm run build -- --env.ios",
"debug": "webpack --watch --env.tnsAction debug",
"debug:android": "npm run debug -- --env.android",
"debug:ios": "npm run debug -- --env.ios",
"watch": "webpack --watch --env.tnsAction run",
"watch:android": "npm run watch -- --env.android",
"watch:ios": "npm run watch -- --env.ios",
"clean": "rimraf dist"
},
"dependencies": {
"nativescript-contacts-lite": "^0.2.5",
"nativescript-permissions": "^1.2.3",
"nativescript-theme-core": "^1.0.4",
"nativescript-vue": "^1.3.1",
"tns-core-modules": "~3.4.1",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.7.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.11",
"extract-text-webpack-plugin": "^3.0.2",
"fs-extra": "^5.0.0",
"nativescript-vue-externals": "^0.2.0",
"nativescript-vue-loader": "^0.1.5",
"nativescript-vue-target": "^0.1.0",
"nativescript-vue-template-compiler": "^1.3.1",
"nativescript-worker-loader": "^0.9.0",
"node-sass": "^4.7.2",
"ns-vue-loader": "^0.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"rimraf": "^2.6.2",
"sass-loader": "^6.0.7",
"uglifyjs-webpack-plugin": "^1.2.5",
"vue-template-compiler": "^2.5.16",
"webpack": "^3.11.0",
"webpack-synchronizable-shell-plugin": "0.0.7",
"winston-color": "^1.0.0"
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.