You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by vladimir-kotikov <gi...@git.apache.org> on 2016/11/07 12:04:23 UTC

[GitHub] cordova-plugin-battery-status pull request #42: CB-8929 Use PowerManager to ...

GitHub user vladimir-kotikov opened a pull request:

    https://github.com/apache/cordova-plugin-battery-status/pull/42

    CB-8929 Use PowerManager to get battery state on Win 10

    <!--
    Please make sure the checklist boxes are all checked before submitting the PR. The checklist
    is intended as a quick reference, for complete details please see our Contributor Guidelines:
    
    http://cordova.apache.org/contribute/contribute_guidelines.html
    
    Thanks!
    -->
    
    ### Platforms affected
    Windows (specifically Windows 10)
    
    ### What does this PR do?
    Adds support for Windows 10
    
    ### What testing has been done on this change?
    Manual testing
    
    ### Checklist
    - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
    - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
    - [ ] Added automated test coverage as appropriate for this change.
    


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/vladimir-kotikov/cordova-plugin-battery-status CB-8929

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-battery-status/pull/42.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #42
    
----
commit 04339fb875e357ae48460c3390a12bb6566b7b06
Author: Vladimir Kotikov <ko...@gmail.com>
Date:   2016-11-07T11:46:20Z

    CB-8929 Use PowerManager to get battery state on Win 10

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status issue #42: CB-8929 Use PowerManager to get bat...

Posted by cordova-qa <gi...@git.apache.org>.
Github user cordova-qa commented on the issue:

    https://github.com/apache/cordova-plugin-battery-status/pull/42
  
    Cordova CI Build has completed successfully.
    
    **Commit**     - [Link](https://github.com/apache/cordova-plugin-battery-status/pull/42/commits/04339fb875e357ae48460c3390a12bb6566b7b06)
    **Dashboard** - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29/)
    
    | Builder Name  | Console Output | Test Report | Device Logs  |
    |     :---:     |     :---:      |   :---:     |     :---:    |
    | [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-store/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-store/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-store/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-store/artifact/) |
    | [Windows 10  Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-10-store/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-10-store/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-10-store/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-10-store/artifact/) |
    | [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-phone/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-phone/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-phone/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=windows-8.1-phone/artifact/) |
    | [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=ios/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=ios/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=ios/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=ios/artifact/) |
    | [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=android/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=android/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=android/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/29//PLATFORM=android/artifact/) |
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status pull request #42: CB-8929 Use PowerManager to ...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on a diff in the pull request:

    https://github.com/apache/cordova-plugin-battery-status/pull/42#discussion_r86942697
  
    --- Diff: src/windows/BatteryProxy.js ---
    @@ -19,7 +19,38 @@
      *
      */
     
    -/* global WinJS, BatteryStatus */
    +/* global Windows, WinJS, BatteryStatus */
    +
    +var PowerManager = Windows && Windows.System &&
    +    Windows.System.Power && Windows.System.Power.PowerManager;
    +
    +if (PowerManager) {
    +    var BatteryWin10 = {
    +        start: function (win, fail) {
    +
    +            function reportStatus() {
    +                win({
    +                    level: PowerManager.remainingChargePercent,
    +                    isPlugged: PowerManager.powerSupplyStatus !== Windows.System.Power.PowerSupplyStatus.notPresent
    +                }, { keepCallback: true });
    +            }
    +
    +            PowerManager.onremainingchargepercentchanged = reportStatus;
    --- End diff --
    
    Would not it be better to use add/remove event listener here instead to avoid overriding a listener which might be set in an app code?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status issue #42: CB-8929 Use PowerManager to get bat...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the issue:

    https://github.com/apache/cordova-plugin-battery-status/pull/42
  
    @daserge, addressed your notes


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status issue #42: CB-8929 Use PowerManager to get bat...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-plugin-battery-status/pull/42
  
    Tested and it works good on all targets (Win 10 desktop, Win 10 Mobile, Windows Phone 8.1).
    LGTM apart the comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status issue #42: CB-8929 Use PowerManager to get bat...

Posted by daserge <gi...@git.apache.org>.
Github user daserge commented on the issue:

    https://github.com/apache/cordova-plugin-battery-status/pull/42
  
    @vladimir-kotikov LGTM, thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status issue #42: CB-8929 Use PowerManager to get bat...

Posted by vladimir-kotikov <gi...@git.apache.org>.
Github user vladimir-kotikov commented on the issue:

    https://github.com/apache/cordova-plugin-battery-status/pull/42
  
    This PR is an alternative to #41, made using feature detection and new PowerManager API available in Windows 10
    
    @daserge. please take a look when you have a chance


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status pull request #42: CB-8929 Use PowerManager to ...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/cordova-plugin-battery-status/pull/42


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org


[GitHub] cordova-plugin-battery-status issue #42: CB-8929 Use PowerManager to get bat...

Posted by cordova-qa <gi...@git.apache.org>.
Github user cordova-qa commented on the issue:

    https://github.com/apache/cordova-plugin-battery-status/pull/42
  
    Cordova CI Build has one or more failures. 
    
    **Commit**     - [Link](https://github.com/apache/cordova-plugin-battery-status/pull/42/commits/9f236357b0488e8aecad852539c8cff47768bc36)
    **Dashboard** - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30/)
    
    | Builder Name  | Console Output | Test Report | Device Logs  |
    |     :---:     |     :---:      |   :---:     |     :---:    |
    | [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-store/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-store/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-store/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-store/artifact/) |
    | [Windows 10  Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-10-store/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-10-store/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-10-store/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-10-store/artifact/) |
    | [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-phone/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-phone/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-phone/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=windows-8.1-phone/artifact/) |
    | [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=ios/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=ios/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=ios/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=ios/artifact/) |
    | [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=android/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=android/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=android/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-battery-status-pr/30//PLATFORM=android/artifact/) |
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org
For additional commands, e-mail: dev-help@cordova.apache.org