|
19 | 19 | under the License. |
20 | 20 | */ |
21 | 21 | ;(function() { |
22 | | -var PLATFORM_VERSION_BUILD_LABEL = '14.0.1'; |
| 22 | +var PLATFORM_VERSION_BUILD_LABEL = '15.0.0'; |
23 | 23 | // file: src/scripts/require.js |
24 | 24 | var require; |
25 | 25 | var define; |
@@ -986,7 +986,7 @@ function androidExec (success, fail, service, action, args) { |
986 | 986 | var callbackId = service + cordova.callbackId++; |
987 | 987 | var argsJson = JSON.stringify(args); |
988 | 988 | if (success || fail) { |
989 | | - cordova.callbacks[callbackId] = { success: success, fail: fail }; |
| 989 | + cordova.callbacks[callbackId] = { success, fail }; |
990 | 990 | } |
991 | 991 |
|
992 | 992 | var msgs = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson); |
@@ -1026,6 +1026,8 @@ function pollOnce (opt_fromOnlineEvent) { |
1026 | 1026 | } |
1027 | 1027 | } |
1028 | 1028 |
|
| 1029 | +androidExec.pollOnce = pollOnce; |
| 1030 | + |
1029 | 1031 | function pollingTimerFunc () { |
1030 | 1032 | if (pollEnabled) { |
1031 | 1033 | pollOnce(); |
@@ -1429,6 +1431,10 @@ module.exports = { |
1429 | 1431 | // Core Splash Screen |
1430 | 1432 | modulemapper.clobbers('cordova/plugin/android/splashscreen', 'navigator.splashscreen'); |
1431 | 1433 |
|
| 1434 | + // Attach the internal statusBar utility to window.statusbar |
| 1435 | + // see the file under plugin/android/statusbar.js |
| 1436 | + modulemapper.clobbers('cordova/plugin/android/statusbar', 'window.statusbar'); |
| 1437 | + |
1432 | 1438 | var APP_PLUGIN_NAME = Number(cordova.platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App'; |
1433 | 1439 |
|
1434 | 1440 | // Inject a listener for the backbutton on the document. |
@@ -1627,6 +1633,85 @@ module.exports = splashscreen; |
1627 | 1633 |
|
1628 | 1634 | }); |
1629 | 1635 |
|
| 1636 | +// file: ../../cordova-js-src/plugin/android/statusbar.js |
| 1637 | +define("cordova/plugin/android/statusbar", function(require, exports, module) { |
| 1638 | + |
| 1639 | +var exec = require('cordova/exec'); |
| 1640 | + |
| 1641 | +var statusBarVisible = true; |
| 1642 | +var statusBar = {}; |
| 1643 | + |
| 1644 | +// This <script> element is explicitly used by Cordova's statusbar for computing color. (Do not use this element) |
| 1645 | +const statusBarScript = document.createElement('script'); |
| 1646 | +document.head.appendChild(statusBarScript); |
| 1647 | + |
| 1648 | +Object.defineProperty(statusBar, 'visible', { |
| 1649 | + configurable: false, |
| 1650 | + enumerable: true, |
| 1651 | + get: function () { |
| 1652 | + if (window.StatusBar) { |
| 1653 | + // try to let the StatusBar plugin handle it |
| 1654 | + return window.StatusBar.isVisible; |
| 1655 | + } |
| 1656 | + |
| 1657 | + return statusBarVisible; |
| 1658 | + }, |
| 1659 | + set: function (value) { |
| 1660 | + if (window.StatusBar) { |
| 1661 | + // try to let the StatusBar plugin handle it |
| 1662 | + if (value) { |
| 1663 | + window.StatusBar.show(); |
| 1664 | + } else { |
| 1665 | + window.StatusBar.hide(); |
| 1666 | + } |
| 1667 | + } else { |
| 1668 | + statusBarVisible = value; |
| 1669 | + exec(null, null, 'SystemBarPlugin', 'setStatusBarVisible', [!!value]); |
| 1670 | + } |
| 1671 | + } |
| 1672 | +}); |
| 1673 | + |
| 1674 | +Object.defineProperty(statusBar, 'setBackgroundColor', { |
| 1675 | + configurable: false, |
| 1676 | + enumerable: false, |
| 1677 | + writable: false, |
| 1678 | + value: function (value) { |
| 1679 | + statusBarScript.style.color = value; |
| 1680 | + var rgbStr = window.getComputedStyle(statusBarScript).getPropertyValue('color'); |
| 1681 | + |
| 1682 | + if (!rgbStr.match(/^rgb/)) { return; } |
| 1683 | + |
| 1684 | + var rgbVals = rgbStr.match(/\d+/g).map(function (v) { return parseInt(v, 10); }); |
| 1685 | + |
| 1686 | + if (rgbVals.length < 3) { |
| 1687 | + return; |
| 1688 | + } else if (rgbVals.length === 3) { |
| 1689 | + rgbVals = [255].concat(rgbVals); |
| 1690 | + } |
| 1691 | + |
| 1692 | + // TODO: Use `padStart(2, '0')` once SDK 24 is dropped. |
| 1693 | + const padRgb = (val) => { |
| 1694 | + const hex = val.toString(16); |
| 1695 | + return hex.length === 1 ? '0' + hex : hex; |
| 1696 | + }; |
| 1697 | + const a = padRgb(rgbVals[0]); |
| 1698 | + const r = padRgb(rgbVals[1]); |
| 1699 | + const g = padRgb(rgbVals[2]); |
| 1700 | + const b = padRgb(rgbVals[3]); |
| 1701 | + const hexStr = '#' + a + r + g + b; |
| 1702 | + |
| 1703 | + if (window.StatusBar) { |
| 1704 | + window.StatusBar.backgroundColorByHexString(hexStr); |
| 1705 | + } else { |
| 1706 | + exec(null, null, 'SystemBarPlugin', 'setStatusBarBackgroundColor', rgbVals); |
| 1707 | + } |
| 1708 | + } |
| 1709 | +}); |
| 1710 | + |
| 1711 | +module.exports = statusBar; |
| 1712 | + |
| 1713 | +}); |
| 1714 | + |
1630 | 1715 | // file: src/common/pluginloader.js |
1631 | 1716 | define("cordova/pluginloader", function(require, exports, module) { |
1632 | 1717 |
|
|
0 commit comments