msywensky / nativescript-phone

MIT License
72 stars 29 forks source link

phone.sms prevents access to contacts #49

Closed dlcole closed 4 years ago

dlcole commented 4 years ago

After using phone.sms to send a text, my app never receives control back from contacts.getContact. I've created a small sample app at https://github.com/dlcole/contactTester that demos the problem. You can tap the 'Get Contact' button as much as you want and it works as expected. Tap the 'Send Text' button once, though, and now 'Get Contact' does not return. This leads me to believe the nativescript-phone plugin is the culprit.

I've also created this SO post to document the problem: https://stackoverflow.com/questions/61309828/nativescript-phone-prevents-nativescript-contacts-from-returning.

dlcole commented 4 years ago

Manoj and I have debugged this issue on Android - phone.sms is overwriting the default result activity callback. The fix is to save and restore the existing callback, just as is done in the getContact method of the nativescript-contacts plugin.

I have a fix that I've tested and will create a pull request.

bradmartin commented 4 years ago

version 2.0.0 will have this in it, went with a major version because also dropped the hard coded PHONE permission from the plugin, so that now needs to be manually added to the projects PERMISSION list on Android. Had many reports of errors with having the plugin use that when only SMS is needed so seemed better to offload to the dev.

dlcole commented 4 years ago
Brad, 

That makes sense, as does moving the permission.  

Cheers, 

David

On 4/23/2020 12:15 PM, Brad Martin
  wrote:

  version 2.0.0 will have this in it, went with a major version
    because also dropped the hard coded PHONE permission from the
    plugin, so that now needs to be manually added to the projects
    PERMISSION list on Android. Had many reports of errors with
    having the plugin use that when only SMS is needed so seemed
    better to offload to the dev.
  —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub, or unsubscribe.
  [

{ "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/msywensky/nativescript-phone/issues/49#issuecomment-618493090", "url": "https://github.com/msywensky/nativescript-phone/issues/49#issuecomment-618493090", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]