diff --git a/lib/apis.js b/lib/apis.js index dfd43bb600d7b1b59993ad1a4a9fcaf3717d56f4..b592e78c42faef04c67de121e097460a8319e802 100644 --- a/lib/apis.js +++ b/lib/apis.js @@ -115,7 +115,8 @@ const device = [ 'stopBeaconDiscovery', 'checkIsSupportSoterAuthentication', 'checkIsSoterEnrolledInDevice', - 'startSoterAuthentication' + 'startSoterAuthentication', + 'onUIStyleChange' ] const keyboard = [ diff --git a/lib/modules.json b/lib/modules.json index 41e31237c7810c1bf0a722067ca8032024081aa6..7d597a9e8bf7e460070717c988ee438c87f38095 100644 --- a/lib/modules.json +++ b/lib/modules.json @@ -118,7 +118,8 @@ "uni.onBeaconUpdate": true, "uni.getBeacons": true, "uni.startBeaconDiscovery": true, - "uni.stopBeaconDiscovery": true + "uni.stopBeaconDiscovery": true, + "uni.onUIStyleChange": true } }, { "name": "ui", @@ -153,8 +154,8 @@ "uni.stopPullDownRefresh": true, "uni.createSelectorQuery": true, "uni.createIntersectionObserver": true, - "uni.hideKeyboard": true, - "uni.onKeyboardHeightChange": true + "uni.hideKeyboard": true, + "uni.onKeyboardHeightChange": true } }, { "name": "event", diff --git a/src/core/service/api/device/theme.js b/src/core/service/api/device/theme.js new file mode 100644 index 0000000000000000000000000000000000000000..2c1adb6e9716731ee9b032409bcddff5abe49100 --- /dev/null +++ b/src/core/service/api/device/theme.js @@ -0,0 +1,19 @@ +import { + invoke +} from 'uni-core/service/bridge' + +import { + onMethod +} from '../../platform' + +const callbacks = [] + +onMethod('onUIStyleChange', function (res) { + callbacks.forEach(callbackId => { + invoke(callbackId, res) + }) +}) + +export function onUIStyleChange (callbackId) { + callbacks.push(callbackId) +} diff --git a/src/platforms/app-plus/service/framework/app.js b/src/platforms/app-plus/service/framework/app.js index 2e2881d4d77b49c134a1c7555dfc9578fc3aea61..a46c88f01dd0bab357abb561918b3223716621ce 100644 --- a/src/platforms/app-plus/service/framework/app.js +++ b/src/platforms/app-plus/service/framework/app.js @@ -82,7 +82,13 @@ function initGlobalListeners () { publish('onKeyboardHeightChange', { height: event.height }) - }) + }) + + plus.globalEvent.addEventListener('uistylechange', function (event) { + publish('onUIStyleChange', { + style: event.uistyle + }) + }) plus.globalEvent.addEventListener('plusMessage', onPlusMessage)