{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ionic-native/issues/665","repository_url":"https://api.github.com/repos/driftyco/ionic-native","labels_url":"https://api.github.com/repos/driftyco/ionic-native/issues/665/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic-native/issues/665/comments","events_url":"https://api.github.com/repos/driftyco/ionic-native/issues/665/events","html_url":"https://github.com/driftyco/ionic-native/issues/665","id":181923675,"number":665,"title":"BLE isEnabled promise does not return boolean. Instead it returns null","user":{"login":"wanjungao","id":293972,"avatar_url":"https://avatars.githubusercontent.com/u/293972?v=3","gravatar_id":"","url":"https://api.github.com/users/wanjungao","html_url":"https://github.com/wanjungao","followers_url":"https://api.github.com/users/wanjungao/followers","following_url":"https://api.github.com/users/wanjungao/following{/other_user}","gists_url":"https://api.github.com/users/wanjungao/gists{/gist_id}","starred_url":"https://api.github.com/users/wanjungao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanjungao/subscriptions","organizations_url":"https://api.github.com/users/wanjungao/orgs","repos_url":"https://api.github.com/users/wanjungao/repos","events_url":"https://api.github.com/users/wanjungao/events{/privacy}","received_events_url":"https://api.github.com/users/wanjungao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-10T01:00:20Z","updated_at":"2016-10-11T05:08:51Z","closed_at":null,"body":"It's supposed to return a promise of a boolean. But instead, it always returns a promise of null. \r\n\r\nthe following code will work. \r\n\r\ndeclare let ble: any;\r\nisEnabled = (): Promise<boolean> => {\r\n\t\tlet p = new Promise<boolean>((resolve, reject) => {\r\n\r\n\t\t\tif (typeof ble != 'undefined' && ble) {\r\n\t\t\t\tble.isEnabled(\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tconsole.log(\"Bluetooth is enabled\");\r\n\t\t\t\t\t\tresolve(true);\r\n\t\t\t\t\t},\r\n\t\t\t\t\t() => {\r\n\t\t\t\t\t\tconsole.log(\"Bluetooth is *not* enabled\");\r\n\t\t\t\t\t\tresolve(false);\r\n\t\t\t\t\t}\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\tresolve(false);\r\n\r\n\t\t});\r\n\r\n\t\treturn p;\r\n\t}\r\n"},"comment":{"url":"https://api.github.com/repos/driftyco/ionic-native/issues/comments/252815243","html_url":"https://github.com/driftyco/ionic-native/issues/665#issuecomment-252815243","issue_url":"https://api.github.com/repos/driftyco/ionic-native/issues/665","id":252815243,"user":{"login":"ihadeed","id":13794420,"avatar_url":"https://avatars.githubusercontent.com/u/13794420?v=3","gravatar_id":"","url":"https://api.github.com/users/ihadeed","html_url":"https://github.com/ihadeed","followers_url":"https://api.github.com/users/ihadeed/followers","following_url":"https://api.github.com/users/ihadeed/following{/other_user}","gists_url":"https://api.github.com/users/ihadeed/gists{/gist_id}","starred_url":"https://api.github.com/users/ihadeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ihadeed/subscriptions","organizations_url":"https://api.github.com/users/ihadeed/orgs","repos_url":"https://api.github.com/users/ihadeed/repos","events_url":"https://api.github.com/users/ihadeed/events{/privacy}","received_events_url":"https://api.github.com/users/ihadeed/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T05:08:51Z","updated_at":"2016-10-11T05:08:51Z","body":"Just having a look at this.\n\nCalling isEnabled should return a promise that resolves if its enabled and\nwill reject if it's not.\n\nOn Oct 10, 2016 11:19 PM, \"wanjungao\" <notifications@github.com> wrote:\n\n> make sense to me. Thanks.\n>\n>\n>\n>\n> On Monday, October 10, 2016 11:40 AM, Thomas Kemmer <\n> notifications@github.com> wrote:\n>\n>\n> Exactly. The failure callback of a Cordova plugin always results in an\n> error, which you can catch. I agree this is not very intuitive in this\n> case, but ionic-nativeis just a wrapper for plugins, and does not (and IMHO\n> should not) change basic functionality. In this case, it might be better if\n> the plugin passes abooleanto itssuccesscallback, and reservesfailurefor\n> true errors. But that's beyond the scope ofionic-native`.\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub, or mute the thread.\n>\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/driftyco/ionic-native/issues/665#issuecomment-252801246>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ANJ8dCSlURs5Z4wGt7QYBjwcYcupANzdks5qywBFgaJpZM4KSKr4>\n> .\n>\n"}}
{"actor":{"display_login":"ihadeed"}}