Skip to content

Commit 5191891

Browse files
committed
Merge branch feature_10024_previewconfig into SDK_10024
add appConfigEnv props See merge request !83 refer d2a3f32cc02204a1f7cd2d87cb9d4be007ca48da
1 parent 1305d9b commit 5191891

22 files changed

+56
-13
lines changed

bin/config/transformer.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<a name="module_miot/Host.appConfigEnv"></a>
2+
3+
## .appConfigEnv : <code>int</code>
4+
获取 米家APP中 我的-->开发者设置-->其他设置, AppConfig接口拉取preview版数据 是否选中的状态
5+
1:表示选中, preview ; 0:表示未选中, release
6+
如果选中,Service.smarthome.getAppConfig 获取的数据为preview版数据, 反之为release版数据
7+
8+
**Kind**: static constant
9+
**Read only**: true
10+
**Since**: 10024
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

doc-md/20-系统服务_智能家庭模块/37-getAppConfig.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## .getAppConfig(params)
44
获取AppConfig配置文件,1. 插件端有一些自己的信息需要配置,可使用此接口 2. 局限性:只有小米内部有权配置,之后可能会出对外版(目前只能找米家产品经理/工程师帮忙配置)3.维护起来很不方便,不建议使用。
5+
默认获取的是release版数据, 如果需要获取preview版数据, 可以在米家APP中 我的-->开发者设置-->其他设置的界面中 “AppConfig接口拉取preview版数据” 置为选中状态
56

67
**Kind**: static function
78

miot-sdk/Host.js

+12
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ export default {
117117
get applicationEdition() {
118118
return true
119119
},
120+
/**
121+
* 获取 米家APP中 我的-->开发者设置-->其他设置, AppConfig接口拉取preview版数据 是否选中的状态
122+
* 1:表示选中, preview ; 0:表示未选中, release
123+
* 如果选中,Service.smarthome.getAppConfig 获取的数据为preview版数据, 反之为release版数据
124+
* @since 10024
125+
* @const
126+
* @type {int}
127+
* @readonly
128+
*/
129+
get appConfigEnv() {
130+
return true
131+
},
120132
/**
121133
* @const
122134
* @see {@link module:miot/host/ui}

miot-sdk/service/smarthome.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @description 智能家庭 API
77
*
88
*/
9+
import Host from "../Host";
910
/**
1011
* 成员类型
1112
* @namespace MemberType
@@ -472,7 +473,7 @@ export default {
472473
},
473474
/**
474475
* 获取AppConfig配置文件,1. 插件端有一些自己的信息需要配置,可使用此接口 2. 局限性:只有小米内部有权配置,之后可能会出对外版(目前只能找米家产品经理/工程师帮忙配置)3.维护起来很不方便,不建议使用。
475-
*
476+
* 默认获取的是release版数据, 如果需要获取preview版数据, 可以在米家APP中 我的-->开发者设置-->其他设置的界面中 “AppConfig接口拉取preview版数据” 置为选中状态
476477
* @param {object} params 请求参数
477478
* @param {string} params.name configName 配置的名字
478479
* @param {string} params.lang lang 可选: zh_CN、zh_TW、en,zh-hant,一般请使用zh_CN和en

projects/com.xiaomi.demo/CommonModules/CommonCell.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default class CommonCell extends React.Component {
1414
<TouchableOpacity onPress={this.props.onPress}>
1515
<View style={styles.container}>
1616
{ /*左边*/}
17-
<Text style={{ marginLeft: 8 }}>{this.props.title}</Text>
17+
<Text style={{ marginLeft: 8, fontFamily:'normal' }}>{this.props.title}</Text>
1818
{ /*右边*/}
1919
{this.renderRightView()}
2020
</View>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
import React, { Component } from 'react';
3-
import { Platform, StyleSheet, Text,View } from 'react-native';
3+
import { Platform, StyleSheet, Text,View, } from 'react-native';
44
import {Host} from "miot";
55

66

@@ -16,15 +16,24 @@ export default class HostPropsInfoDemo extends Component {
1616
return (
1717
<View style={{flex: 1}}>
1818
<View style={{padding: 10}}>
19-
<Text style={{color:"#333333"}}>Host.type: {""+Host.type}</Text>
20-
<Text style={{color:"#333333"}}>Host.isAndroid: {""+Host.isAndroid}</Text>
21-
<Text style={{color:"#333333"}}>Host.isIOS: {""+Host.isIOS}</Text>
22-
<Text style={{color:"#333333"}}>Host.version: {""+Host.version}</Text>
23-
<Text style={{color:"#333333"}}>Host.apiLevel: {""+Host.apiLevel}</Text>
24-
<Text style={{color:"#333333"}}>Host.isDebug: {""+Host.isDebug}</Text>
25-
<Text style={{color:"#333333"}}>Host.systemInfo: {""+JSON.stringify(Host.systemInfo)}</Text>
19+
<Text style={styles.textStyle}>Host.type: {""+Host.type}</Text>
20+
<Text style={styles.textStyle}>Host.isAndroid: {""+Host.isAndroid}</Text>
21+
<Text style={styles.textStyle}>Host.isIOS: {""+Host.isIOS}</Text>
22+
<Text style={styles.textStyle}>Host.version: {""+Host.version}</Text>
23+
<Text style={styles.textStyle}>Host.apiLevel: {""+Host.apiLevel}</Text>
24+
<Text style={styles.textStyle}>Host.isDebug: {""+Host.isDebug}</Text>
25+
<Text style={styles.textStyle}>Host.systemInfo: {""+JSON.stringify(Host.systemInfo)}</Text>
26+
<Text style={styles.textStyle}>Host.appConfigEnv: {""+Host.appConfigEnv}</Text>
2627
</View>
2728
</View>
2829
);
2930
}
30-
}
31+
};
32+
33+
const styles = StyleSheet.create({
34+
textStyle: {
35+
color:"#333333",
36+
fontStyle:'normal',
37+
marginTop:10,
38+
}
39+
})

projects/com.xiaomi.demo/Main/Service/smarthome.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ export default class CallSmartHomeAPIDemo extends React.Component {
7979
{ name: "上报设备数据", handle: this.handleObjRes.bind(this), action: () => { return Service.smarthome.reportRecords(Device.deviceID, [{ type: "prop", key: "b", value: "c" }]) } },
8080
{ name: "获取支持语音的设备-语音设备可用", handle: this.handleObjRes.bind(this), action: () => { return Service.smarthome.getVoiceCtrlDevices(Device.deviceID) } },
8181
{ name: "当前服务器国家码", handle: this.handleObjRes.bind(this), action: () => { return Host.getCurrentCountry().then(res => { return new Promise.resolve({ "res": res }) }) } },
82+
{ name: "获取AppConfig配置文件信息", handle: this.handleObjRes.bind(this), action: () => {
83+
let params = {
84+
name: "local_timer_config",
85+
lang:'zh_CN',
86+
version:"1",
87+
result_level:'0'
88+
}
89+
return Service.smarthome.getAppConfig(params);
90+
}
91+
},
8292
]
8393
})
8494
}
@@ -128,7 +138,7 @@ export default class CallSmartHomeAPIDemo extends React.Component {
128138
renderItem={({ item }) => {
129139
return (<View style={{ flexDirection: 'row', margin: 10 }}>
130140
<Text style={{ width: 150 }}>{item.key}:</Text>
131-
<Text style={{ width: 150 }}>{item.value}</Text>
141+
<Text style={{ width: 150 ,fontFamily:'normal'}}>{item.value}</Text>
132142
</View>);
133143
}} />
134144
<FlatList

0 commit comments

Comments
 (0)