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
master: https://github.com/appcelerator/titanium_mobile_windows/pull/752
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