Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23440] Windows: Ti.Contacts permission methods need to renamed be to match iOS and Android

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-06-27T00:48:05.000+0000
Affected Version/sRelease 5.3.0
Fix Version/sRelease 6.0.0
ComponentsWindows
Labelsqe-5.3.0
ReporterEwan Harris
AssigneeGary Mathews
Created2016-05-26T02:45:22.000+0000
Updated2016-09-05T14:50:15.000+0000

Description

Description

Currently, Windows uses Ti.Contacts.requestAuthorization() to request authorization, this should be changed to match iOS and Android which use Ti.Contacts.requestContactsPermissions() this was implemented in TIMOB-19479
Ti.Contacts.requestContactsPermissions(function(e) {
    if (e.success === true) {
        alert("Access granted");
    } else {
        alert("Access denied, error: " + e.error);
    }
});
iOS and Android also use Ti.Contacts.hasContactsPermissions() to detect whether permissions are accepted for the app or not.

Steps to reproduce

1. Using the code above build to a Windows device or emulator

Actual result

The application will throw the error
[ERROR] :  Application Error: {
[ERROR] :    "line": 2,
[ERROR] :    "column": 10,
[ERROR] :    "message": "Error while require(/app) Ti.Contacts.requestContactsPermissions is not a function. (In 'Ti.Contacts.requestContactsPermissions', 'Ti.Contacts.requestContactsPermissions' is undefined)",
[ERROR] :    "native_stack": [
[ERROR] :      "JSExportClass<class Titanium::GlobalObject>::CallNamedFunction"
[ERROR] :    ]
[ERROR] :  }

Expected result

The same method should be used across all platforms

Comments

  1. Gary Mathews 2016-06-26

    master: https://github.com/appcelerator/titanium_mobile_windows/pull/752
  2. Ewan Harris 2016-09-05

    Verified using: OS: Microsoft Windows 10 Pro 10.0.14393 Appc core: 6.0.0-38 Appc NPM: 4.2.8-6 Ti SDK: 6.0.0.v20160904203840 Code in the description now works as expected, when the contacts capability exists the API returns a success, when it does not exist the API returns a failure Closing ticket

JSON Source